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
25 import com.nokia.meego 1.1
29 property bool pressed: view.currentItem ? view.currentItem.playing : false
30 property int policyMode: settings.mode == Camera.VideoMode ? CameraResources.Video
31 : CameraResources.Image
32 property bool available: view.currentItem ? view.currentItem.itemData.available : false
34 Component.onCompleted: postCaptureModel.reload()
38 settings: platformSettings
43 settings: platformSettings
49 snapMode: ListView.SnapOneItem
50 cacheBuffer: height * 3
51 model: postCaptureModel
52 highlightRangeMode: ListView.StrictlyEnforceRange
54 delegate: PostCaptureItem {
57 onClicked: hideTimer.running = !hideTimer.running
61 if (flicking && hideTimer.running) {
68 // TODO: this should not be active all the time
70 manufacturer: deviceInfo.manufacturer
71 model: deviceInfo.model
73 console.log("Error populating model " + msg)
74 showError(qsTr("Failed to load captures"))
88 anchors.bottom: parent.bottom
89 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
90 anchors.left: parent.left
91 anchors.leftMargin: 20
93 // TODO: hide back button
94 property bool show: deleteDialog.status == DialogStatus.Open ||
95 deleteDialog.status == DialogStatus.Opening ||
96 hideTimer.running || menu.status == DialogStatus.Open ||
97 menu.status == DialogStatus.Opening ||
98 (view.currentItem && view.currentItem.error) && !view.currentItem.playing
101 // onClicked: pageStack.pop()
103 Behavior on anchors.bottomMargin {
104 PropertyAnimation { duration: 200; }
109 iconId: !available ? "icon-m-toolbar-favorite-mark-dimmed-white" : view.currentItem.itemData.favorite ? "icon-m-toolbar-favorite-mark-white" : "icon-m-toolbar-favorite-unmark-white"
111 addOrRemoveFavorite()
116 iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"
123 iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"
130 iconId: "icon-m-toolbar-view-menu-white"
141 titleText: qsTr("Delete item?");
142 acceptButtonText: qsTr("Yes");
143 rejectButtonText: qsTr("No");
145 onStatusChanged: restartTimer()
148 if (!remove.remove(view.currentItem.itemData.url)) {
149 showError(qsTr("Failed to delete item"))
151 postCaptureModel.remove(view.currentItem.itemData);
162 onStatusChanged: restartTimer()
166 text: qsTr("Captures in gallery")
167 onClicked: launchGallery()
171 text: qsTr("View in gallery")
173 onClicked: showInGallery()
179 opacity: toolBar.opacity
180 anchors.top: parent.top
181 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
182 anchors.left: parent.left
183 anchors.leftMargin: 20
184 anchors.right: parent.right
185 anchors.rightMargin: 20
186 visible: toolBar.visible
187 height: screen.isPortrait ? toolBar.height * 2 : toolBar.height
189 border.color: toolBar.border.color
190 radius: toolBar.radius
192 Behavior on anchors.topMargin {
193 PropertyAnimation { duration: 200; }
197 width: parent.width - 40
199 height: parent.height
202 text: view.currentItem ? view.currentItem.itemData.title : ""
203 width: parent.width / 2
204 height: parent.height
206 verticalAlignment: Text.AlignVCenter
207 horizontalAlignment: Text.AlignLeft
211 text: view.currentItem ? view.currentItem.itemData.created : ""
212 width: parent.width / 2
213 height: parent.height
215 verticalAlignment: Text.AlignVCenter
216 horizontalAlignment: Text.AlignRight
221 function launchGallery() {
222 if (!gallery.launch()) {
223 showError(qsTr("Failed to launch gallery"))
227 function showInGallery() {
232 if (!gallery.show(view.currentItem.itemUrl)) {
233 showError(qsTr("Failed to launch gallery"))
237 function deleteCurrentItem() {
242 deleteDialog.message = view.currentItem.itemData.fileName
246 function shareCurrentItem() {
251 if (!share.share(view.currentItem.itemData.url)) {
252 showError(qsTr("Failed to launch share service"))
256 function addOrRemoveFavorite() {
261 if (view.currentItem.itemData.favorite) {
262 if (!trackerStore.removeFromFavorites(view.currentItem.itemData.url)) {
263 showError(qsTr("Failed to remove favorite"))
265 view.currentItem.itemData.favorite = false
268 if (!trackerStore.addToFavorites(view.currentItem.itemData.url)) {
269 showError(qsTr("Failed to add favorite"))
271 view.currentItem.itemData.favorite = true
276 function restartTimer() {