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
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
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
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() {