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 ? CameraResources.None :
31 settings.mode == Camera.VideoMode ? CameraResources.Video
32 : CameraResources.Image
33 property bool available: view.currentItem ? view.currentItem.itemData.available : false
35 Component.onCompleted: postCaptureModel.reload()
39 settings: platformSettings
44 settings: platformSettings
50 snapMode: ListView.SnapOneItem
51 cacheBuffer: height * 3
52 model: postCaptureModel
53 highlightRangeMode: ListView.StrictlyEnforceRange
55 delegate: PostCaptureItem {
58 onClicked: hideTimer.running = !hideTimer.running
62 if (flicking && hideTimer.running) {
69 // TODO: this should not be active all the time
71 manufacturer: deviceInfo.manufacturer
72 model: deviceInfo.model
74 console.log("Error populating model " + msg)
75 showError(qsTr("Failed to load captures"))
89 anchors.bottom: parent.bottom
90 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
91 anchors.left: parent.left
92 anchors.leftMargin: 20
94 // TODO: hide back button
95 property bool show: deleteDialog.status == DialogStatus.Open ||
96 deleteDialog.status == DialogStatus.Opening ||
97 hideTimer.running || menu.status == DialogStatus.Open ||
98 menu.status == DialogStatus.Opening ||
99 (view.currentItem && view.currentItem.error) && !view.currentItem.playing
102 // onClicked: pageStack.pop()
104 Behavior on anchors.bottomMargin {
105 PropertyAnimation { duration: 200; }
110 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"
112 addOrRemoveFavorite()
117 iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"
124 iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"
131 iconId: "icon-m-toolbar-view-menu-white"
142 titleText: qsTr("Delete item?");
143 acceptButtonText: qsTr("Yes");
144 rejectButtonText: qsTr("No");
146 onStatusChanged: restartTimer()
149 if (!remove.remove(view.currentItem.itemData.url)) {
150 showError(qsTr("Failed to delete item"))
152 postCaptureModel.remove(view.currentItem.itemData);
163 onStatusChanged: restartTimer()
167 text: qsTr("Captures in gallery")
168 onClicked: launchGallery()
172 text: qsTr("View in gallery")
174 onClicked: showInGallery()
180 opacity: toolBar.opacity
181 anchors.top: parent.top
182 anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
183 anchors.left: parent.left
184 anchors.leftMargin: 20
185 anchors.right: parent.right
186 anchors.rightMargin: 20
187 visible: toolBar.visible
188 height: screen.isPortrait ? toolBar.height * 2 : toolBar.height
190 border.color: toolBar.border.color
191 radius: toolBar.radius
193 Behavior on anchors.topMargin {
194 PropertyAnimation { duration: 200; }
198 width: parent.width - 40
200 height: parent.height
203 text: view.currentItem ? view.currentItem.itemData.title : ""
204 width: parent.width / 2
205 height: parent.height
207 verticalAlignment: Text.AlignVCenter
208 horizontalAlignment: Text.AlignLeft
212 text: view.currentItem ? view.currentItem.itemData.created : ""
213 width: parent.width / 2
214 height: parent.height
216 verticalAlignment: Text.AlignVCenter
217 horizontalAlignment: Text.AlignRight
222 function launchGallery() {
223 if (!gallery.launch()) {
224 showError(qsTr("Failed to launch gallery"))
228 function showInGallery() {
233 if (!gallery.show(view.currentItem.itemUrl)) {
234 showError(qsTr("Failed to launch gallery"))
238 function deleteCurrentItem() {
243 deleteDialog.message = view.currentItem.itemData.fileName
247 function shareCurrentItem() {
252 if (!share.share(view.currentItem.itemData.url)) {
253 showError(qsTr("Failed to launch share service"))
257 function addOrRemoveFavorite() {
262 if (view.currentItem.itemData.favorite) {
263 if (!trackerStore.removeFromFavorites(view.currentItem.itemData.url)) {
264 showError(qsTr("Failed to remove favorite"))
266 view.currentItem.itemData.favorite = false
269 if (!trackerStore.addToFavorites(view.currentItem.itemData.url)) {
270 showError(qsTr("Failed to add favorite"))
272 view.currentItem.itemData.favorite = true
277 function restartTimer() {