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: view.currentItem && view.currentItem.playing ?
31 CameraResources.Player : settings.mode == Camera.VideoMode ? CameraResources.Video :
33 property bool available: view.currentItem ? view.currentItem.itemData.available : false
37 settings: platformSettings
42 settings: platformSettings
48 snapMode: ListView.SnapOneItem
49 cacheBuffer: height * 3
50 model: postCaptureModel
51 highlightRangeMode: ListView.StrictlyEnforceRange
53 delegate: PostCaptureItem {
56 onClicked: hideTimer.running = !hideTimer.running
60 if (flicking && hideTimer.running) {
66 property variant postCaptureModel: postCaptureModelLoader.item ?
67 postCaptureModelLoader.item.model : null
68 property bool loadModel: mainView.currentIndex == 2 && Qt.application.active
71 id: postCaptureModelLoader
72 sourceComponent: loadModel ? postCaptureModelComponent : undefined
75 // We have to do it that way because Loader does not support non-visual elements.
77 id: postCaptureModelComponent
80 property alias model: postCaptureModel
84 manufacturer: deviceInfo.manufacturer
85 model: deviceInfo.model
86 Component.onCompleted: reload()
88 console.log("Error populating model " + msg)
89 showError(qsTr("Failed to load captures"))
105 anchors.bottom: parent.bottom
106 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
107 anchors.left: parent.left
108 anchors.leftMargin: 20
111 property bool show: deleteDialog.status == DialogStatus.Open ||
112 deleteDialog.status == DialogStatus.Opening ||
113 hideTimer.running || menu.status == DialogStatus.Open ||
114 menu.status == DialogStatus.Opening ||
115 (view.currentItem && view.currentItem.error) && !view.currentItem.playing
117 Behavior on anchors.bottomMargin {
118 PropertyAnimation { duration: 200; }
123 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"
125 addOrRemoveFavorite()
130 iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"
137 iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"
144 iconId: "icon-m-toolbar-view-menu-white"
155 titleText: qsTr("Delete item?");
156 acceptButtonText: qsTr("Yes");
157 rejectButtonText: qsTr("No");
159 onStatusChanged: restartTimer()
162 if (!remove.remove(view.currentItem.itemData.url)) {
163 showError(qsTr("Failed to delete item"))
165 postCaptureModel.remove(view.currentItem.itemData);
176 onStatusChanged: restartTimer()
180 text: qsTr("Captures in gallery")
181 onClicked: launchGallery()
185 text: qsTr("View in gallery")
187 onClicked: showInGallery()
193 opacity: toolBar.opacity
194 anchors.top: parent.top
195 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
196 anchors.left: parent.left
197 anchors.leftMargin: 20
198 anchors.right: parent.right
199 anchors.rightMargin: 20
200 visible: toolBar.visible
201 height: screen.isPortrait ? toolBar.height * 2 : toolBar.height
203 border.color: toolBar.border.color
204 radius: toolBar.radius
206 Behavior on anchors.topMargin {
207 PropertyAnimation { duration: 200; }
211 width: parent.width - 40
213 height: parent.height
216 text: view.currentItem ? view.currentItem.itemData.title : ""
217 width: parent.width / 2
218 height: parent.height
220 verticalAlignment: Text.AlignVCenter
221 horizontalAlignment: Text.AlignLeft
225 text: view.currentItem ? view.currentItem.itemData.created : ""
226 width: parent.width / 2
227 height: parent.height
229 verticalAlignment: Text.AlignVCenter
230 horizontalAlignment: Text.AlignRight
235 function launchGallery() {
236 if (!gallery.launch()) {
237 showError(qsTr("Failed to launch gallery"))
241 function showInGallery() {
246 if (!gallery.show(view.currentItem.itemUrl)) {
247 showError(qsTr("Failed to launch gallery"))
251 function deleteCurrentItem() {
256 deleteDialog.message = view.currentItem.itemData.fileName
260 function shareCurrentItem() {
265 if (!share.share(view.currentItem.itemData.url)) {
266 showError(qsTr("Failed to launch share service"))
270 function addOrRemoveFavorite() {
275 if (view.currentItem.itemData.favorite) {
276 if (!trackerStore.removeFromFavorites(view.currentItem.itemData.url)) {
277 showError(qsTr("Failed to remove favorite"))
279 view.currentItem.itemData.favorite = false
282 if (!trackerStore.addToFavorites(view.currentItem.itemData.url)) {
283 showError(qsTr("Failed to add favorite"))
285 view.currentItem.itemData.favorite = true
290 function restartTimer() {
294 function policyLost() {
295 if (view.currentItem && view.currentItem.playing) {
296 view.currentItem.stopPlayback()