Commit 013ef30e authored by camilo higuita's avatar camilo higuita

initial work on tags view and work on zoom in and zoom out... etc. #20 #15 #13 #4

parent c08ee65a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.4.1, 2018-03-31T15:14:34. -->
<!-- Written by QtCreator 4.4.1, 2018-04-03T22:44:49. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
var Query = {
allPics : "select * from images order by strftime(\"%s\", addDate) desc",
picLikeUrl_ : "select * from images where url like \"%1%\" ",
picLikeUrl_ : "select * from images where url like \"%1%\" order by strftime(\"%s\", addDate) desc",
albumTags_ : "select * from albums_tags where album = \"%1\"",
picTags_ : "select * from images_tags where url = \"%1\"",
......
......@@ -136,7 +136,7 @@ Kirigami.ApplicationWindow
TagsView
{
id: tagsView
}
SettingsView
......
......@@ -128,6 +128,16 @@ QString Pix::pixColor()
return "#03A9F4";
}
void Pix::saveSettings(const QString &key, const QVariant &value, const QString &group)
{
PIX::saveSettings(key, value, group);
}
QVariant Pix::loadSettings(const QString &key, const QString &group, const QVariant &defaultValue)
{
return PIX::loadSettings(key, group, defaultValue);
}
int Pix::screenGeometry(QString &side)
{
......
......@@ -34,6 +34,8 @@ public:
Q_INVOKABLE bool run(const QString &query);
Q_INVOKABLE static QString pixColor();
Q_INVOKABLE static void saveSettings(const QString &key, const QVariant &value, const QString &group);
Q_INVOKABLE static QVariant loadSettings(const QString &key, const QString &group, const QVariant &defaultValue);
Q_INVOKABLE static int screenGeometry(QString &side);
Q_INVOKABLE static int cursorPos(QString &axis);
......
......@@ -46,5 +46,8 @@
<file>widgets/views/Viewer/GalleryRoll.qml</file>
<file>view_models/PixMenu.qml</file>
<file>widgets/views/Viewer/ViewerMenu.qml</file>
<file>widgets/views/Tags/TagsSidebar.qml</file>
<file>widgets/views/Viewer/ConfigurationDialog.qml</file>
<file>view_models/PixDialog.qml</file>
</qresource>
</RCC>
import QtQuick 2.9
import QtQuick.Controls 2.2
Dialog
{
width: parent.width * 0.5
height: parent.height*0.5
x: (parent.width - width) / 2
y: (parent.height - height) / 2
parent: ApplicationWindow.overlay
modal: true
margins: 1
padding: 2
}
......@@ -57,7 +57,7 @@ PixPage
model: ListModel {id: gridModel}
highlightMoveDuration: 0
highlightFollowsCurrentItem: true
highlight: Rectangle
{
......
......@@ -7,7 +7,7 @@ Page
{
property int toolbarHeight: 48
property int pageMargins : contentMargins
property bool headerbarVisible : true
property bool headerbarExit : true
property string headerbarExitIcon : "dialog-close"
......@@ -89,7 +89,7 @@ Page
Column
{
id: pageContent
Layout.margins: contentMargins
Layout.margins: pageMargins
Layout.fillHeight: true
Layout.fillWidth: true
}
......
......@@ -26,7 +26,8 @@ ItemDelegate
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
sourceSize.height: picSize-contentMargins
sourceSize.width: picSize-contentMargins
cache: true
......
......@@ -34,7 +34,7 @@ GridView
ListElement{album: "Recent"}
}
highlightFollowsCurrentItem: true
highlightMoveDuration: 0
delegate: AlbumDelegate
{
......
......@@ -2,10 +2,12 @@ function refreshViews()
{
galleryView.clear()
foldersView.clear()
tagsView.clear()
galleryView.populate()
foldersView.populate()
albumsView.populate()
tagsView.populate()
}
function addTagToPic(tag, url)
......
import QtQuick 2.9
import "../../../view_models"
PixPage
{
property alias list : tagsList
pageMargins : 0
headerbarExit: false
headerbarTitle: qsTr("Tags");
headerBarLeft: PixButton
{
iconName: "list-add"
}
headerBarRight: PixButton
{
iconName: "list-remove"
}
content: ListView
{
id: tagsList
height: parent.height
width: parent.width
focus: true
highlightMoveDuration: 0
highlightFollowsCurrentItem: true
highlight: Rectangle
{
width: tagsList.width
height: tagsList.currentItem.height
color: highlightColor
}
model: ListModel{}
delegate: PixDelegate
{
label: tag
}
}
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import org.kde.kirigami 2.2 as Kirigami
import "../../../view_models"
import "../../../db/Query.js" as Q
Item
Kirigami.PageRow
{
clip: true
separatorVisible: wideMode
initialPage: [tagsSidebar, tagsGrid]
defaultColumnWidth: Kirigami.Units.gridUnit * 15
interactive: false
TagsSidebar
{
id: tagsSidebar
}
PixGrid
{
id: tagsGrid
headerbarExit: !wideMode
headerbarExitIcon: "arrow-left"
onExit: if(!wideMode) currentIndex = 0
}
function populate()
{
var tags = pix.get(Q.Query.allTags)
if(tags.length > 0)
for(var i in tags)
tagsSidebar.list.model.append(tags[i])
}
function populateGrid()
{
}
function clear()
{
tagsSidebar.list.model.clear()
tagsGrid.grid.model.clear()
}
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../../../view_models"
PixDialog
{
standardButtons: Dialog.Save | Dialog.Cancel
title: qsTr("Viewer configuration")
GridLayout
{
anchors.fill: parent
rowSpacing: contentMargins
rows: 1
columns: 2
Label
{
Layout.fillWidth: true
Layout.row: 1
Layout.column: 1
text: qsTr("Background color")
}
TextField
{
Layout.fillWidth: true
Layout.row: 1
Layout.column: 2
placeholderText: "#000"
text: backgroundColor
onAccepted:
{
viewerBackgroundColor = text
pix.saveSettings("VIEWER_BG_COLOR", viewerBackgroundColor, "PIX")
}
}
}
}
......@@ -72,6 +72,7 @@ Item
function position(index)
{
rollList.currentIndex = index
rollList.positionViewAtIndex(index, ListView.Center)
}
......
......@@ -21,6 +21,17 @@ PixPage
property var picContext : []
property int currentPicIndex : 0
property bool tagBarVisible : pix.loadSettings("TAGBAR", "PIX", true) === "true" ? true : false
property string viewerBackgroundColor : pix.loadSettings("VIEWER_BG_COLOR", "PIX", backgroundColor)
Rectangle
{
anchors.fill: parent
z: -1
color: viewerBackgroundColor
}
headerbarTitle: currentPic.title || ""
headerbarExit: false
headerbarVisible: !holder.visible
......@@ -50,17 +61,32 @@ PixPage
albumsDialog.picUrl = currentPic.url
albumsDialog.open()
}
},
PixButton
{
iconName: "object-rotate-left"
onClicked: viewer.rotateLeft()
},
PixButton
{
iconName: "object-rotate-right"
onClicked: viewer.rotateRight()
}
]
footer: ToolBar
{
id: footerToolbar
position: ToolBar.Footer
visible: !holder.visible
visible: !holder.visible && tagBarVisible
TagBar
{
id: tagBar
visible: parent.visible
anchors.fill: parent
onAddClicked:
{
......@@ -68,7 +94,7 @@ PixPage
tagsDialog.open()
}
onTagRemovedClicked: if(pix.removePicTag(tagsList.model.get(index).tag, pixViewer.currentPic.url))
tagsList.model.remove(index)
tagsList.model.remove(index)
}
}
......@@ -90,6 +116,11 @@ PixPage
id: viewerMenu
}
ConfigurationDialog
{
id : viewerConf
}
PixHolder
{
id: holder
......@@ -112,16 +143,13 @@ PixPage
content: Viewer
{
id: viewer
MouseArea
{
anchors.fill: parent
onEntered: galleryRoll.visible = !galleryRoll.visible
}
height: parent.height
width: parent.width
GalleryRoll
{
id: galleryRoll
visible: !holder.visible
anchors.bottom: parent.bottom
onPicClicked: VIEWER.view(index)
}
......
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
Image
Item
{
property bool autoSaveTransformation : false
clip: true
height: parent.height
width: parent.width
source: "file://"+currentPic.url
fillMode: Image.PreserveAspectFit
cache: true
asynchronous: true
Image
{
id: pic
anchors.centerIn: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
height: parent.height
source: "file://"+currentPic.url
fillMode: Image.PreserveAspectFit
cache: true
asynchronous: true
MouseArea
{
anchors.fill: parent
onEntered: galleryRoll.visible = !galleryRoll.visible
onWheel: wheel.angleDelta.y > 0 ? zoomIn() : zoomOut()
}
}
function zoomIn()
{
pic.height = pic.height + 50
}
function zoomOut()
{
pic.height = pic.height - 50
}
function fit()
{
pic.height = pic.sourceSize.height
}
function fill()
{
pic.height = parent.height
}
function rotateLeft()
{
pic.rotation = pic.rotation - 90
}
function rotateRight()
{
pic.rotation = pic.rotation + 90
}
}
......@@ -14,16 +14,13 @@ PixMenu
id: viewerMenuLayout
MenuItem
{
text: qsTr(footerToolbar.visible ? "Hide Tag bar":
"Show Tag bar")
onTriggered: footerToolbar.visible = !footerToolbar.visible
}
MenuItem
{
text: qsTr(galleryRoll.visible ? "Pin Roll bar":
"UnPin Roll bar")
onTriggered: galleryRoll.visible = !galleryRoll.visible
text: qsTr(tagBarVisible ? "Hide Tag bar" :
"Show Tag bar")
onTriggered:
{
tagBarVisible = !tagBarVisible
pix.saveSettings("TAGBAR", tagBarVisible, "PIX")
}
}
Kirigami.Separator{ width: parent.width; height: 1}
......@@ -31,7 +28,11 @@ PixMenu
MenuItem
{
text: "Configurations..."
onTriggered: {close()}
onTriggered:
{
viewerConf.open()
close()
}
}
Kirigami.Separator{ width: parent.width; height: 1}
......
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