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 :
38 property bool isCurrent: mainView.currentIndex == 2 && !mainView.moving
39 property bool inCameraMode: root.inCaptureMode && !mainView.moving
43 postCaptureModel.reload()
47 onInCameraModeChanged: {
49 postCaptureModel.clear()
54 target: view.currentItem
56 if (view.currentItem.playing) {
57 hideTimer.running = false
64 settings: platformSettings
69 settings: platformSettings
75 snapMode: ListView.SnapOneItem
76 cacheBuffer: height * 3
77 model: postCaptureModel
78 highlightRangeMode: ListView.StrictlyEnforceRange
79 interactive: view.currentItem && view.currentItem.playing ? false : true
81 delegate: PostCaptureItem {
84 onClicked: hideTimer.running = !hideTimer.running
88 if (flicking && hideTimer.running) {
96 imagePath: platformSettings.imagePath
97 videoPath: platformSettings.videoPath
110 anchors.bottom: parent.bottom
111 anchors.bottomMargin: show ? 20 : -1 * (height + 20)
112 anchors.left: parent.left
113 anchors.leftMargin: 20
114 anchors.right: parent.right
115 anchors.rightMargin: 20
118 property bool show: deleteDialog.isOpen || deleteDialog.isOpening ||
120 (view.currentItem != null && view.currentItem.error) && !view.currentItem.playing
122 Behavior on anchors.bottomMargin {
123 PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
126 tools: CameraToolBarTools {
128 iconSource: cameraTheme.shareIconId
136 iconSource: cameraTheme.deleteIconId
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: toolBar.show ? 20 : -1 * (height + 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
188 Behavior on anchors.topMargin {
189 PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
193 width: parent.width - 40
195 height: parent.height
198 text: view.currentItem ? view.currentItem.itemTitle : ""
199 width: parent.width / 2
200 height: parent.height
202 verticalAlignment: Text.AlignVCenter
203 horizontalAlignment: Text.AlignLeft
207 text: view.currentItem ? view.currentItem.itemCreated : ""
208 width: parent.width / 2
209 height: parent.height
211 verticalAlignment: Text.AlignVCenter
212 horizontalAlignment: Text.AlignRight
217 function launchGallery() {
218 if (!gallery.launch()) {
219 showError(qsTr("Failed to launch gallery"))
223 function deleteCurrentItem() {
224 if (view.currentItem == null) {
228 deleteDialog.message = view.currentItem.itemFileName
232 function shareCurrentItem() {
233 if (view.currentItem != null && !share.share(view.currentItem.itemUrl)) {
234 showError(qsTr("Failed to launch share service"))
238 function restartTimer() {
242 function policyLost() {
243 if (view.currentItem && view.currentItem.playing) {
244 view.currentItem.stopPlayback()