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
28 // TODO: losing resources while playback won't show an error
29 // TODO: mass storage mode interaction
34 controlsVisible: false
35 policyMode: CameraResources.PostCapture
37 standbyVisible: !Qt.application.active
39 property Item currentItem: null
40 property bool available: currentItem ? currentItem.itemData.available : false
42 Component.onCompleted: postCaptureModel.reload();
44 function launchGallery() {
45 if (!gallery.launch()) {
46 showError(qsTr("Failed to launch gallery"));
50 function showInGallery() {
55 if (!gallery.show(currentItem.itemUrl)) {
56 showError(qsTr("Failed to launch gallery"));
62 onStatusChanged: page.restartTimer();
65 MenuItem {text: qsTr("Captures in gallery"); onClicked: launchGallery(); }
66 MenuItem {text: qsTr("View in gallery"); enabled: available; onClicked: showInGallery(); }
70 function deleteCurrentItem() {
75 deleteDialog.message = currentItem.itemData.fileName;
81 titleText: qsTr("Delete item?");
82 acceptButtonText: qsTr("Yes");
83 rejectButtonText: qsTr("No");
85 onStatusChanged: page.restartTimer();
88 if (!remove.remove(currentItem.itemData.url)) {
89 showError(qsTr("Failed to delete item"));
92 postCaptureModel.remove(currentItem.itemData);
101 function shareCurrentItem() {
106 if (!share.share(currentItem.itemData.url)) {
107 showError(qsTr("Failed to launch share service"));
111 function addOrRemoveFavorite() {
116 if (currentItem.itemData.favorite) {
117 if (!trackerStore.removeFromFavorites(currentItem.itemData.url)) {
118 showError(qsTr("Failed to remove favorite"));
121 currentItem.itemData.favorite = false;
125 if (!trackerStore.addToFavorites(currentItem.itemData.url)) {
126 showError(qsTr("Failed to add favorite"));
129 currentItem.itemData.favorite = true;
153 startY: view.height / 2
154 PathLine { x: view.width * 2; y: view.height / 2 }
157 // Insanely high value to prevent panning multiple images
158 flickDeceleration: 999999
160 preferredHighlightBegin: 0.5
161 preferredHighlightEnd: 0.5
162 highlightRangeMode: PathView.StrictlyEnforceRange
165 model: PostCaptureModel {
167 manufacturer: deviceInfo.manufacturer
168 model: deviceInfo.model
170 console.log("Error populating model " + msg);
171 showError(qsTr("Failed to load captures"));
176 // TODO: Hide this when we have no items
177 text: qsTr("No captures available");
178 anchors.centerIn: parent
180 visible: currentItem == null
183 delegate: PostCaptureItem {
186 onClicked: hideTimer.running = !hideTimer.running;
190 function restartTimer() {
191 hideTimer.running = true;
204 anchors.bottom: parent.bottom
205 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
206 anchors.left: parent.left
207 anchors.leftMargin: 20
210 property bool show: deleteDialog.status == DialogStatus.Open || deleteDialog.status == DialogStatus.Opening || hideTimer.running || menu.status == DialogStatus.Open || menu.status == DialogStatus.Opening
212 onClicked: pageStack.pop();
214 Behavior on anchors.bottomMargin {
215 PropertyAnimation { duration: 200; }
219 ToolIcon { iconId: !available ? "icon-m-toolbar-favorite-mark-dimmed-white" : currentItem.itemData.favorite ? "icon-m-toolbar-favorite-mark-white" : "icon-m-toolbar-favorite-unmark-white"; onClicked: { addOrRemoveFavorite(); page.restartTimer(); } },
220 ToolIcon { iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"; onClicked: { shareCurrentItem(); page.restartTimer(); } },
221 ToolIcon { iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"; onClicked: { deleteCurrentItem(); page.restartTimer(); } },
222 ToolIcon { iconId: "icon-m-toolbar-view-menu-white"; onClicked: { menu.open(); page.restartTimer(); } }
227 opacity: toolBar.opacity
228 anchors.top: parent.top
229 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
230 anchors.left: parent.left
231 anchors.leftMargin: 20
232 anchors.right: parent.right
233 anchors.rightMargin: 20
234 visible: toolBar.visible
235 height: toolBar.height
237 border.color: toolBar.border.color
238 radius: toolBar.radius
240 Behavior on anchors.topMargin {
241 PropertyAnimation { duration: 200; }
245 text: currentItem ? currentItem.itemData.title : ""
246 anchors.top: parent.top
247 anchors.bottom: parent.bottom
248 anchors.left: parent.left
249 anchors.leftMargin: 20
251 verticalAlignment: Text.AlignVCenter
255 text: currentItem ? currentItem.itemData.created : ""
257 anchors.top: parent.top
258 anchors.bottom: parent.bottom
259 anchors.right: parent.right
260 anchors.rightMargin: 20
261 verticalAlignment: Text.AlignVCenter