4 * This file is part of CameraPlus.
6 * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 import com.nokia.meego 1.1
29 // TODO: losing resources while playback won't show an error
30 // TODO: show something if we have no files.
36 controlsVisible: false
37 policyMode: CameraResources.PostCapture
39 standbyVisible: !Qt.application.active
41 property Item currentItem: null
42 property bool available: currentItem ? currentItem.itemAvailable : false
44 function parseDate(str) {
45 var parts = str.split('T');
46 var dates = parts[0].split('-');
47 var times = parts[1].split(':');
48 return new Date(dates[0], dates[1], dates[2], times[0], times[1], times[2]);
51 function deleteCurrentItem() {
56 deleteDialog.message = currentItem.fileName;
62 titleText: qsTr("Delete item?");
63 acceptButtonText: qsTr("Yes");
64 rejectButtonText: qsTr("No");
66 // TODO: Remove from model and move to next item
67 if (!remove.remove(currentItem.itemUrl)) {
68 showError(qsTr("Failed to delete item"));
77 function shareCurrentItem() {
82 if (!share.share(currentItem.itemUrl)) {
83 showError(qsTr("Failed to launch share service"));
102 startY: view.height / 2
103 PathLine { x: view.width * 2; y: view.height / 2 }
106 flickDeceleration: 999999 // Insanely high value to prevent panning multiple images
107 preferredHighlightBegin: 0.5
108 preferredHighlightEnd: 0.5
109 highlightRangeMode: PathView.StrictlyEnforceRange
112 model: SparqlListModel {
113 query: 'SELECT rdf:type(?urn) AS ?type nie:url(?urn) AS ?url nie:contentCreated(?urn) AS ?created nie:title(?urn) AS ?title nfo:fileName(?urn) AS ?filename nie:mimeType(?urn) AS ?mimetype tracker:available(?urn) AS ?available nfo:fileLastModified(?urn) as ?lastmod tracker:id(?urn) AS ?trackerid (EXISTS { ?urn nao:hasTag nao:predefined-tag-favorite }) AS ?favorite WHERE { ?urn nfo:equipment "urn:equipment:' + deviceInfo.manufacturer + ':' + deviceInfo.model + ':" . {?urn a nfo:Video} UNION {?urn a nfo:Image}} ORDER BY DESC(?created)'
115 connection: SparqlConnection {
117 driver: "QTRACKER_DIRECT"
118 onStatusChanged: checkStatus(status)
120 function checkStatus(status) {
121 if (status == SparqlConnection.Error) {
122 // TODO: report error
123 console.log("Error = " + connection.errorString());
129 delegate: PostCaptureItem {
130 width: view.width - 10
138 anchors.bottom: parent.bottom
139 tools: ToolBarLayout {
141 ToolIcon { iconId: "icon-m-toolbar-back-white"; onClicked: { pageStack.pop(); } }
142 ToolIcon { iconId: available ? "icon-m-toolbar-favorite-mark-white" : "icon-m-toolbar-favorite-mark-dimmed-white"}
143 ToolIcon { iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"; onClicked: shareCurrentItem(); }
144 ToolIcon { iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"; onClicked: deleteCurrentItem(); }
145 ToolIcon { iconId: "icon-m-toolbar-view-menu-white" }
150 opacity: toolBar.opacity
151 anchors.top: parent.top
152 visible: toolBar.visible
154 tools: ToolBarLayout {
156 text: currentItem ? currentItem.itemTitle : ""
157 anchors.top: parent.top
158 anchors.bottom: parent.bottom
159 anchors.left: parent.left
161 verticalAlignment: Text.AlignVCenter
165 text: currentItem ? Qt.formatDateTime(parseDate(currentItem.creationDate)) : ""
167 anchors.top: parent.top
168 anchors.bottom: parent.bottom
169 anchors.right: parent.right
170 verticalAlignment: Text.AlignVCenter