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
42 camera: viewfinder.camera
44 height: mainView.height
50 height: mainView.height
54 camera: viewfinder.camera
56 height: mainView.height
62 LayoutMirroring.enabled: false
64 orientation: ListView.Horizontal
66 snapMode: ListView.SnapOneItem
67 highlightRangeMode: ListView.StrictlyEnforceRange
68 boundsBehavior: Flickable.StopAtBounds
70 interactive: !currentItem.pressed
73 Component.onCompleted: {
74 platformSettings.init()
75 // TODO: hardcoding device id
76 root.resetCamera(0, settings.mode)
89 camera: viewfinder.camera
90 currentItem: mainView.currentItem
93 function resetCamera(deviceId, mode) {
94 if (!viewfinder.camera.reset(deviceId, mode)) {
95 showError(qsTr("Failed to set camera device and mode. Please restart the application."))
99 function showError(msg) {
104 property alias dimmer: camDimmer
105 CameraPositionSource {
107 active: settings.useGps
108 // TODO: we cannot bind to cam.running because camera will stop
109 // when the connection dialog pops up and we end up with an infinite loop
110 // active: cam.running && settings.useGps
111 onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude)
116 camera: viewfinder.camera
117 manufacturer: deviceInfo.manufacturer
118 model: deviceInfo.model
119 country: geocode.country
121 suburb: geocode.suburb
122 longitude: positionSource.longitude
123 longitudeValid: positionSource.longitudeValid && settings.useGps
124 latitude: positionSource.latitude
125 latitudeValid: positionSource.latitudeValid && settings.useGps
126 elevation: positionSource.altitude
127 elevationValid: positionSource.altitudeValid && settings.useGps
128 orientation: orientation.orientation
129 artist: settings.creatorName
130 captureDirection: compass.direction
131 captureDirectionValid: compass.directionValid
132 horizontalError: positionSource.horizontalAccuracy
133 horizontalErrorValid: positionSource.horizontalAccuracyValid && settings.useGps
134 dateTimeEnabled: true
139 active: viewfinder.camera.running || (mainView.currentIndex == 2 && Qt.application.active)
144 active: viewfinder.camera.running
149 active: viewfinder.camera.running && settings.useGps && settings.useGeotags
166 imageSuffix: viewfinder.camera.imageSuffix
167 videoSuffix: viewfinder.camera.videoSuffix
172 path: fileNaming.path
177 active: viewfinder.camera.running
178 manufacturer: deviceInfo.manufacturer
179 model: deviceInfo.model
182 function checkDiskSpace() {
183 return fileSystem.hasFreeSpace(fileNaming.path)
188 camera: viewfinder.camera
190 function setImageResolution() {
191 if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
192 showError(qsTr("Failed to set required resolution"))
198 imageSettings.setImageResolution()
205 camera: viewfinder.camera
207 function setVideoResolution() {
208 if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
209 showError(qsTr("Failed to set required resolution"))
215 videoSettings.setVideoResolution()
223 onImageAspectRatioChanged: {
224 imageSettings.setImageResolution()
227 onImageResolutionChanged: {
228 imageSettings.setImageResolution()
231 onVideoResolutionChanged: {
232 videoSettings.setVideoResolution()
238 cam: viewfinder.camera
243 property bool dimmed: false
247 opacity: dimmed ? 1.0 : 0.0
249 Behavior on opacity {
250 PropertyAnimation { duration: 150 }
256 active: Qt.application.active && pipelineManager.scaleAcquired
257 repeat: !settings.zoomAsShutter
261 policyLost: pipelineManager.state == "policyLost"
262 show: !Qt.application.active || pipelineManager.showStandBy ||
263 (mainView.currentIndex == 1 && !viewfinder.camera.running)