Commit 8ed6d453 authored by Camilo Higuita's avatar Camilo Higuita

add image placeholders, move tagsbar out of footBars and work on tagging fixes...

add image placeholders, move tagsbar out of footBars and work on tagging fixes and make use of mauikit icondelegate for folderview
parent 5cc44888
<RCC>
<qresource prefix="/img">
<file>assets/face.png</file>
<file>assets/Babe.notifyrc</file>
<file>assets/face-sleeping.png</file>
<file>assets/face-hug.png</file>
<file>assets/pix.png</file>
<file>assets/tag.svg</file>
<file>assets/album_bg_normal.png</file>
<file>assets/banner.png</file>
<file>assets/album.svg</file>
<file>assets/image-x-generic.svg</file>
<file>assets/ElectricPlug.png</file>
<file>assets/Bread.png</file>
<file>assets/Electricity.png</file>
<file>assets/MoonSki.png</file>
<file>assets/SunSki.png</file>
<file>assets/RedPlanet.png</file>
<file>assets/Rainbow.png</file>
<file>assets/BugSearch.png</file>
</qresource>
<qresource prefix="/"/>
</RCC>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="32.000805"
height="10.000002"
viewBox="0 0 32.000805 10.000002"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="tag.svg">
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#4d4d4d;
}
</style>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="9.6022728"
inkscape:cx="-12.691433"
inkscape:cy="-9.2461746"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:showpageshadow="false"
borderlayer="true"
showguides="false"
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="34"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0">
<inkscape:grid
type="xygrid"
id="grid4136"
empspacing="2"
originx="-1.999195"
originy="-5.9999982" />
<sodipodi:guide
position="-1.999195,14.000002"
orientation="0,1"
id="guide4140"
inkscape:label="Icon Max Height"
inkscape:color="rgb(233,30,99)"
inkscape:locked="false" />
<sodipodi:guide
position="-1.999195,-3.9999982"
orientation="0,1"
id="guide4142"
inkscape:label="Icon Baseline"
inkscape:color="rgb(233,30,99)"
inkscape:locked="false" />
<sodipodi:guide
position="9.000805,-5.9999982"
orientation="1,0"
id="guide4144"
inkscape:label="Center Vertical"
inkscape:color="rgb(221,44,0)"
inkscape:locked="false" />
<sodipodi:guide
position="13.000805,5.0000019"
orientation="0,1"
id="guide4146"
inkscape:label="Center Horizontal"
inkscape:color="rgb(221,44,0)"
inkscape:locked="false" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Capa 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-1.999195,-1036.3622)">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.27900002;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M 6.0003906,6 C 5.6852934,5.9998619 5.3885573,6.1482299 5.1996094,6.4003906 l -3,4.0000004 c -0.2672192,0.355805 -0.2672192,0.845366 0,1.201171 l 3,4 C 5.3889656,15.852987 5.6856368,16.000599 6.0003906,16 l 2,0 L 32,16 c 1.10801,0 2,-0.89199 2,-2 L 34,8 C 34,6.8919904 33.10801,6 32,6 L 8.0003906,6 Z m -1,4 c 0.5522847,0 1,0.447715 1,1 0,0.552285 -0.4477153,1 -1,1 -0.5522847,0 -1,-0.447715 -1,-1 0,-0.552285 0.4477153,-1 1,-1 z"
id="path841"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccssssccsssss"
transform="translate(0,1030.3622)"
inkscape:export-filename="/home/camilo/Coding/qml/pix-qml/assets/tag.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
</svg>
......@@ -26,7 +26,7 @@ DBActions::DBActions(QObject *parent) : DB(parent)
qDebug()<< "Starting DBActions";
this->tag = Tagging::getInstance(PIX::App, PIX::version, "org.kde.pix", PIX::comment);
this->tag = Tagging::getInstance(PIX::App, PIX::version, "org.kde.pix", PIX::comment);
}
DBActions::~DBActions()
......@@ -264,13 +264,18 @@ QVariantList DBActions::getFolders()
QVariantList res;
auto data = this->getDBData("select * from sources order by url asc");
/*Data model keys for to be used on MauiKit Icondelegate component */
for(auto i : data)
{
QVariantMap map;
map.insert(PIX::KEYMAP[PIX::KEY::URL], i[PIX::KEY::URL]);
map.insert("folder", QFileInfo(i[PIX::KEY::URL]).baseName());
res << map;
}
return res;
res << QVariantMap {
{PIX::KEYMAP[PIX::KEY::URL], i[PIX::KEY::URL]},
{"label", QFileInfo(i[PIX::KEY::URL]).baseName()},
{"mime", "inode/directory"},
{"icon", "folder"},
{"path", i[PIX::KEY::URL]}
};
}
return res;
}
......@@ -17,7 +17,6 @@
<file>widgets/views/Viewer/PixViewer.qml</file>
<file>widgets/views/Settings/SettingsView.qml</file>
<file>widgets/views/Folders/FoldersGrid.qml</file>
<file>widgets/views/Folders/FoldersDelegate.qml</file>
<file>widgets/views/Viewer/EditTools.qml</file>
<file>widgets/views/Viewer/Viewer.qml</file>
<file>widgets/views/Viewer/Viewer.js</file>
......
......@@ -23,9 +23,7 @@ Maui.Page
Maui.Holder
{
id: holder
message: "<h2>No Pics!</h2><p>There's not images in here</p>"
emoji: "qrc:/img/assets/face-hug.png"
id: holder
visible: grid.count === 0
}
......
......@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
import "../../../view_models"
import "../../../db/Query.js" as Q
import "../../views/Pix.js" as PIX
import org.kde.maui 1.0 as Maui
PixDialog
......@@ -11,11 +12,9 @@ PixDialog
property string picUrl : ""
property bool forAlbum : false
clip: true
signal albumTagged(string tag, string url)
signal picTagged(string tag, string url)
signal tagsAdded(var tags, string url)
standardButtons: Dialog.Save | Dialog.Cancel
onAccepted: setTags()
......@@ -93,7 +92,7 @@ PixDialog
var tags = []
for(var i = 0; i < tagListComposer.model.count; i++)
tags.push(tagListComposer.model.get(i))
tags.push(tagListComposer.model.get(i).tag)
tagsAdded(tags, picUrl)
}
......@@ -107,25 +106,13 @@ PixDialog
return
for(var i in tags)
if(PIX.addTagToPic(tags[i].tag, url))
picTagged(tags[i].tag, url)
if(PIX.addTagToPic(tags[i], url))
picTagged(tags[i], url)
}
close()
}
function addTagsToAlbum(url, tags)
{
if(tags.length > 0)
for(var i in tags)
{
if(PIX.addTagToAlbum(tags[i].tag, url))
albumTagged(tags[i].tag, picUrl)
}
close()
}
function populate()
{
tagsList.model.clear()
......
......@@ -47,4 +47,5 @@ ListView
}
}
}
}
......@@ -6,6 +6,7 @@ import org.kde.maui 1.0 as Maui
import "../../../view_models"
import "../../../db/Query.js" as Q
import "../../views/Pix.js" as PIX
import "../../dialogs/Albums"
import "../../dialogs/Tags"
......@@ -26,8 +27,7 @@ Kirigami.PageRow
{
id: tagsDialog
forAlbum: true
onTagsAdded: addTagsToAlbum(url, tags)
onAlbumTagged: tagBar.tagsList.model.insert(0, {"tag": tag})
onTagsAdded: addTagsToAlbum(albumGrid.currentAlbum, tags)
}
Maui.NewDialog
......@@ -70,8 +70,12 @@ Kirigami.PageRow
anchors.fill: parent
headBarVisible: true
holder.message: "<h2>No Pics!</h2><p>This albums is empty</p>"
holder.emoji: "qrc:/img/assets/face-sleeping.png"
holder.title: "No Pics!"
holder.body: "This album is empty"
holder.isMask: false
holder.emojiSize: iconSizes.huge
holder.emoji: "qrc:/img/assets/MoonSki.png"
headBarExit: albumsPageRoot.currentIndex === 1
headBarExitIcon: "go-previous"
......@@ -79,22 +83,19 @@ Kirigami.PageRow
onExit: albumsPageRoot.currentIndex = 0
footer: Maui.ToolBar
footer: Maui.TagsBar
{
id: footerBar
position: ToolBar.Footer
visible: false
Maui.TagsBar
{
id: tagBar
anchors.fill: parent
onAddClicked: albumsPageRoot.tagsDialog.show(albumGrid.currentAlbum)
onTagRemovedClicked: if(pix.removeAlbumTag(tagsList.model.get(index).tag, albumGrid.currentAlbum))
tagsList.model.remove(index)
}
id: tagBar
width: picsView.width
allowEditMode: true
onAddClicked: tagsDialog.show(albumGrid.currentAlbum)
onTagsEdited: addTagsToAlbum(albumGrid.currentAlbum, tags)
onTagRemovedClicked: if(pix.removeAlbumTag(tagsList.model.get(index).tag, albumGrid.currentAlbum))
tagsList.model.remove(index)
}
}
function populate()
......@@ -118,7 +119,7 @@ Kirigami.PageRow
albumGrid.currentAlbum = album
picsView.clear()
tagBar.tagsList.model.clear()
footerBar.visible = false
tagBar.visible = false
switch(album)
{
......@@ -134,7 +135,7 @@ Kirigami.PageRow
for(var i in tags)
populateAlbum(tag.getUrls(tags[i].tag))
footerBar.visible = true
tagBar.visible = true
tagBar.tagsList.populate(tags)
break
}
......@@ -157,4 +158,13 @@ Kirigami.PageRow
albumGrid.model.append({"album": album})
}
function addTagsToAlbum(album, tags)
{
if(tags.length > 0)
for(var i in tags)
if(PIX.addTagToAlbum(tags[i], album))
tagBar.append({"tag": tags[i]})
}
}
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.2 as Kirigami
ItemDelegate
{
property int folderSize : iconSizes.big
property color hightlightedColor : GridView.isCurrentItem || hovered ? highlightColor : "transparent"
property color labelColor : GridView.isCurrentItem && !hovered ? highlightedTextColor : textColor
hoverEnabled: !isMobile
focus: true
background: Rectangle
{
color: "transparent"
}
ColumnLayout
{
anchors.fill: parent
spacing: space.small
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumHeight: folderSize
Layout.alignment: Qt.AlignCenter
Kirigami.Icon
{
anchors.centerIn: parent
source: "folder"
isMask: false
height: folderSize
width: folderSize
}
}
Item
{
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignTop
Label
{
text: folder
width: parent.width * 0.8
height: parent.height * 0.8
anchors.centerIn: parent
verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter
elide: Qt.ElideRight
font.pointSize: fontSizes.default
color: labelColor
Rectangle
{
visible: parent.visible
anchors.fill: parent
z: -1
radius: folderSize*0.05
color: hightlightedColor
opacity: hovered ? 0.25 : 1
}
}
}
}
}
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.maui 1.0 as Maui
GridView
{
......@@ -29,14 +29,17 @@ GridView
model: ListModel {id: gridModel}
highlightFollowsCurrentItem: true
delegate: FoldersDelegate
delegate: Maui.IconDelegate
{
id: delegate
folderSize : itemSize
showTooltip: true
width: cellWidth
width: cellWidth * 0.9
height: cellHeight * 0.9
showEmblem: false
Connections
{
target: delegate
......
......@@ -31,9 +31,9 @@ Kirigami.PageRow
onFolderClicked:
{
folderGrid.currentIndex = index
picsView.headBarTitle = folderGrid.model.get(index).folder
picsView.headBarTitle = folderGrid.model.get(index).label
picsView.clear()
currentFolder = folderGrid.model.get(index).url
currentFolder = folderGrid.model.get(index).path
picsView.populate(currentFolder)
foldersPageRoot.currentIndex = 1
}
......@@ -49,6 +49,12 @@ Kirigami.PageRow
headBarExit: foldersPageRoot.currentIndex === 1
headBarExitIcon: "go-previous"
onExit: foldersPageRoot.currentIndex = 0
holder.emoji: "qrc:/img/assets/Electricity.png"
holder.isMask: false
holder.title : "Folder is empty!"
holder.body: "There's not images on this folder"
holder.emojiSize: iconSizes.huge
}
function populate()
......
......@@ -45,6 +45,11 @@ Kirigami.PageRow
headBarExit: !wideMode
headBarExitIcon: "go-previous"
onExit: if(!wideMode) currentIndex = 0
holder.title: "No Pics!"
holder.body: "There's no pics associated with the tag"
holder.isMask: false
holder.emojiSize: iconSizes.huge
holder.emoji: "qrc:/img/assets/Bread.png"
}
function populate()
......
......@@ -26,8 +26,6 @@ Maui.Page
margins: 0
headBarTitle: currentPic.title || ""
headBarExit: false
headBarVisible: !holder.visible && !fullScreen
......@@ -54,26 +52,6 @@ Maui.Page
onClicked: albumsDialog.show(currentPic.url)
}
footBar.margins: 0
footBar.visible: !holder.visible && tagBarVisible && !fullScreen
footBar.middleContent: Maui.TagsBar
{
id: tagBar
width: footBar.width
height: footBar.height
allowEditMode: true
onTagClicked: PIX.searchFor(tag)
onAddClicked: tagsDialog.show(currentPic.url)
onTagRemovedClicked: if(pix.removePicTag(tagsList.model.get(index).tag, pixViewer.currentPic.url))
tagsList.model.remove(index)
onTagsEdited:
{
PIX.updatePicTags(tags, pixViewer.currentPic.url)
VIEWER.setCurrentPicTags()
}
}
Connections
{
......@@ -120,18 +98,42 @@ Maui.Page
// visible: shareDialog.opened
// }
contentData: Viewer
contentData: ColumnLayout
{
id: viewer
spacing: 0
height: parent.height
width: parent.width
GalleryRoll
Viewer
{
id: galleryRoll
visible: !holder.visible
anchors.bottom: parent.bottom
onPicClicked: VIEWER.view(index)
id: viewer
Layout.fillHeight: true
Layout.fillWidth: true
GalleryRoll
{
id: galleryRoll
visible: !holder.visible
anchors.bottom: parent.bottom
onPicClicked: VIEWER.view(index)
}
}
Maui.TagsBar
{
id: tagBar
visible: !holder.visible && tagBarVisible && !fullScreen
Layout.fillWidth: true
bgColor: viewerBackgroundColor
allowEditMode: true
onTagClicked: PIX.searchFor(tag)
onAddClicked: tagsDialog.show(currentPic.url)
onTagRemovedClicked: if(pix.removePicTag(tagsList.model.get(index).tag, pixViewer.currentPic.url))
tagsList.model.remove(index)
onTagsEdited:
{
PIX.updatePicTags(tags, pixViewer.currentPic.url)
VIEWER.setCurrentPicTags()
}
}
}
}
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