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
26 import QtMobility.location 1.2
28 // TODO: flash not ready (battery low or flash not ready message)
37 camera: viewfinder.camera
39 height: mainView.height
45 height: mainView.height
49 camera: viewfinder.camera
51 height: mainView.height
57 LayoutMirroring.enabled: false
59 orientation: ListView.Horizontal
61 snapMode: ListView.SnapOneItem
62 highlightRangeMode: ListView.StrictlyEnforceRange
63 boundsBehavior: Flickable.StopAtBounds
65 interactive: !currentItem.pressed
68 Component.onCompleted: {
69 platformSettings.init()
70 // TODO: hardcoding device id
71 root.resetCamera(0, settings.mode)
84 camera: viewfinder.camera
85 currentItem: mainView.currentItem
88 function resetCamera(deviceId, mode) {
89 if (!viewfinder.camera.reset(deviceId, mode)) {
90 showError(qsTr("Failed to set camera device and mode. Please restart the application."))
94 function showError(msg) {
99 property alias dimmer: camDimmer
102 // NOTE: The source will not reset the position when we lose the signal.
103 // This shouldn't be a big problem as we are course enough.
104 // If we ever need street level updates then this will be an issue.
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.position.coordinate.longitude
122 longitudeValid: positionSource.position.longitudeValid && settings.useGps
123 latitude: positionSource.position.coordinate.latitude
124 latitudeValid: positionSource.position.latitudeValid && settings.useGps
125 elevation: positionSource.position.coordinate.altitude
126 elevationValid: positionSource.position.altitudeValid && settings.useGps
127 orientation: orientation.orientation
128 artist: settings.creatorName
129 captureDirection: compass.direction
130 captureDirectionValid: compass.directionValid
131 horizontalError: positionSource.position.horizontalAccuracy
132 horizontalErrorValid: positionSource.position.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)