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
35 // property bool cameraVisible: mainView.currentIndex == 1
42 height: mainView.height
48 height: mainView.height
53 height: mainView.height
59 LayoutMirroring.enabled: false
61 orientation: ListView.Horizontal
63 snapMode: ListView.SnapOneItem
64 highlightRangeMode: ListView.StrictlyEnforceRange
65 boundsBehavior: Flickable.StopAtBounds
67 interactive: !currentItem.pressed
70 Component.onCompleted: {
71 screen.setAllowedOrientations(Screen.Landscape)
73 platformSettings.init()
74 // TODO: hardcoding device id
75 root.resetCamera(0, settings.mode)
89 currentItem: mainView.currentItem
92 function resetCamera(deviceId, mode) {
93 if (!cam.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
112 enabled: pageStack.busy
116 // NOTE: The source will not reset the position when we lose the signal.
117 // This shouldn't be a big problem as we are course enough.
118 // If we ever need street level updates then this will be an issue.
120 active: settings.useGps
121 // TODO: we cannot bind to cam.running because camera will stop
122 // when the connection dialog pops up and we end up with an infinite loop
123 // active: cam.running && settings.useGps
124 onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude)
130 manufacturer: deviceInfo.manufacturer
131 model: deviceInfo.model
132 country: geocode.country
134 suburb: geocode.suburb
135 longitude: positionSource.position.coordinate.longitude
136 longitudeValid: positionSource.position.longitudeValid && settings.useGps
137 latitude: positionSource.position.coordinate.latitude
138 latitudeValid: positionSource.position.latitudeValid && settings.useGps
139 elevation: positionSource.position.coordinate.altitude
140 elevationValid: positionSource.position.altitudeValid && settings.useGps
141 orientation: orientation.orientation
142 artist: settings.creatorName
143 captureDirection: compass.direction
144 captureDirectionValid: compass.directionValid
145 horizontalError: positionSource.position.horizontalAccuracy
146 horizontalErrorValid: positionSource.position.horizontalAccuracyValid && settings.useGps
147 dateTimeEnabled: true
162 active: cam.running && settings.useGps && settings.useGeotags
179 imageSuffix: cam.imageSuffix
180 videoSuffix: cam.videoSuffix
185 path: fileNaming.path
191 manufacturer: deviceInfo.manufacturer
192 model: deviceInfo.model
195 function checkDiskSpace() {
196 return fileSystem.hasFreeSpace(fileNaming.path)
202 function setImageResolution() {
203 if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
204 showError(qsTr("Failed to set required resolution"))
210 imageSettings.setImageResolution()
219 function setVideoResolution() {
220 if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
221 showError(qsTr("Failed to set required resolution"))
227 videoSettings.setVideoResolution()
235 onImageAspectRatioChanged: {
236 imageSettings.setImageResolution()
239 onImageResolutionChanged: {
240 imageSettings.setImageResolution()
243 onVideoResolutionChanged: {
244 videoSettings.setVideoResolution()
255 property bool dimmed: false
259 opacity: dimmed ? 1.0 : 0.0
261 Behavior on opacity {
262 PropertyAnimation { duration: 150 }
268 active: Qt.application.active && pipelineManager.scaleAcquired
269 repeat: !settings.zoomAsShutter
273 // policyLost: pipelineManager.state == "policyLost"
275 // show: !pageStack.currentPage || (pageStack.currentPage.activationData.standbyVisible && pageStack.currentPage.status == PageStatus.Active && pipelineManager.showStandBy)