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: flash not ready (battery low or flash not ready message)
28 // TODO: rotate post capture image
29 // TODO: hide items for CameraToolBar
43 camera: viewfinder.camera
45 height: mainView.height
51 height: mainView.height
55 camera: viewfinder.camera
57 height: mainView.height
63 LayoutMirroring.enabled: false
65 orientation: ListView.Horizontal
67 snapMode: ListView.SnapOneItem
68 highlightRangeMode: ListView.StrictlyEnforceRange
69 boundsBehavior: Flickable.StopAtBounds
71 interactive: !currentItem.pressed
74 Component.onCompleted: {
75 platformSettings.init()
76 // TODO: hardcoding device id
77 root.resetCamera(0, settings.mode)
90 camera: viewfinder.camera
91 currentItem: mainView.currentItem
94 function resetCamera(deviceId, mode) {
95 if (!viewfinder.camera.reset(deviceId, mode)) {
96 showError(qsTr("Failed to set camera device and mode. Please restart the application."))
100 function showError(msg) {
105 property alias dimmer: camDimmer
106 CameraPositionSource {
108 active: settings.useGps
109 // TODO: we cannot bind to cam.running because camera will stop
110 // when the connection dialog pops up and we end up with an infinite loop
111 // active: cam.running && settings.useGps
112 onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude)
117 camera: viewfinder.camera
118 manufacturer: deviceInfo.manufacturer
119 model: deviceInfo.model
120 country: geocode.country
122 suburb: geocode.suburb
123 longitude: positionSource.longitude
124 longitudeValid: positionSource.longitudeValid && settings.useGps
125 latitude: positionSource.latitude
126 latitudeValid: positionSource.latitudeValid && settings.useGps
127 elevation: positionSource.altitude
128 elevationValid: positionSource.altitudeValid && settings.useGps
129 orientation: orientation.orientation
130 artist: settings.creatorName
131 captureDirection: compass.direction
132 captureDirectionValid: compass.directionValid
133 horizontalError: positionSource.horizontalAccuracy
134 horizontalErrorValid: positionSource.horizontalAccuracyValid && settings.useGps
135 dateTimeEnabled: true
140 active: viewfinder.camera.running || (mainView.currentIndex == 2 && Qt.application.active)
145 active: viewfinder.camera.running
150 active: viewfinder.camera.running && settings.useGps && settings.useGeotags
167 imageSuffix: viewfinder.camera.imageSuffix
168 videoSuffix: viewfinder.camera.videoSuffix
173 path: fileNaming.path
178 active: viewfinder.camera.running
179 manufacturer: deviceInfo.manufacturer
180 model: deviceInfo.model
183 function checkDiskSpace() {
184 return fileSystem.hasFreeSpace(fileNaming.path)
189 camera: viewfinder.camera
191 function setImageResolution() {
192 if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
193 showError(qsTr("Failed to set required resolution"))
199 imageSettings.setImageResolution()
206 camera: viewfinder.camera
208 function setVideoResolution() {
209 if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
210 showError(qsTr("Failed to set required resolution"))
216 videoSettings.setVideoResolution()
224 onImageAspectRatioChanged: {
225 imageSettings.setImageResolution()
228 onImageResolutionChanged: {
229 imageSettings.setImageResolution()
232 onVideoResolutionChanged: {
233 videoSettings.setVideoResolution()
239 cam: viewfinder.camera
244 property bool dimmed: false
248 opacity: dimmed ? 1.0 : 0.0
250 Behavior on opacity {
251 PropertyAnimation { duration: 150 }
257 active: Qt.application.active && pipelineManager.scaleAcquired
258 repeat: !settings.zoomAsShutter
262 policyLost: pipelineManager.state == "policyLost"
263 show: !Qt.application.active || pipelineManager.showStandBy ||
264 (mainView.currentIndex == 1 && !viewfinder.camera.running)