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
50 height: mainView.height
56 LayoutMirroring.enabled: false
58 orientation: ListView.Horizontal
60 snapMode: ListView.SnapOneItem
61 highlightRangeMode: ListView.StrictlyEnforceRange
62 boundsBehavior: Flickable.StopAtBounds
64 interactive: !currentItem.pressed
67 Component.onCompleted: {
68 platformSettings.init()
69 // TODO: hardcoding device id
70 root.resetCamera(0, settings.mode)
83 camera: viewfinder.camera
84 currentItem: mainView.currentItem
87 function resetCamera(deviceId, mode) {
88 if (!viewfinder.camera.reset(deviceId, mode)) {
89 showError(qsTr("Failed to set camera device and mode. Please restart the application."))
93 function showError(msg) {
98 property alias dimmer: camDimmer
101 // NOTE: The source will not reset the position when we lose the signal.
102 // This shouldn't be a big problem as we are course enough.
103 // If we ever need street level updates then this will be an issue.
105 active: settings.useGps
106 // TODO: we cannot bind to cam.running because camera will stop
107 // when the connection dialog pops up and we end up with an infinite loop
108 // active: cam.running && settings.useGps
109 onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude)
114 camera: viewfinder.camera
115 manufacturer: deviceInfo.manufacturer
116 model: deviceInfo.model
117 country: geocode.country
119 suburb: geocode.suburb
120 longitude: positionSource.position.coordinate.longitude
121 longitudeValid: positionSource.position.longitudeValid && settings.useGps
122 latitude: positionSource.position.coordinate.latitude
123 latitudeValid: positionSource.position.latitudeValid && settings.useGps
124 elevation: positionSource.position.coordinate.altitude
125 elevationValid: positionSource.position.altitudeValid && settings.useGps
126 orientation: orientation.orientation
127 artist: settings.creatorName
128 captureDirection: compass.direction
129 captureDirectionValid: compass.directionValid
130 horizontalError: positionSource.position.horizontalAccuracy
131 horizontalErrorValid: positionSource.position.horizontalAccuracyValid && settings.useGps
132 dateTimeEnabled: true
137 active: viewfinder.camera.running || (mainView.currentIndex == 2 && Qt.application.active)
142 active: viewfinder.camera.running
147 active: viewfinder.camera.running && settings.useGps && settings.useGeotags
164 imageSuffix: viewfinder.camera.imageSuffix
165 videoSuffix: viewfinder.camera.videoSuffix
170 path: fileNaming.path
175 active: viewfinder.camera.running
176 manufacturer: deviceInfo.manufacturer
177 model: deviceInfo.model
180 function checkDiskSpace() {
181 return fileSystem.hasFreeSpace(fileNaming.path)
186 camera: viewfinder.camera
188 function setImageResolution() {
189 if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
190 showError(qsTr("Failed to set required resolution"))
196 imageSettings.setImageResolution()
203 camera: viewfinder.camera
205 function setVideoResolution() {
206 if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
207 showError(qsTr("Failed to set required resolution"))
213 videoSettings.setVideoResolution()
221 onImageAspectRatioChanged: {
222 imageSettings.setImageResolution()
225 onImageResolutionChanged: {
226 imageSettings.setImageResolution()
229 onVideoResolutionChanged: {
230 videoSettings.setVideoResolution()
236 cam: viewfinder.camera
241 property bool dimmed: false
245 opacity: dimmed ? 1.0 : 0.0
247 Behavior on opacity {
248 PropertyAnimation { duration: 150 }
254 active: Qt.application.active && pipelineManager.scaleAcquired
255 repeat: !settings.zoomAsShutter
259 policyLost: pipelineManager.state == "policyLost"
260 show: !Qt.application.active || pipelineManager.showStandBy ||
261 (mainView.currentIndex == 1 && !viewfinder.camera.running)