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
33 controlsVisible: false
34 policyMode: CameraResources.PostCapture
36 standbyVisible: !Qt.application.active
38 property Item currentItem: null
39 property bool available: currentItem ? currentItem.itemData.available : false
41 Component.onCompleted: postCaptureModel.reload();
43 function launchGallery() {
44 if (!gallery.launch()) {
45 showError(qsTr("Failed to launch gallery"));
49 function showInGallery() {
54 if (!gallery.show(currentItem.itemUrl)) {
55 showError(qsTr("Failed to launch gallery"));
61 onStatusChanged: page.restartTimer();
64 MenuItem {text: qsTr("Captures in gallery"); onClicked: launchGallery(); }
65 MenuItem {text: qsTr("View in gallery"); enabled: available; onClicked: showInGallery(); }
69 function deleteCurrentItem() {
74 deleteDialog.message = currentItem.itemData.fileName;
80 titleText: qsTr("Delete item?");
81 acceptButtonText: qsTr("Yes");
82 rejectButtonText: qsTr("No");
84 onStatusChanged: page.restartTimer();
87 if (!remove.remove(currentItem.itemData.url)) {
88 showError(qsTr("Failed to delete item"));
91 postCaptureModel.remove(currentItem.itemData);
100 function shareCurrentItem() {
105 if (!share.share(currentItem.itemData.url)) {
106 showError(qsTr("Failed to launch share service"));
110 function addOrRemoveFavorite() {
115 if (currentItem.itemData.favorite) {
116 if (!trackerStore.removeFromFavorites(currentItem.itemData.url)) {
117 showError(qsTr("Failed to remove favorite"));
120 currentItem.itemData.favorite = false;
124 if (!trackerStore.addToFavorites(currentItem.itemData.url)) {
125 showError(qsTr("Failed to add favorite"));
128 currentItem.itemData.favorite = true;
152 startY: view.height / 2
153 PathLine { x: view.width * 2; y: view.height / 2 }
156 // Insanely high value to prevent panning multiple images
157 flickDeceleration: 999999
159 preferredHighlightBegin: 0.5
160 preferredHighlightEnd: 0.5
161 highlightRangeMode: PathView.StrictlyEnforceRange
164 model: PostCaptureModel {
166 manufacturer: deviceInfo.manufacturer
167 model: deviceInfo.model
169 console.log("Error populating model " + msg);
170 showError(qsTr("Failed to load captures"));
175 // TODO: Hide this when we have no items
176 text: qsTr("No captures available");
177 anchors.centerIn: parent
179 visible: currentItem == null
182 delegate: PostCaptureItem {
185 onClicked: hideTimer.running = !hideTimer.running;
189 function restartTimer() {
190 hideTimer.running = true;
203 anchors.bottom: parent.bottom
204 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
205 anchors.left: parent.left
206 anchors.leftMargin: 20
209 property bool show: deleteDialog.status == DialogStatus.Open || deleteDialog.status == DialogStatus.Opening || hideTimer.running || menu.status == DialogStatus.Open || menu.status == DialogStatus.Opening || (currentItem && currentItem.error)
211 onClicked: pageStack.pop();
213 Behavior on anchors.bottomMargin {
214 PropertyAnimation { duration: 200; }
218 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(); } },
219 ToolIcon { iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"; onClicked: { shareCurrentItem(); page.restartTimer(); } },
220 ToolIcon { iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"; onClicked: { deleteCurrentItem(); page.restartTimer(); } },
221 ToolIcon { iconId: "icon-m-toolbar-view-menu-white"; onClicked: { menu.open(); page.restartTimer(); } }
226 opacity: toolBar.opacity
227 anchors.top: parent.top
228 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
229 anchors.left: parent.left
230 anchors.leftMargin: 20
231 anchors.right: parent.right
232 anchors.rightMargin: 20
233 visible: toolBar.visible
234 height: toolBar.height
236 border.color: toolBar.border.color
237 radius: toolBar.radius
239 Behavior on anchors.topMargin {
240 PropertyAnimation { duration: 200; }
244 text: currentItem ? currentItem.itemData.title : ""
245 anchors.top: parent.top
246 anchors.bottom: parent.bottom
247 anchors.left: parent.left
248 anchors.leftMargin: 20
250 verticalAlignment: Text.AlignVCenter
254 text: currentItem ? currentItem.itemData.created : ""
256 anchors.top: parent.top
257 anchors.bottom: parent.bottom
258 anchors.right: parent.right
259 anchors.rightMargin: 20
260 verticalAlignment: Text.AlignVCenter