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
24 import com.nokia.meego 1.1
25 import com.nokia.extras 1.1
28 import QtMobility.location 1.2
30 // TODO: flash not ready (battery low or flash not ready message)
34 property alias camera: cam
41 height: mainView.height
47 height: mainView.height
52 height: mainView.height
58 LayoutMirroring.enabled: false
60 orientation: ListView.Horizontal
62 snapMode: ListView.SnapOneItem
63 highlightRangeMode: ListView.StrictlyEnforceRange
64 boundsBehavior: Flickable.StopAtBounds
66 interactive: !currentItem.pressed
69 Component.onCompleted: {
70 screen.setAllowedOrientations(Screen.Landscape)
72 platformSettings.init()
73 // TODO: hardcoding device id
74 root.resetCamera(0, settings.mode)
88 currentItem: mainView.currentItem
91 function resetCamera(deviceId, mode) {
92 if (!cam.reset(deviceId, mode)) {
93 showError(qsTr("Failed to set camera device and mode. Please restart the application."))
97 function showError(msg) {
102 property alias dimmer: camDimmer
111 enabled: pageStack.busy
115 // NOTE: The source will not reset the position when we lose the signal.
116 // This shouldn't be a big problem as we are course enough.
117 // If we ever need street level updates then this will be an issue.
119 active: settings.useGps
120 // TODO: we cannot bind to cam.running because camera will stop
121 // when the connection dialog pops up and we end up with an infinite loop
122 // active: cam.running && settings.useGps
123 onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude)
129 manufacturer: deviceInfo.manufacturer
130 model: deviceInfo.model
131 country: geocode.country
133 suburb: geocode.suburb
134 longitude: positionSource.position.coordinate.longitude
135 longitudeValid: positionSource.position.longitudeValid && settings.useGps
136 latitude: positionSource.position.coordinate.latitude
137 latitudeValid: positionSource.position.latitudeValid && settings.useGps
138 elevation: positionSource.position.coordinate.altitude
139 elevationValid: positionSource.position.altitudeValid && settings.useGps
140 orientation: orientation.orientation
141 artist: settings.creatorName
142 captureDirection: compass.direction
143 captureDirectionValid: compass.directionValid
144 horizontalError: positionSource.position.horizontalAccuracy
145 horizontalErrorValid: positionSource.position.horizontalAccuracyValid && settings.useGps
146 dateTimeEnabled: true
161 active: cam.running && settings.useGps && settings.useGeotags
178 imageSuffix: cam.imageSuffix
179 videoSuffix: cam.videoSuffix
184 path: fileNaming.path
190 manufacturer: deviceInfo.manufacturer
191 model: deviceInfo.model
194 function checkDiskSpace() {
195 return fileSystem.hasFreeSpace(fileNaming.path)
201 function setImageResolution() {
202 if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
203 showError(qsTr("Failed to set required resolution"))
209 imageSettings.setImageResolution()
218 function setVideoResolution() {
219 if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
220 showError(qsTr("Failed to set required resolution"))
226 videoSettings.setVideoResolution()
234 onImageAspectRatioChanged: {
235 imageSettings.setImageResolution()
238 onImageResolutionChanged: {
239 imageSettings.setImageResolution()
242 onVideoResolutionChanged: {
243 videoSettings.setVideoResolution()
254 property bool dimmed: false
258 opacity: dimmed ? 1.0 : 0.0
260 Behavior on opacity {
261 PropertyAnimation { duration: 150 }
267 active: Qt.application.active && pipelineManager.scaleAcquired
268 repeat: !settings.zoomAsShutter
272 policyLost: pipelineManager.state == "policyLost"
273 show: !Qt.application.active || pipelineManager.showStandBy ||
274 (mainView.currentIndex == 1 && !camera.running)