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
30 property Camera camera: viewfinder.camera
31 property bool pressed: view.currentItem ? view.currentItem.playing : false
32 property int policyMode: view.currentItem && view.currentItem.playing ?
33 CameraResources.Player : settings.mode == Camera.VideoMode ? CameraResources.Video :
35 property bool inhibitDim: pressed
37 property bool isCurrent: mainView.currentIndex == 2 && !mainView.moving
38 property bool inCameraMode: root.inCaptureMode && !mainView.moving
42 postCaptureModel.reload()
46 onInCameraModeChanged: {
48 postCaptureModel.clear()
53 target: view.currentItem
55 if (view.currentItem.playing) {
56 hideTimer.running = false
63 settings: platformSettings
68 settings: platformSettings
74 snapMode: ListView.SnapOneItem
75 cacheBuffer: height * 3
76 model: postCaptureModel
77 highlightRangeMode: ListView.StrictlyEnforceRange
78 interactive: view.currentItem && view.currentItem.playing ? false : true
80 delegate: PostCaptureItem {
83 onClicked: hideTimer.running = !hideTimer.running
87 if (flicking && hideTimer.running) {
95 imagePath: platformSettings.imagePath
96 videoPath: platformSettings.videoPath
109 anchors.bottom: parent.bottom
110 anchors.bottomMargin: 20
111 anchors.left: parent.left
112 anchors.leftMargin: 20
113 anchors.right: parent.right
114 anchors.rightMargin: 20
115 opacity: show ? 0.8 : 0.0
117 property bool show: deleteDialog.isOpen || deleteDialog.isOpening ||
119 (view.currentItem != null && view.currentItem.error) && !view.currentItem.playing
121 Behavior on opacity {
122 PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
125 tools: CameraToolBarTools {
127 iconSource: cameraTheme.shareIconId
128 enabled: view.currentItem != null
136 iconSource: cameraTheme.deleteIconId
137 enabled: view.currentItem != null
145 iconSource: cameraTheme.galleryIconId
156 titleText: qsTr("Delete item?");
157 acceptButtonText: qsTr("Yes");
158 rejectButtonText: qsTr("No");
160 onStatusChanged: restartTimer()
163 if (!remove.remove(view.currentItem.itemUrl)) {
164 showError(qsTr("Failed to delete item"))
166 view.model.remove(view.currentItem.itemUrl)
176 opacity: toolBar.opacity
177 anchors.top: parent.top
178 anchors.topMargin: 20
179 anchors.left: parent.left
180 anchors.leftMargin: 20
181 anchors.right: parent.right
182 anchors.rightMargin: 20
183 visible: toolBar.visible
184 height: screen.isPortrait ? toolBar.height * 2 : toolBar.height
186 border.color: toolBar.border.color
187 radius: toolBar.radius
190 width: parent.width - 40
192 height: parent.height
195 text: view.currentItem ? view.currentItem.itemTitle : ""
196 width: parent.width / 2
197 height: parent.height
199 verticalAlignment: Text.AlignVCenter
200 horizontalAlignment: Text.AlignLeft
204 text: view.currentItem ? view.currentItem.itemCreated : ""
205 width: parent.width / 2
206 height: parent.height
208 verticalAlignment: Text.AlignVCenter
209 horizontalAlignment: Text.AlignRight
214 function launchGallery() {
215 if (!gallery.launch()) {
216 showError(qsTr("Failed to launch gallery"))
220 function deleteCurrentItem() {
221 if (view.currentItem == null) {
225 deleteDialog.message = view.currentItem.itemFileName
229 function shareCurrentItem() {
230 if (view.currentItem != null && !share.share(view.currentItem.itemUrl)) {
231 showError(qsTr("Failed to launch share service"))
235 function restartTimer() {
239 function policyLost() {
240 if (view.currentItem && view.currentItem.playing) {
241 view.currentItem.stopPlayback()