Commit d6d035a5 authored by camilo higuita's avatar camilo higuita

auto tag faved pics and work on the tags dialog done for now close #19

parent ec2cd9e7
......@@ -5,7 +5,7 @@ ListView
{
orientation: ListView.Horizontal
clip: true
spacing: contentMargins
signal tagRemoved(int index)
model: ListModel{ ListElement{tag: "test"}}
......
......@@ -4,11 +4,11 @@ import QtQuick.Layouts 1.3
import "../../../view_models"
import "../../custom/TagBar"
import "../../../db/Query.js" as Q
import "../../views/Pix.js" as PIX
PixPopup
{
padding: contentMargins*2
width: 200
property string picUrl : ""
......@@ -76,6 +76,7 @@ PixPopup
Button
{
text: qsTr("Add")
Layout.alignment: Qt.AlignRight
onClicked: addTags(picUrl)
}
}
......@@ -90,7 +91,7 @@ PixPopup
if(tags.length > 0)
for(i in tags)
{
if(pix.picTag(tags[i].tag, url))
if(PIX.addTag(tags[i].tag, picUrl))
picTagged(tags[i].tag)
}
......
......@@ -6,3 +6,8 @@ function refreshViews()
galleryView.populate()
foldersView.populate()
}
function addTag(tag, url)
{
return pix.picTag(tag, url)
}
......@@ -59,7 +59,7 @@ PixPage
{
id: tagsDialog
onPicTagged: tagBar.tagsList.model.append({"tag": tag})
onPicTagged: tagBar.tagsList.model.insert(0, {"tag": tag})
}
PixHolder
......
.import "../Pix.js" as PIX
function open(model, index)
{
pixViewer.currentPicIndex = index
......@@ -52,7 +55,23 @@ function previous()
function fav(url)
{
var faved = pix.isFav(url);
if(!faved)
{
if(PIX.addTag("fav", pixViewer.currentPic.url))
pixViewer.tagBar.tagsList.model.insert(0, {"tag": "fav"})
}else
{
if(pix.removePicTag("fav", pixViewer.currentPic.url))
pixViewer.tagBar.tagsList.populate(pixViewer.currentPic.url)
}
if(pix.favPic(url, !faved))
return !faved
}
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