Commit 05f484ba authored by Camilo higuita's avatar Camilo higuita

push latest changes

parent b8a80326
import org.kde.mauikit 1.0 as Maui
Maui.ApplicationWindow
{
}
......@@ -26,15 +26,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
DB::DB(QObject *parent) : QObject(parent)
{
this->init();
this->initDB();
}
DB::~DB()
{
this->m_db.close();
// this->m_db.close();
}
void DB::init()
void DB::initDB()
{
QDir collectionDBPath_dir(PIX::CollectionDBPath);
if (!collectionDBPath_dir.exists())
......@@ -60,8 +60,9 @@ void DB::openDB(const QString &name)
if (!this->m_db.isOpen())
{
if(!this->m_db.open())
qDebug()<<"ERROR OPENING DB"<<this->m_db.lastError().text()<<m_db.connectionName();
qDebug()<<"ERROR OPENING DBACTIONS"<<this->m_db.lastError().text()<<m_db.connectionName();
}
auto query = this->getQuery("PRAGMA synchronous=OFF");
query.exec();
}
......@@ -237,7 +238,7 @@ bool DB::remove(const QString &tableName, const FMH::MODEL &removeData)
return this->getQuery(sqlQueryString).exec();
}
QVariantList DB::get(const QString &queryTxt)
QVariantList DB::getList(const QString &queryTxt)
{
QVariantList mapList;
......
......@@ -60,10 +60,10 @@ public:
bool update(const QString &table, const QString &column, const QVariant &newValue, const QVariant &op, const QString &id);
bool remove(const QString &tableName, const FMH::MODEL &removeData);
QVariantList get(const QString &queryTxt);
QVariantList getList(const QString &queryTxt);
protected:
void init();
void initDB();
void openDB(const QString &name);
void prepareCollectionDB() const;
......
......@@ -35,7 +35,6 @@ void DBActions::init()
qDebug() << "Getting collectionDB info from: " << PIX::CollectionDBPath;
qDebug()<< "Starting DBActions";
this->tag = Tagging::getInstance();
}
......@@ -159,7 +158,7 @@ bool DBActions::favPic(const QString &url, const bool &fav )
return false;
FMH::MODEL favedPic = {{FMH::MODEL_KEY::FAV, fav ? "1" : "0"}};
return this->update(PIX::TABLEMAP[PIX::TABLE::IMAGES], favedPic, QVariantMap({{FMH::MODEL_NAME[FMH::MODEL_KEY::URL], url}}) );
return this->update(PIX::TABLEMAP[PIX::TABLE::IMAGES], favedPic, QVariantMap({{FMH::MODEL_NAME[FMH::MODEL_KEY::URL], url}}) );
}
bool DBActions::isFav(const QString &url)
......@@ -289,5 +288,5 @@ FMH::MODEL_LIST DBActions::getDBData(const QString &queryTxt)
QVariantList DBActions::get(const QString &queryTxt)
{
return this->get(queryTxt);
return this->getList(queryTxt);
}
......@@ -76,8 +76,8 @@ Maui.ApplicationWindow
folders: 2,
albums: 3,
tags: 4,
// cloud: 5,
// store: 6,
// cloud: 5,
// store: 6,
search: 5
})
/*PROPS*/
......@@ -115,21 +115,21 @@ Maui.ApplicationWindow
// menuDrawer.bannerImageSource: "qrc:/img/assets/banner.png"
mainMenu: [
// Maui.MenuItem
// {
// id: _storeButton
// text: qsTr("Store")
// onTriggered: currentView = views.store
// icon.name: "nx-software-center"
// },
// Maui.MenuItem
// {
// id: _cloudButton
// text: qsTr("Cloud")
// onTriggered: currentView = views.cloud
// icon.name: "folder-cloud"
// },
// Maui.MenuItem
// {
// id: _storeButton
// text: qsTr("Store")
// onTriggered: currentView = views.store
// icon.name: "nx-software-center"
// },
// Maui.MenuItem
// {
// id: _cloudButton
// text: qsTr("Cloud")
// onTriggered: currentView = views.cloud
// icon.name: "folder-cloud"
// },
Maui.MenuItem
{
......@@ -147,19 +147,24 @@ Maui.ApplicationWindow
icon.name: "folder-add"
onTriggered:
{
dialogLoader.sourceComponent= fmDialogComponent
dialog.mode= dialog.modes.OPEN
dialog.onlyDirs= true
dialog.show(function(paths)
{
pix.addSources(paths)
})
// dialogLoader.sourceComponent = sourcesDialogComponent;
// dialog.open()
dialogLoader.sourceComponent= fmDialogComponent
dialog.mode= dialog.modes.OPEN
dialog.onlyDirs= true
dialog.show(function(paths)
{
pix.addSources(paths)
})
}
},
Maui.MenuItem
{
text: "Open..."
icon.name: "folder-open"
onTriggered:
{
dialogLoader.sourceComponent= fmDialogComponent
......@@ -181,6 +186,8 @@ Maui.ApplicationWindow
Maui.ToolButton
{
text: qsTr("Viewer")
height: headBar.height
showIndicator: currentView === views.viewer
visible: !pixViewer.holder.visible
iconColor: currentView === views.viewer ? highlightColor : headBarFGColor
iconName: "image"
......@@ -190,6 +197,8 @@ Maui.ApplicationWindow
Maui.ToolButton
{
text: qsTr("Gallery")
height: headBar.height
showIndicator: currentView === views.gallery
iconColor: currentView === views.gallery? highlightColor : headBarFGColor
iconName: "image-multiple"
onClicked: currentView = views.gallery
......@@ -198,6 +207,8 @@ Maui.ApplicationWindow
Maui.ToolButton
{
text: qsTr("Folders")
height: headBar.height
showIndicator: currentView === views.folders
iconColor: currentView === views.folders? highlightColor : headBarFGColor
iconName: "image-folder-view"
onClicked: currentView = views.folders
......@@ -206,6 +217,8 @@ Maui.ApplicationWindow
Maui.ToolButton
{
text: qsTr("Albums")
height: headBar.height
showIndicator: currentView === views.albums
iconColor: currentView === views.albums? highlightColor : headBarFGColor
iconName: "image-frames"
onClicked: currentView = views.albums
......@@ -264,15 +277,15 @@ Maui.ApplicationWindow
}
// Loader
// {
// id: cloudViewLoader
// }
// Loader
// {
// id: cloudViewLoader
// }
// Loader
// {
// id: storeViewLoader
// }
// Loader
// {
// id: storeViewLoader
// }
SearchView
{
......@@ -295,27 +308,27 @@ Maui.ApplicationWindow
/*** Components ***/
// Component
// {
// id: _cloudViewComponent
// CloudView
// {
// anchors.fill : parent
// }
// }
// Component
// {
// id: _storeViewComponent
// Maui.Store
// {
// anchors.fill : parent
// detailsView: true
// list.category: StoreList.WALLPAPERS
// list.provider: StoreList.KDELOOK
// }
// }
// Component
// {
// id: _cloudViewComponent
// CloudView
// {
// anchors.fill : parent
// }
// }
// Component
// {
// id: _storeViewComponent
// Maui.Store
// {
// anchors.fill : parent
// detailsView: true
// list.category: StoreList.WALLPAPERS
// list.provider: StoreList.KDELOOK
// }
// }
Component
{
......@@ -351,13 +364,64 @@ Maui.ApplicationWindow
id: fmDialogComponent
Maui.FileDialog
{
id: fmDialog
onlyDirs: false
mode: modes.SAVE
filterType: FMList.IMAGE
}
}
Component
{
id: sourcesDialogComponent
Maui.Dialog
{
maxHeight: 500
maxWidth: 500
headBarTitle: qsTr("Sources")
headBar.rightContent: [
Maui.ToolButton
{
iconName: "list-add"
},
Maui.ToolButton
{
iconName: "list-remove"
}
]
ListView
{
id: _listView
clip: true
anchors.fill: parent
delegate: Maui.ListDelegate
{
id: _delegate
label: model.url
Connections
{
target: _delegate
onClicked: _listView.currentIndex = index
}
}
model: ListModel{}
}
Component.onCompleted:
{
var items = dba.get("select * from sources")
// console.log(items)
for(var i in items)
_listView.model.append(items[i]);
}
}
}
Loader
{
id: dialogLoader
......@@ -394,9 +458,9 @@ Maui.ApplicationWindow
onViewPics: VIEWER.openExternalPics(pics, 0)
}
// Component.onCompleted:
// {
// cloudViewLoader.sourceComponent = _cloudViewComponent
// storeViewLoader.sourceComponent= _storeViewComponent
// }
// Component.onCompleted:
// {
// cloudViewLoader.sourceComponent = _cloudViewComponent
// storeViewLoader.sourceComponent= _storeViewComponent
// }
}
......@@ -31,5 +31,6 @@
<file>widgets/SelectionBar.qml</file>
<file>widgets/views/Cloud/CloudView.qml</file>
<file>widgets/views/Store/StoreView.qml</file>
<file>MainSimple.qml</file>
</qresource>
</RCC>
......@@ -90,6 +90,7 @@ Maui.Menu
Maui.MenuItem
{
visible: !isAndroid
text: qsTr("Show in folder...")
onTriggered:
{
......
......@@ -155,7 +155,7 @@ ItemDelegate
Label
{
id: _label
text: model.adddate
text: model.title
width: parent.width
height: parent.height
horizontalAlignment: Qt.AlignHCenter
......
......@@ -66,7 +66,7 @@ Kirigami.PageRow
anchors.fill: parent
showEmblem: false
model: folderModel
cellWidth: itemSize * 10
onItemClicked:
{
......
......@@ -3,222 +3,21 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.4 as Kirigami
import org.kde.mauikit 1.0 as Maui
Flickable
Maui.ImageViewer
{
id: flick
property int itemWidth : parent.width
property int itemHeight : parent.height
property alias status : image.status
readonly property string currentImageSource: "file://"+model.url
property alias image: image
signal rightClicked();
signal pressAndHold();
image.source : currentImageSource
width: itemWidth
height: itemHeight
contentWidth: itemWidth
contentHeight: itemHeight
interactive: contentWidth > width || contentHeight > height
onInteractiveChanged: viewerList.interactive = !interactive;
clip: true
z: index == viewerList.currentIndex ? 1000 : 0
ScrollBar.vertical: ScrollBar {}
ScrollBar.horizontal: ScrollBar {}
PinchArea
{
width: Math.max(flick.contentWidth, flick.width)
height: Math.max(flick.contentHeight, flick.height)
property real initialWidth
property real initialHeight
onPinchStarted:
{
initialWidth = flick.contentWidth
initialHeight = flick.contentHeight
}
onPinchUpdated:
{
// adjust content pos due to drag
flick.contentX += pinch.previousCenter.x - pinch.center.x
flick.contentY += pinch.previousCenter.y - pinch.center.y
// resize content
flick.resizeContent(Math.max(itemWidth*0.7, initialWidth * pinch.scale), Math.max(itemHeight*0.7, initialHeight * pinch.scale), pinch.center)
}
onPinchFinished:
{
// Move its content within bounds.
if (flick.contentWidth < itemWidth || flick.contentHeight < itemHeight)
{
zoomAnim.x = 0;
zoomAnim.y = 0;
zoomAnim.width = itemWidth;
zoomAnim.height = itemHeight;
zoomAnim.running = true;
} else {
flick.returnToBounds();
}
}
ParallelAnimation
{
id: zoomAnim
property real x: 0
property real y: 0
property real width: itemWidth
property real height: itemHeight
NumberAnimation
{
target: flick
property: "contentWidth"
from: flick.contentWidth
to: zoomAnim.width
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
NumberAnimation
{
target: flick
property: "contentHeight"
from: flick.contentHeight
to: zoomAnim.height
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
NumberAnimation
{
target: flick
property: "contentY"
from: flick.contentY
to: zoomAnim.y
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
NumberAnimation
{
target: flick
property: "contentX"
from: flick.contentX
to: zoomAnim.x
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
}
Image
{
id: image
width: flick.contentWidth
height: flick.contentHeight
fillMode: Image.PreserveAspectFit
source: currentImageSource
autoTransform: true
asynchronous: true
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.RightButton | Qt.LeftButton
onClicked: if(!isMobile && mouse.button === Qt.RightButton)
rightClicked()
onPressAndHold: flick.pressAndHold()
onDoubleClicked:
{
if (flick.interactive) {
zoomAnim.x = 0;
zoomAnim.y = 0;
zoomAnim.width = itemWidth;
zoomAnim.height = itemHeight;
zoomAnim.running = true;
} else {
zoomAnim.x = mouse.x * 2;
zoomAnim.y = mouse.y *2;
zoomAnim.width = itemWidth * 3;
zoomAnim.height = itemHeight * 3;
zoomAnim.running = true;
}
}
onWheel:
{
if (wheel.modifiers & Qt.ControlModifier)
{
if (wheel.angleDelta.y != 0) {
var factor = 1 + wheel.angleDelta.y / 600;
zoomAnim.running = false;
zoomAnim.width = Math.min(Math.max(itemWidth, zoomAnim.width * factor), itemWidth * 4);
zoomAnim.height = Math.min(Math.max(itemHeight, zoomAnim.height * factor), itemHeight * 4);
//actual factors, may be less than factor
var xFactor = zoomAnim.width / flick.contentWidth;
var yFactor = zoomAnim.height / flick.contentHeight;
zoomAnim.x = flick.contentX * xFactor + (((wheel.x - flick.contentX) * xFactor) - (wheel.x - flick.contentX))
zoomAnim.y = flick.contentY * yFactor + (((wheel.y - flick.contentY) * yFactor) - (wheel.y - flick.contentY))
zoomAnim.running = true;
} else if (wheel.pixelDelta.y != 0) {
flick.resizeContent(Math.min(Math.max(itemWidth, flick.contentWidth + wheel.pixelDelta.y), itemWidth * 4),
Math.min(Math.max(itemHeight, flick.contentHeight + wheel.pixelDelta.y), itemHeight * 4),
wheel);
}
}
}
}
}
}
function zoomIn()
{
image.width = image.width + 50
}
function zoomOut()
{
image.width = image.width - 50 > 100 ? image.width - 50 :
image.width
}
function fit()
{
image.width = image.sourceSize.width
}
function fill()
{
image.width = parent.width
}
function rotateLeft()
{
image.rotation = image.rotation - 90
}
function rotateRight()
{
image.rotation = image.rotation + 90
}
height: itemHeight
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment