/*!
* This file is part of CameraPlus.
*
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
id: page
policyMode: CameraResources.Image
- controlsVisible: capture.visible && cam.running && !standbyWidget.visible
+ controlsVisible: capture.visible
orientationLock: PageOrientation.LockLandscape
- Button {
+ property Item settingsDialog: null
+
+ function cameraError() {
+ mountProtector.unlock();
+ }
+
+ function captureImage() {
+ if (!checkBattery()) {
+ showError(qsTr("Not enough battery to capture images."));
+ return;
+ }
+
+ if (!fileSystem.available) {
+ showError(qsTr("Camera cannot capture images in mass storage mode."));
+ return;
+ }
+
+ if (!checkDiskSpace()) {
+ showError(qsTr("Not enough space to capture images."));
+ return;
+ }
+
+ if (!mountProtector.lock()) {
+ showError(qsTr("Failed to lock images directory."));
+ return;
+ }
+
+ metaData.setMetaData();
+
+ var fileName = fileNaming.imageFileName();
+ if (!imageMode.capture(fileName)) {
+ showError(qsTr("Failed to capture image. Please restart the camera."));
+ return;
+ }
+
+ trackerStore.storeImage(fileName);
+ }
+
+ CaptureButton {
id: capture
anchors.right: parent.right
anchors.rightMargin: 20
width: 75
height: 75
opacity: 0.5
- onClicked: {
- if (!checkBattery()) {
- showError(qsTr("Not enough battery to capture images."));
- return;
- }
+ onClicked: captureImage();
+ visible: imageMode.canCapture && !cameraMode.busy && dimmer.opacity == 0.0 && !previewAnimationRunning && cam.running
- if (!fileSystem.available) {
- showError(qsTr("Camera cannot capture images in mass storage mode."));
- return;
+ onExited: {
+ if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
+ // Release outside the button:
+ cam.autoFocus.stopAutoFocus();
}
+ }
- metaData.setMetaData();
-
- if (!imageMode.capture(fileNaming.imageFileName())) {
- showError(qsTr("Failed to capture image. Please restart the camera."));
+ Timer {
+ interval: 200
+ running: capture.pressed
+ repeat: false
+ onTriggered: {
+ if (cam.autoFocus.cafStatus != AutoFocus.Success) {
+ cam.autoFocus.startAutoFocus();
+ }
}
}
-
- visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
}
ImageMode {
id: imageMode
camera: cam
- onPreviewAvailable: page.setPreview(preview);
- }
-
- FlashButton {
- id: flash
- visible: controlsVisible
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.topMargin: 20
- anchors.leftMargin: 20
- }
-
- ImageSceneButton {
- id: scene
- visible: controlsVisible
- anchors.top: flash.bottom
- anchors.left: parent.left
- anchors.topMargin: 10
- anchors.leftMargin: 20
- }
+ onPreviewAvailable: {
+ page.setPreview(preview);
+ cam.autoFocus.stopAutoFocus();
+ }
- EvCompButton {
- id: evComp
- visible: controlsVisible
- anchors.top: scene.bottom
- anchors.left: parent.left
- anchors.topMargin: 10
- anchors.leftMargin: 20
+ onSaved: mountProtector.unlock();
}
- MouseArea {
+ Rectangle {
id: indicators
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 20
+ anchors.top: parent.top
+ anchors.topMargin: 20
anchors.left: parent.left
anchors.leftMargin: 20
width: 48
height: col.height
- onClicked: openFile("ImageSettingsPage.qml");
+ color: "black"
+ border.color: "gray"
+ radius: 20
+ opacity: 0.5
visible: controlsVisible
- BorderImage {
- id: image
- anchors.fill: parent
- smooth: true
- source: indicators.pressed ? "image://theme/meegotouch-camera-settings-indicators-background-pressed" : "image://theme/meegotouch-camera-settings-indicators-background"
- }
-
Column {
id: col
width: parent.width
Indicator {
id: wbIndicator
- source: "image://theme/" + Data.wbIcon(settings.imageWhiteBalance) + "-screen"
+ source: visible ? "image://theme/" + Data.wbIcon(settings.imageWhiteBalance) + "-screen" : ""
visible: settings.imageWhiteBalance != WhiteBalance.Auto
}
alwaysRunToEnd: true
}
}
+
+ Indicator {
+ id: faceDetectionIndicator
+ visible: settings.faceDetectionEnabled
+ source: "image://theme/icon-m-camera-face-detection-screen"
+ }
+
}
}
onClicked: openFile("PostCapturePage.qml");
visible: controlsVisible
}
+
+ CameraToolBar {
+ id: toolBar
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 20
+ anchors.left: parent.left
+ anchors.leftMargin: 20
+ opacity: 0.5
+ targetWidth: parent.width - (anchors.leftMargin * 2) - (66 * 1.5)
+ visible: controlsVisible
+ expanded: settings.showToolBar
+ onExpandedChanged: settings.showToolBar = expanded;
+
+ items: [
+ FlashButton {
+ onClicked: toolBar.push(items);
+ },
+ ImageSceneButton {
+ onClicked: toolBar.push(items);
+ },
+ ImageEvCompButton {
+ onClicked: toolBar.push(items);
+ },
+ ImageWhiteBalanceButton {
+ onClicked: toolBar.push(items);
+ },
+ ImageColorFilterButton {
+ onClicked: toolBar.push(items);
+ },
+ ImageIsoButton {
+ onClicked: toolBar.push(items);
+ },
+ ToolIcon {
+ iconSource: "image://theme/icon-m-toolbar-view-menu-white"
+ onClicked: openSettings();
+ }
+ ]
+ }
+
+ function openSettings() {
+ var roiEnabled = cam.roi.enabled;
+ cam.roi.enabled = false;
+
+ if (!settingsDialog) {
+ settingsDialog = imageSettingsDialog.createObject(page);
+ }
+
+ settingsDialog.open();
+
+ cam.roi.enabled = roiEnabled;
+ }
+
+ Component {
+ id: imageSettingsDialog
+
+ ImageSettingsDialog { }
+ }
}