4 * This file is part of CameraPlus.
6 * Copyright (C) 2012-2013 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
31 controlsVisible: false
32 policyMode: CameraResources.None
33 activationData: ControlsActivationData {standbyVisible: !Qt.application.active}
35 property Item currentItem: null
36 property bool available: currentItem ? currentItem.itemData.available : false
38 Component.onCompleted: postCaptureModel.reload();
40 function launchGallery() {
41 if (!gallery.launch()) {
42 showError(qsTr("Failed to launch gallery"));
46 function showInGallery() {
51 if (!gallery.show(currentItem.itemUrl)) {
52 showError(qsTr("Failed to launch gallery"));
58 onStatusChanged: page.restartTimer();
61 MenuItem {text: qsTr("Captures in gallery"); onClicked: launchGallery(); }
62 MenuItem {text: qsTr("View in gallery"); enabled: available; onClicked: showInGallery(); }
66 function deleteCurrentItem() {
71 deleteDialog.message = currentItem.itemData.fileName;
77 titleText: qsTr("Delete item?");
78 acceptButtonText: qsTr("Yes");
79 rejectButtonText: qsTr("No");
81 onStatusChanged: page.restartTimer();
84 if (!remove.remove(currentItem.itemData.url)) {
85 showError(qsTr("Failed to delete item"));
88 postCaptureModel.remove(currentItem.itemData);
97 function shareCurrentItem() {
102 if (!share.share(currentItem.itemData.url)) {
103 showError(qsTr("Failed to launch share service"));
107 function addOrRemoveFavorite() {
112 if (currentItem.itemData.favorite) {
113 if (!trackerStore.removeFromFavorites(currentItem.itemData.url)) {
114 showError(qsTr("Failed to remove favorite"));
117 currentItem.itemData.favorite = false;
121 if (!trackerStore.addToFavorites(currentItem.itemData.url)) {
122 showError(qsTr("Failed to add favorite"));
125 currentItem.itemData.favorite = true;
132 settings: platformSettings
137 settings: platformSettings
151 startY: view.height / 2
152 PathLine { x: view.width * 2; y: view.height / 2 }
155 // Insanely high value to prevent panning multiple images
156 flickDeceleration: 999999
158 preferredHighlightBegin: 0.5
159 preferredHighlightEnd: 0.5
160 highlightRangeMode: PathView.StrictlyEnforceRange
163 model: PostCaptureModel {
165 manufacturer: deviceInfo.manufacturer
166 model: deviceInfo.model
168 console.log("Error populating model " + msg);
169 showError(qsTr("Failed to load captures"));
174 // TODO: Hide this when we have no items
175 text: qsTr("No captures available");
176 anchors.centerIn: parent
178 visible: currentItem == null
181 delegate: PostCaptureItem {
184 onClicked: hideTimer.running = !hideTimer.running;
188 function restartTimer() {
189 hideTimer.running = true;
202 anchors.bottom: parent.bottom
203 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
204 anchors.left: parent.left
205 anchors.leftMargin: 20
208 property bool show: deleteDialog.status == DialogStatus.Open || deleteDialog.status == DialogStatus.Opening || hideTimer.running || menu.status == DialogStatus.Open || menu.status == DialogStatus.Opening || (currentItem && currentItem.error)
210 onClicked: pageStack.pop();
212 Behavior on anchors.bottomMargin {
213 PropertyAnimation { duration: 200; }
217 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(); } },
218 ToolIcon { iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"; onClicked: { shareCurrentItem(); page.restartTimer(); } },
219 ToolIcon { iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"; onClicked: { deleteCurrentItem(); page.restartTimer(); } },
220 ToolIcon { iconId: "icon-m-toolbar-view-menu-white"; onClicked: { menu.open(); page.restartTimer(); } }
225 opacity: toolBar.opacity
226 anchors.top: parent.top
227 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
228 anchors.left: parent.left
229 anchors.leftMargin: 20
230 anchors.right: parent.right
231 anchors.rightMargin: 20
232 visible: toolBar.visible
233 height: screen.isPortrait ? toolBar.height * 2 : toolBar.height
235 border.color: toolBar.border.color
236 radius: toolBar.radius
238 Behavior on anchors.topMargin {
239 PropertyAnimation { duration: 200; }
243 width: parent.width - 40
245 height: parent.height
248 text: currentItem ? currentItem.itemData.title : ""
249 width: parent.width / 2
250 height: parent.height
252 verticalAlignment: Text.AlignVCenter
253 horizontalAlignment: Text.AlignLeft
257 text: currentItem ? currentItem.itemData.created : ""
258 width: parent.width / 2
259 height: parent.height
261 verticalAlignment: Text.AlignVCenter
262 horizontalAlignment: Text.AlignRight