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
27 // TODO: qrc:/qml/PostCaptureView.qml:104:5: QML CameraToolBar: Binding loop detected for property "height"
32 property Camera camera: null
33 property bool pressed: view.currentItem ? view.currentItem.playing : false
34 property int policyMode: view.currentItem && view.currentItem.playing ?
35 CameraResources.Player : settings.mode == Camera.VideoMode ? CameraResources.Video :
39 target: view.currentItem
41 if (view.currentItem.playing) {
42 hideTimer.running = false
49 settings: platformSettings
54 settings: platformSettings
60 snapMode: ListView.SnapOneItem
61 cacheBuffer: height * 3
62 model: postCaptureModel
63 highlightRangeMode: ListView.StrictlyEnforceRange
64 interactive: view.currentItem && view.currentItem.playing ? false : true
66 delegate: PostCaptureItem {
69 onClicked: hideTimer.running = !hideTimer.running
73 if (flicking && hideTimer.running) {
79 property variant postCaptureModel: postCaptureModelLoader.item ?
80 postCaptureModelLoader.item.model : null
81 property bool loadModel: mainView.currentIndex == 2 && Qt.application.active
84 id: postCaptureModelLoader
85 sourceComponent: loadModel ? postCaptureModelComponent : undefined
88 // We have to do it that way because Loader does not support non-visual elements.
90 id: postCaptureModelComponent
93 property alias model: postCaptureModel
97 imagePath: platformSettings.imagePath
98 videoPath: platformSettings.videoPath
100 Component.onCompleted: reload()
115 anchors.bottom: parent.bottom
116 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
117 anchors.left: parent.left
118 anchors.leftMargin: 20
119 anchors.right: parent.right
120 anchors.rightMargin: 20
123 property bool show: deleteDialog.isOpen || deleteDialog.isOpening ||
125 (view.currentItem != null && view.currentItem.error) && !view.currentItem.playing
127 Behavior on anchors.bottomMargin {
128 PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
131 tools: CameraToolBarTools {
133 iconSource: cameraTheme.shareIconId
141 iconSource: cameraTheme.deleteIconId
149 iconSource: cameraTheme.galleryIconId
160 titleText: qsTr("Delete item?");
161 acceptButtonText: qsTr("Yes");
162 rejectButtonText: qsTr("No");
164 onStatusChanged: restartTimer()
167 if (!remove.remove(view.currentItem.itemUrl)) {
168 showError(qsTr("Failed to delete item"))
170 view.model.remove(view.currentItem.itemUrl)
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: view.currentItem && view.currentItem.playing ? 0 : 200 }
198 width: parent.width - 40
200 height: parent.height
203 text: view.currentItem ? view.currentItem.itemTitle : ""
204 width: parent.width / 2
205 height: parent.height
207 verticalAlignment: Text.AlignVCenter
208 horizontalAlignment: Text.AlignLeft
212 text: view.currentItem ? view.currentItem.itemCreated : ""
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 deleteCurrentItem() {
229 if (view.currentItem == null) {
233 deleteDialog.message = view.currentItem.itemFileName
237 function shareCurrentItem() {
238 if (view.currentItem != null && !share.share(view.currentItem.itemUrl)) {
239 showError(qsTr("Failed to launch share service"))
243 function restartTimer() {
247 function policyLost() {
248 if (view.currentItem && view.currentItem.playing) {
249 view.currentItem.stopPlayback()