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"));
63 MenuItem {text: qsTr("Captures in gallery"); onClicked: launchGallery(); }
64 MenuItem {text: qsTr("View in gallery"); enabled: available; onClicked: showInGallery(); }
68 function deleteCurrentItem() {
73 deleteDialog.message = currentItem.itemData.fileName;
79 titleText: qsTr("Delete item?");
80 acceptButtonText: qsTr("Yes");
81 rejectButtonText: qsTr("No");
83 if (!remove.remove(currentItem.itemData.url)) {
84 showError(qsTr("Failed to delete item"));
87 postCaptureModel.remove(currentItem.itemData);
96 function shareCurrentItem() {
101 if (!share.share(currentItem.itemData.url)) {
102 showError(qsTr("Failed to launch share service"));
106 function addOrRemoveFavorite() {
111 if (currentItem.itemData.favorite) {
112 if (!trackerStore.removeFromFavorites(currentItem.itemData.url)) {
113 showError(qsTr("Failed to remove favorite"));
116 currentItem.itemData.favorite = false;
120 if (!trackerStore.addToFavorites(currentItem.itemData.url)) {
121 showError(qsTr("Failed to add favorite"));
124 currentItem.itemData.favorite = true;
148 startY: view.height / 2
149 PathLine { x: view.width * 2; y: view.height / 2 }
152 flickDeceleration: 999999 // Insanely high value to prevent panning multiple images
153 preferredHighlightBegin: 0.5
154 preferredHighlightEnd: 0.5
155 highlightRangeMode: PathView.StrictlyEnforceRange
158 model: PostCaptureModel {
160 manufacturer: deviceInfo.manufacturer
161 model: deviceInfo.model
163 console.log("Error populating model " + msg);
164 showError(qsTr("Failed to load captures"));
169 // TODO: Hide this when we have no items
170 text: qsTr("No captures available");
171 anchors.centerIn: parent
173 visible: currentItem == null
176 delegate: PostCaptureItem {
177 width: view.width - 10
186 anchors.bottom: parent.bottom
187 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
188 anchors.left: parent.left
189 anchors.leftMargin: 20
192 property bool show: true
194 onClicked: pageStack.pop();
196 Behavior on anchors.bottomMargin {
197 PropertyAnimation { duration: 200; }
201 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(); },
202 ToolIcon { iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"; onClicked: shareCurrentItem(); },
203 ToolIcon { iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"; onClicked: deleteCurrentItem(); },
204 ToolIcon { iconId: "icon-m-toolbar-view-menu-white"; onClicked: menu.open(); }
209 opacity: toolBar.opacity
210 anchors.top: parent.top
211 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
212 anchors.left: parent.left
213 anchors.leftMargin: 20
214 anchors.right: parent.right
215 anchors.rightMargin: 20
216 visible: toolBar.visible
217 height: toolBar.height
219 border.color: toolBar.border.color
220 radius: toolBar.radius
222 Behavior on anchors.topMargin {
223 PropertyAnimation { duration: 200; }
227 text: currentItem ? currentItem.itemData.title : ""
228 anchors.top: parent.top
229 anchors.bottom: parent.bottom
230 anchors.left: parent.left
231 anchors.leftMargin: 20
233 verticalAlignment: Text.AlignVCenter
237 text: currentItem ? currentItem.itemData.created : ""
239 anchors.top: parent.top
240 anchors.bottom: parent.bottom
241 anchors.right: parent.right
242 anchors.rightMargin: 20
243 verticalAlignment: Text.AlignVCenter