4 * This file is part of CameraPlus.
6 * Copyright (C) 2012 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.systeminfo 1.2
29 import QtMobility.location 1.2
31 // TODO: resolutions and aspect ratios
33 // TODO: battery low state
35 // TODO: flash not ready
36 // TODO: focus, caf, ...
37 // TODO: portrait/landscape
38 // TODO: record video in a hidden directory and then copy the video to avoid tracker indexing it.
39 // TODO: stop viewfinder in settings pages ?
40 // TODO: prevent going to mass storage while recording and capturing
42 // TODO: grid lines, face tracking, ambr
43 // TODO: complete settings pages
44 // TODO: stop camera properly when we get closed.
45 // TODO: select primary/secondary camera.
46 // TODO: disable debug builds.
47 // TODO: a way to get buffers to the application
48 // TODO: fcam like functionality (precise control over capture parameters).
53 property alias dimmer: camDimmer
57 Component.onCompleted: {
58 theme.inverted = true;
59 if (settings.mode == 0) {
60 openFile("ImagePage.qml");
63 openFile("VideoPage.qml");
67 function showError(msg) {
74 active: settings.useGps
75 // TODO: we cannot bind to cam.running because camera will stop
76 // when the connection dialog pops up and we end up with an infinite loop
77 // active: cam.running && settings.useGps
78 onPositionChanged: geocode.search(position.coordinate.longitude, position.coordinate.latitude);
84 manufacturer: deviceInfo.manufacturer
85 model: deviceInfo.model
86 country: geocode.country
88 suburb: geocode.suburb
89 longitude: positionSource.position.coordinate.longitude
90 longitudeValid: positionSource.position.longitudeValid && settings.useGps
91 latitude: positionSource.position.coordinate.latitude
92 latitudeValid: positionSource.position.latitudeValid && settings.useGps
93 elevation: positionSource.position.coordinate.altitude
94 elevationValid: positionSource.position.altitudeValid && settings.useGps
95 orientation: orientation.orientation
96 artist: settings.creatorName
97 captureDirection: compass.direction
98 captureDirectionValid: compass.directionValid
99 horizontalError: positionSource.position.horizontalAccuracy
100 horizontalErrorValid: positionSource.position.horizontalAccuracyValid && settings.useGps
101 dateTimeEnabled: true
116 active: cam.running && settings.useGps && settings.useGeotags
122 if (resourcePolicy.acquired) {
126 // TODO: We need a way to force a stop.
149 imageSuffix: cam.imageSuffix
150 videoSuffix: cam.videoSuffix
153 function replacePage(file) {
154 pageStack.replace(Qt.resolvedUrl(file), {cam: cam}, true);
157 function openFile(file) {
158 pageStack.push(Qt.resolvedUrl(file), {cam: cam});
161 platformStyle: PageStackWindowStyle {
174 // TODO: is this needed ?
175 if (platformWindow.active) {
184 console.log("Camera error (" + code + "): " + message + " " + debug);
185 showError(qsTr("Camera error. Please restart the application."));
189 // TODO: hardcoding device id
190 Component.onCompleted: { cam.deviceId = 0; mode = settings.mode; }
207 value: ready ? camera.mode == Camera.VideoMode ? settings.videoSceneMode : settings.imageSceneMode : 0
211 id: colorToneController
213 value: ready ? camera.mode == Camera.VideoMode ? settings.videoColorFilter : settings.imageColorFilter : 0
217 id: whiteBalanceController
219 value: ready ? camera.mode == Camera.VideoMode ? settings.videoWhiteBalance : settings.imageWhiteBalance : 0
231 value: ready ? settings.imageIso : 0
237 if (cam.mode == Camera.VideoMode) {
238 replacePage("VideoPage.qml");
241 replacePage("ImagePage.qml");