Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/qml/pages/CameraUI.qml b/qml/pages/CameraUI.qml
- index bcb9cbf..abfd0d2 100644
- --- a/qml/pages/CameraUI.qml
- +++ b/qml/pages/CameraUI.qml
- @@ -58,7 +58,7 @@ Page {
- }
- onImageSaved: {
- console.log("Camera: image saved", path)
- - galleryModel.append({ photoPath: "file://" + path })
- + galleryModel.append({ photoPath: path })
- }
- }
- }
- diff --git a/qml/pages/GalleryUI.qml b/qml/pages/GalleryUI.qml
- index 9dd7284..ea6d873 100644
- --- a/qml/pages/GalleryUI.qml
- +++ b/qml/pages/GalleryUI.qml
- @@ -1,5 +1,6 @@
- import QtQuick 2.0
- import Sailfish.Silica 1.0
- +import Nemo.FileManager 1.0
- Page {
- id: galleryPage
- @@ -9,6 +10,129 @@ Page {
- // The effective value will be restricted by ApplicationWindow.allowedOrientations
- allowedOrientations: Orientation.All
- + backNavigation: false
- +
- + WorkerScript {
- + id: worker
- + source: Qt.resolvedUrl("js/workersync.mjs")
- + }
- +
- + Connections {
- + target: FileEngine
- + onFileDeleted: cleanupGallery()
- + }
- +
- + function removeFile(idx) {
- + console.log("Removing", photoList.get(idx).photoPath)
- + FileEngine.deleteFiles([photoList.get(idx).photoPath])
- + photoList.remove(idx)
- + worker.sendMessage({"model" : photoList})
- + }
- +
- + function cleanupGallery() {
- + console.log("Cleanup after file removal")
- + console.log("Gallery has", gallery.count, "items now and photoList has", photoList.count, "items now !")
- + if (gallery.count === 0) {
- + console.log("Zero gallery.count detected, closing gallery !")
- + pageStack.pop()
- + }
- + }
- +
- + Rectangle {
- + id: boxTop
- +
- + z: 99
- + visible: true
- + width: parent.width
- + height: parent.height / 6
- + color: "transparent"
- +
- + IconButton {
- + id: btnInfo
- + enabled: false
- +
- + icon.source: "image://theme/icon-m-about"
- +
- + anchors {
- + top: parent.top
- + topMargin: Theme.paddingMedium
- + left: parent.left
- + leftMargin: Theme.paddingMedium
- + }
- +
- + onClicked: {
- + console.log("Clicked info button")
- + }
- + }
- +
- + IconButton {
- + id: btnClose
- +
- + icon.source: "image://theme/icon-m-close"
- +
- + anchors {
- + top: parent.top
- + topMargin: Theme.paddingMedium
- + right: parent.right
- + rightMargin: Theme.paddingMedium
- + }
- +
- + onClicked: {
- + console.log("Clicked close button")
- + parent.visible = false
- + pageStack.pop()
- + }
- + }
- + }
- +
- + Rectangle {
- + id: boxBottom
- +
- + z: 99
- + visible: true
- + width: parent.width
- + height: parent.height / 6
- + color: "transparent"
- +
- + anchors.bottom: parent.bottom
- +
- + IconButton {
- + id: btnRemove
- +
- + icon.source: "image://theme/icon-m-delete"
- +
- + anchors {
- + top: parent.top
- + topMargin: Theme.paddingMedium
- + right: parent.horizontalCenter
- + rightMargin: Theme.paddingMedium
- + }
- +
- + onClicked: {
- + console.log("Clicked delete button, gallery has", gallery.count, "items...")
- + removeFile(gallery.currentIndex)
- + }
- + }
- +
- + IconButton {
- + id: btnShare
- + enabled: false
- +
- + icon.source: "image://theme/icon-m-share"
- +
- + anchors {
- + top: parent.top
- + topMargin: Theme.paddingMedium
- + left: parent.horizontalCenter
- + leftMargin: Theme.paddingMedium
- + }
- +
- + onClicked: {
- + console.log("Clicked share button")
- + }
- + }
- + }
- +
- SlideshowView {
- id: gallery
- @@ -32,13 +156,14 @@ Page {
- sourceSize.width: parent.width
- anchors.fill: parent
- fillMode: Image.PreserveAspectFit
- - source: photoPath
- + source: "file://" + photoPath
- MouseArea {
- anchors.fill: parent
- onClicked: {
- console.log("Clicked", thumbnail.source)
- - Qt.openUrlExternally(thumbnail.source)
- + boxTop.visible = boxTop.visible ? false : true
- + boxBottom.visible = boxTop.visible
- }
- }
- }
- diff --git a/qml/pages/js/workersync.mjs b/qml/pages/js/workersync.mjs
- new file mode 100644
- index 0000000..01dc476
- --- /dev/null
- +++ b/qml/pages/js/workersync.mjs
- @@ -0,0 +1,4 @@
- +WorkerScript.onMessage = function(msg) {
- + console.log("Syncing", msg.model, "model...");
- + msg.model.sync();
- +}
Advertisement
Add Comment
Please, Sign In to add comment