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
27 import "data.js" as Data
32 policyMode: CameraResources.Image
33 controlsVisible: capture.visible
35 orientationLock: PageOrientation.LockLandscape
37 property Item settingsDialog: null
39 function cameraError() {
40 mountProtector.unlock();
43 function captureImage() {
44 if (!checkBattery()) {
45 showError(qsTr("Not enough battery to capture images."));
49 if (!fileSystem.available) {
50 showError(qsTr("Camera cannot capture images in mass storage mode."));
54 if (!checkDiskSpace()) {
55 showError(qsTr("Not enough space to capture images."));
59 if (!mountProtector.lock()) {
60 showError(qsTr("Failed to lock images directory."));
64 metaData.setMetaData();
66 var fileName = fileNaming.imageFileName();
67 if (!imageMode.capture(fileName)) {
68 showError(qsTr("Failed to capture image. Please restart the camera."));
72 trackerStore.storeImage(fileName);
77 anchors.right: parent.right
78 anchors.rightMargin: 20
79 anchors.verticalCenter: parent.verticalCenter
80 iconSource: "image://theme/icon-m-camera-shutter"
84 onClicked: captureImage();
85 visible: imageMode.canCapture && !cameraMode.busy && dimmer.opacity == 0.0 && !previewAnimationRunning && cam.running
88 if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
89 // Release outside the button:
90 cam.autoFocus.stopAutoFocus();
96 running: capture.pressed
99 if (cam.autoFocus.cafStatus != AutoFocus.Success) {
100 cam.autoFocus.startAutoFocus();
109 onPreviewAvailable: {
110 page.setPreview(preview);
111 cam.autoFocus.stopAutoFocus();
114 onSaved: mountProtector.unlock();
119 anchors.top: parent.top
120 anchors.topMargin: 20
121 anchors.left: parent.left
122 anchors.leftMargin: 20
129 visible: controlsVisible
137 id: resolutionIndicator
138 source: "image://theme/" + Data.imageIcon(settings.imageAspectRatio, settings.imageResolution);
143 source: visible ? "image://theme/" + Data.wbIcon(settings.imageWhiteBalance) + "-screen" : ""
144 visible: settings.imageWhiteBalance != WhiteBalance.Auto
149 source: "image://theme/" + Data.cfIcon(settings.imageColorFilter) + "-screen"
150 visible: settings.imageColorFilter != ColorTone.Normal
155 visible: settings.imageIso != 0
156 source: "image://theme/" + Data.isoIcon(settings.imageIso);
161 visible: settings.useGps
162 source: "image://theme/icon-m-camera-location"
164 PropertyAnimation on opacity {
165 easing.type: Easing.OutSine
166 loops: Animation.Infinite
170 running: settings.useGps && !positionSource.position.longitudeValid
176 id: faceDetectionIndicator
177 visible: settings.faceDetectionEnabled
178 source: "image://theme/icon-m-camera-face-detection-screen"
186 anchors.top: parent.top
187 anchors.right: parent.right
188 anchors.topMargin: 20
189 anchors.rightMargin: 20
194 iconSource: "image://theme/icon-m-camera-roll"
195 onClicked: openFile("PostCapturePage.qml");
196 visible: controlsVisible
201 anchors.bottom: parent.bottom
202 anchors.bottomMargin: 20
203 anchors.left: parent.left
204 anchors.leftMargin: 20
206 targetWidth: parent.width - (anchors.leftMargin * 2) - (66 * 1.5)
207 visible: controlsVisible
208 expanded: settings.showToolBar
209 onExpandedChanged: settings.showToolBar = expanded;
213 onClicked: toolBar.push(items);
216 onClicked: toolBar.push(items);
219 onClicked: toolBar.push(items);
221 ImageWhiteBalanceButton {
222 onClicked: toolBar.push(items);
224 ImageColorFilterButton {
225 onClicked: toolBar.push(items);
228 onClicked: toolBar.push(items);
231 iconSource: "image://theme/icon-m-toolbar-view-menu-white"
232 onClicked: openSettings();
237 function openSettings() {
238 var roiEnabled = cam.roi.enabled;
239 cam.roi.enabled = false;
241 if (!settingsDialog) {
242 settingsDialog = imageSettingsDialog.createObject(page);
245 settingsDialog.open();
247 cam.roi.enabled = roiEnabled;
251 id: imageSettingsDialog
253 ImageSettingsDialog { }