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)
41 camera: viewfinder.camera
43 height: mainView.height
49 height: mainView.height
53 camera: viewfinder.camera
55 height: mainView.height
61 LayoutMirroring.enabled: false
63 orientation: ListView.Horizontal
65 snapMode: ListView.SnapOneItem
66 highlightRangeMode: ListView.StrictlyEnforceRange
67 boundsBehavior: Flickable.StopAtBounds
69 interactive: !currentItem.pressed
72 Component.onCompleted: {
73 platformSettings.init()
74 // TODO: hardcoding device id
75 root.resetCamera(0, settings.mode)
88 camera: viewfinder.camera
89 currentItem: mainView.currentItem
92 function resetCamera(deviceId, mode) {
93 if (!viewfinder.camera.reset(deviceId, mode)) {
94 showError(qsTr("Failed to set camera device and mode. Please restart the application."))
98 function showError(msg) {
103 property alias dimmer: camDimmer
104 CameraPositionSource {
106 active: settings.useGps
107 // TODO: we cannot bind to cam.running because camera will stop
108 // when the connection dialog pops up and we end up with an infinite loop
109 // active: cam.running && settings.useGps
110 onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude)
115 camera: viewfinder.camera
116 manufacturer: deviceInfo.manufacturer
117 model: deviceInfo.model
118 country: geocode.country
120 suburb: geocode.suburb
121 longitude: positionSource.longitude
122 longitudeValid: positionSource.longitudeValid && settings.useGps
123 latitude: positionSource.latitude
124 latitudeValid: positionSource.latitudeValid && settings.useGps
125 elevation: positionSource.altitude
126 elevationValid: positionSource.altitudeValid && settings.useGps
127 orientation: orientation.orientation
128 artist: settings.creatorName
129 captureDirection: compass.direction
130 captureDirectionValid: compass.directionValid
131 horizontalError: positionSource.horizontalAccuracy
132 horizontalErrorValid: positionSource.horizontalAccuracyValid && settings.useGps
133 dateTimeEnabled: true
138 active: viewfinder.camera.running || (mainView.currentIndex == 2 && Qt.application.active)
143 active: viewfinder.camera.running
148 active: viewfinder.camera.running && settings.useGps && settings.useGeotags
165 imageSuffix: viewfinder.camera.imageSuffix
166 videoSuffix: viewfinder.camera.videoSuffix
171 path: fileNaming.path
176 active: viewfinder.camera.running
177 manufacturer: deviceInfo.manufacturer
178 model: deviceInfo.model
181 function checkDiskSpace() {
182 return fileSystem.hasFreeSpace(fileNaming.path)
187 camera: viewfinder.camera
189 function setImageResolution() {
190 if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
191 showError(qsTr("Failed to set required resolution"))
197 imageSettings.setImageResolution()
204 camera: viewfinder.camera
206 function setVideoResolution() {
207 if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
208 showError(qsTr("Failed to set required resolution"))
214 videoSettings.setVideoResolution()
222 onImageAspectRatioChanged: {
223 imageSettings.setImageResolution()
226 onImageResolutionChanged: {
227 imageSettings.setImageResolution()
230 onVideoResolutionChanged: {
231 videoSettings.setVideoResolution()
237 cam: viewfinder.camera
242 property bool dimmed: false
246 opacity: dimmed ? 1.0 : 0.0
248 Behavior on opacity {
249 PropertyAnimation { duration: 150 }
255 active: Qt.application.active && pipelineManager.scaleAcquired
256 repeat: !settings.zoomAsShutter
260 policyLost: pipelineManager.state == "policyLost"
261 show: !Qt.application.active || pipelineManager.showStandBy ||
262 (mainView.currentIndex == 1 && !viewfinder.camera.running)