Commit 7dc82c7c authored by camilo higuita's avatar camilo higuita

fix viewer bg and fg color confs and finished the tags view, # 15 close #4

parent 013ef30e
......@@ -6,6 +6,7 @@ var Query = {
albumTags_ : "select * from albums_tags where album = \"%1\"",
picTags_ : "select * from images_tags where url = \"%1\"",
allTags : "select * from tags",
tagPics_: "select i.* from images i inner join images_tags it on it.url = i.url where it.tag = \"%1\"",
allAlbums : "select * from albums order by strftime(\"%s\", addDate) desc",
allAlbumPics_ : "select distinct i.* from images i inner join images_tags it on it.url = i.url inner join albums_tags at on at.tag = it.tag where at.album = \"%1\" union select i.* from images_albums ia inner join images i on i.url = ia.url where ia.album = \"%1\"",
......
......@@ -8,7 +8,7 @@ Item
property string emoji
property string message
clip: true
property color color : textColor
property color foregroundColor : textColor
focus: true
anchors.fill: parent
......@@ -63,7 +63,7 @@ Item
textFormat: Text.RichText
horizontalAlignment: Qt.AlignHCenter
elide: Text.ElideRight
color: textColor
color: foregroundColor
}
}
}
......
......@@ -43,7 +43,18 @@ PixPage
delegate: PixDelegate
{
id: delegate
label: tag
Connections
{
target: delegate
onClicked:
{
tagsList.currentIndex = index
populateGrid(tagsList.model.get(index).tag)
}
}
}
}
}
......
......@@ -25,6 +25,16 @@ Kirigami.PageRow
headerbarExit: !wideMode
headerbarExitIcon: "arrow-left"
onExit: if(!wideMode) currentIndex = 0
onPicClicked: openPic(index)
}
function openPic(index)
{
var data = []
for(var i = 0; i < grid.model.count; i++)
data.push(grid.model.get(i))
VIEWER.open(data, index)
}
function populate()
......@@ -37,8 +47,18 @@ Kirigami.PageRow
}
function populateGrid()
function populateGrid(tag)
{
if(!wideMode && currentIndex === 0)
currentIndex = 1
tagsGrid.grid.model.clear()
var tags = pix.get(Q.Query.tagPics_.arg(tag))
if(tags.length > 0)
for(var i in tags)
tagsGrid.grid.model.append(tags[i])
}
......
......@@ -9,6 +9,8 @@ PixDialog
standardButtons: Dialog.Save | Dialog.Cancel
title: qsTr("Viewer configuration")
onAccepted: saveConfs()
GridLayout
{
anchors.fill: parent
......@@ -28,20 +30,54 @@ PixDialog
TextField
{
id: bgColor
Layout.fillWidth: true
Layout.row: 1
Layout.column: 2
placeholderText: "#000"
text: backgroundColor
text: viewerBackgroundColor
onAccepted:
{
viewerBackgroundColor = text
pix.saveSettings("VIEWER_BG_COLOR", viewerBackgroundColor, "PIX")
}
}
Label
{
Layout.fillWidth: true
Layout.row: 2
Layout.column: 1
text: qsTr("Foreground color")
}
TextField
{
id: fgColor
Layout.fillWidth: true
Layout.row: 2
Layout.column: 2
placeholderText: "#000"
text: viewerForegroundColor
onAccepted:
{
viewerForegroundColor = text
pix.saveSettings("VIEWER_FG_COLOR", viewerForegroundColor, "PIX")
}
}
}
function saveConfs()
{
pix.saveSettings("VIEWER_BG_COLOR", bgColor.text, "PIX")
pix.saveSettings("VIEWER_FG_COLOR", fgColor.text, "PIX")
viewerForegroundColor = fgColor.text
viewerBackgroundColor = bgColor.text
}
}
......@@ -23,6 +23,7 @@ PixPage
property bool tagBarVisible : pix.loadSettings("TAGBAR", "PIX", true) === "true" ? true : false
property string viewerBackgroundColor : pix.loadSettings("VIEWER_BG_COLOR", "PIX", backgroundColor)
property string viewerForegroundColor : pix.loadSettings("VIEWER_FG_COLOR", "PIX", textColor)
Rectangle
......@@ -127,6 +128,7 @@ PixPage
message: "<h2>No Pic!</h2><p>Open an image from your collection</p>"
emoji: "qrc:/img/assets/face-hug.png"
visible: Object.keys(currentPic).length === 0
foregroundColor: viewerForegroundColor
}
// Rectangle
......
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