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: null
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 :
36 property bool isCurrent: mainView.currentIndex == 2 && !mainView.moving
37 property bool inCameraMode: root.inCaptureMode && !mainView.moving
41 postCaptureModel.reload()
45 onInCameraModeChanged: {
47 postCaptureModel.clear()
52 target: view.currentItem
54 if (view.currentItem.playing) {
55 hideTimer.running = false
62 settings: platformSettings
67 settings: platformSettings
73 snapMode: ListView.SnapOneItem
74 cacheBuffer: height * 3
75 model: postCaptureModel
76 highlightRangeMode: ListView.StrictlyEnforceRange
77 interactive: view.currentItem && view.currentItem.playing ? false : true
79 delegate: PostCaptureItem {
82 onClicked: hideTimer.running = !hideTimer.running
86 if (flicking && hideTimer.running) {
94 imagePath: platformSettings.imagePath
95 videoPath: platformSettings.videoPath
108 anchors.bottom: parent.bottom
109 anchors.bottomMargin: 20
110 anchors.left: parent.left
111 anchors.leftMargin: 20
112 anchors.right: parent.right
113 anchors.rightMargin: 20
114 opacity: show ? 0.8 : 0.0
116 property bool show: deleteDialog.isOpen || deleteDialog.isOpening ||
118 (view.currentItem != null && view.currentItem.error) && !view.currentItem.playing
120 Behavior on opacity {
121 PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
124 tools: CameraToolBarTools {
126 iconSource: cameraTheme.shareIconId
127 enabled: view.currentItem != null
135 iconSource: cameraTheme.deleteIconId
136 enabled: view.currentItem != null
144 iconSource: cameraTheme.galleryIconId
155 titleText: qsTr("Delete item?");
156 acceptButtonText: qsTr("Yes");
157 rejectButtonText: qsTr("No");
159 onStatusChanged: restartTimer()
162 if (!remove.remove(view.currentItem.itemUrl)) {
163 showError(qsTr("Failed to delete item"))
165 view.model.remove(view.currentItem.itemUrl)
175 opacity: toolBar.opacity
176 anchors.top: parent.top
177 anchors.topMargin: 20
178 anchors.left: parent.left
179 anchors.leftMargin: 20
180 anchors.right: parent.right
181 anchors.rightMargin: 20
182 visible: toolBar.visible
183 height: screen.isPortrait ? toolBar.height * 2 : toolBar.height
185 border.color: toolBar.border.color
186 radius: toolBar.radius
189 width: parent.width - 40
191 height: parent.height
194 text: view.currentItem ? view.currentItem.itemTitle : ""
195 width: parent.width / 2
196 height: parent.height
198 verticalAlignment: Text.AlignVCenter
199 horizontalAlignment: Text.AlignLeft
203 text: view.currentItem ? view.currentItem.itemCreated : ""
204 width: parent.width / 2
205 height: parent.height
207 verticalAlignment: Text.AlignVCenter
208 horizontalAlignment: Text.AlignRight
213 function launchGallery() {
214 if (!gallery.launch()) {
215 showError(qsTr("Failed to launch gallery"))
219 function deleteCurrentItem() {
220 if (view.currentItem == null) {
224 deleteDialog.message = view.currentItem.itemFileName
228 function shareCurrentItem() {
229 if (view.currentItem != null && !share.share(view.currentItem.itemUrl)) {
230 showError(qsTr("Failed to launch share service"))
234 function restartTimer() {
238 function policyLost() {
239 if (view.currentItem && view.currentItem.playing) {
240 view.currentItem.stopPlayback()