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
27 import "data.js" as Data
32 policyMode: CameraResources.Image
33 controlsVisible: imageMode.canCapture && !cameraMode.busy && dimmer.opacity == 0.0 && !previewAnimationRunning && cam.running
35 orientationLock: PageOrientation.LockLandscape
37 property Item settingsDialog: null
39 function cameraError() {
40 mountProtector.unlock();
43 function captureImage() {
44 if (!imageMode.canCapture) {
45 showError(qsTr("Camera is already capturing an image."));
49 if (!checkBattery()) {
50 showError(qsTr("Not enough battery to capture images."));
54 if (!fileSystem.available) {
55 showError(qsTr("Camera cannot capture images in mass storage mode."));
59 if (!checkDiskSpace()) {
60 showError(qsTr("Not enough space to capture images."));
64 if (!mountProtector.lock()) {
65 showError(qsTr("Failed to lock images directory."));
69 metaData.setMetaData();
71 var fileName = fileNaming.imageFileName();
72 if (!imageMode.capture(fileName)) {
73 showError(qsTr("Failed to capture image. Please restart the camera."));
77 trackerStore.storeImage(fileName);
82 anchors.right: parent.right
83 anchors.rightMargin: 20
84 anchors.verticalCenter: parent.verticalCenter
85 iconSource: "image://theme/icon-m-camera-shutter"
89 onClicked: captureImage();
90 visible: controlsVisible && (!settings.zoomAsShutter && keys.active)
93 if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
94 // Release outside the button:
95 cam.autoFocus.stopAutoFocus();
103 onReleased: page.captureImage();
109 zoomCapture: zoomCapture
111 if (!autoFocusTimer.running) {
112 cam.autoFocus.stopAutoFocus();
120 running: capture.pressed || zoomCapture.zoomPressed
123 if (cam.autoFocus.cafStatus != AutoFocus.Success) {
124 cam.autoFocus.startAutoFocus();
132 onPreviewAvailable: {
133 page.setPreview(preview);
134 cam.autoFocus.stopAutoFocus();
137 onSaved: mountProtector.unlock();
142 anchors.top: parent.top
143 anchors.topMargin: 20
144 anchors.left: parent.left
145 anchors.leftMargin: 20
152 visible: controlsVisible
160 id: resolutionIndicator
161 source: "image://theme/" + Data.imageIcon(settings.imageAspectRatio, settings.imageResolution);
166 source: visible ? "image://theme/" + Data.wbIcon(settings.imageWhiteBalance) + "-screen" : ""
167 visible: settings.imageWhiteBalance != WhiteBalance.Auto
172 source: "image://theme/" + Data.cfIcon(settings.imageColorFilter) + "-screen"
173 visible: settings.imageColorFilter != ColorTone.Normal
178 visible: settings.imageIso != 0
179 source: "image://theme/" + Data.isoIcon(settings.imageIso);
184 visible: settings.useGps
185 source: "image://theme/icon-m-camera-location"
187 PropertyAnimation on opacity {
188 easing.type: Easing.OutSine
189 loops: Animation.Infinite
193 running: settings.useGps && !positionSource.position.longitudeValid
199 id: faceDetectionIndicator
200 visible: settings.faceDetectionEnabled
201 source: "image://theme/icon-m-camera-face-detection-screen"
209 anchors.top: parent.top
210 anchors.right: parent.right
211 anchors.topMargin: 20
212 anchors.rightMargin: 20
217 iconSource: "image://theme/icon-m-camera-roll"
218 onClicked: openFile("PostCapturePage.qml");
219 visible: controlsVisible
224 anchors.bottom: parent.bottom
225 anchors.bottomMargin: 20
226 anchors.left: parent.left
227 anchors.leftMargin: 20
229 targetWidth: parent.width - (anchors.leftMargin * 2) - (66 * 1.5)
230 visible: controlsVisible
231 expanded: settings.showToolBar
232 onExpandedChanged: settings.showToolBar = expanded;
236 onClicked: toolBar.push(items);
239 onClicked: toolBar.push(items);
242 onClicked: toolBar.push(items);
244 ImageWhiteBalanceButton {
245 onClicked: toolBar.push(items);
247 ImageColorFilterButton {
248 onClicked: toolBar.push(items);
251 onClicked: toolBar.push(items);
254 iconSource: "image://theme/icon-m-toolbar-view-menu-white"
255 onClicked: openSettings();
260 function openSettings() {
261 var roiEnabled = cam.roi.enabled;
262 cam.roi.enabled = false;
264 if (!settingsDialog) {
265 settingsDialog = imageSettingsDialog.createObject(page);
268 settingsDialog.open();
270 cam.roi.enabled = roiEnabled;
274 id: imageSettingsDialog
276 ImageSettingsDialog { }