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
28 property bool pressed: view.currentItem ? view.currentItem.playing : false
29 property int policyMode: CameraResources.None
30 property bool available: view.currentItem ? view.currentItem.itemData.available : false
32 Component.onCompleted: postCaptureModel.reload()
36 settings: platformSettings
41 settings: platformSettings
47 snapMode: ListView.SnapOneItem
48 cacheBuffer: height * 3
49 model: postCaptureModel
50 highlightRangeMode: ListView.StrictlyEnforceRange
52 delegate: PostCaptureItem {
55 onClicked: hideTimer.running = !hideTimer.running
59 if (flicking && hideTimer.running) {
66 // TODO: this should not be active all the time
68 manufacturer: deviceInfo.manufacturer
69 model: deviceInfo.model
71 console.log("Error populating model " + msg)
72 showError(qsTr("Failed to load captures"))
86 anchors.bottom: parent.bottom
87 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
88 anchors.left: parent.left
89 anchors.leftMargin: 20
91 // TODO: hide back button
92 property bool show: deleteDialog.status == DialogStatus.Open ||
93 deleteDialog.status == DialogStatus.Opening ||
94 hideTimer.running || menu.status == DialogStatus.Open ||
95 menu.status == DialogStatus.Opening ||
96 (view.currentItem && view.currentItem.error) && !view.currentItem.playing
99 // onClicked: pageStack.pop()
101 Behavior on anchors.bottomMargin {
102 PropertyAnimation { duration: 200; }
107 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"
109 addOrRemoveFavorite()
114 iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"
121 iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"
128 iconId: "icon-m-toolbar-view-menu-white"
139 titleText: qsTr("Delete item?");
140 acceptButtonText: qsTr("Yes");
141 rejectButtonText: qsTr("No");
143 onStatusChanged: restartTimer()
146 if (!remove.remove(view.currentItem.itemData.url)) {
147 showError(qsTr("Failed to delete item"))
149 postCaptureModel.remove(view.currentItem.itemData);
160 onStatusChanged: restartTimer()
164 text: qsTr("Captures in gallery")
165 onClicked: launchGallery()
169 text: qsTr("View in gallery")
171 onClicked: showInGallery()
177 opacity: toolBar.opacity
178 anchors.top: parent.top
179 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
180 anchors.left: parent.left
181 anchors.leftMargin: 20
182 anchors.right: parent.right
183 anchors.rightMargin: 20
184 visible: toolBar.visible
185 height: screen.isPortrait ? toolBar.height * 2 : toolBar.height
187 border.color: toolBar.border.color
188 radius: toolBar.radius
190 Behavior on anchors.topMargin {
191 PropertyAnimation { duration: 200; }
195 width: parent.width - 40
197 height: parent.height
200 text: view.currentItem ? view.currentItem.itemData.title : ""
201 width: parent.width / 2
202 height: parent.height
204 verticalAlignment: Text.AlignVCenter
205 horizontalAlignment: Text.AlignLeft
209 text: view.currentItem ? view.currentItem.itemData.created : ""
210 width: parent.width / 2
211 height: parent.height
213 verticalAlignment: Text.AlignVCenter
214 horizontalAlignment: Text.AlignRight
219 function launchGallery() {
220 if (!gallery.launch()) {
221 showError(qsTr("Failed to launch gallery"))
225 function showInGallery() {
230 if (!gallery.show(view.currentItem.itemUrl)) {
231 showError(qsTr("Failed to launch gallery"))
235 function deleteCurrentItem() {
240 deleteDialog.message = view.currentItem.itemData.fileName
244 function shareCurrentItem() {
249 if (!share.share(view.currentItem.itemData.url)) {
250 showError(qsTr("Failed to launch share service"))
254 function addOrRemoveFavorite() {
259 if (view.currentItem.itemData.favorite) {
260 if (!trackerStore.removeFromFavorites(view.currentItem.itemData.url)) {
261 showError(qsTr("Failed to remove favorite"))
263 view.currentItem.itemData.favorite = false
266 if (!trackerStore.addToFavorites(view.currentItem.itemData.url)) {
267 showError(qsTr("Failed to add favorite"))
269 view.currentItem.itemData.favorite = true
274 function restartTimer() {