Added ROI an face detection
[harmattan/cameraplus] / qml / ImagePage.qml
index 3a0eb70..53c012b 100644 (file)
@@ -30,23 +30,27 @@ CameraPage {
         id: page
 
         policyMode: CameraResources.Image
-        controlsVisible: capture.visible && cam.running && !standbyWidget.visible
+        controlsVisible: capture.visible
 
         orientationLock: PageOrientation.LockLandscape
 
+        function cameraError() {
+                mountProtector.unlock();
+        }
+
         function captureImage() {
                 if (!checkBattery()) {
                         showError(qsTr("Not enough battery to capture images."));
                         return;
                 }
 
-                if (!checkDiskSpace()) {
-                        showError(qsTr("Not enough space to capture images."));
+                if (!fileSystem.available) {
+                        showError(qsTr("Camera cannot capture images in mass storage mode."));
                         return;
                 }
 
-                if (!fileSystem.available) {
-                        showError(qsTr("Camera cannot capture images in mass storage mode."));
+                if (!checkDiskSpace()) {
+                        showError(qsTr("Not enough space to capture images."));
                         return;
                 }
 
@@ -76,7 +80,7 @@ CameraPage {
                 height: 75
                 opacity: 0.5
                 onClicked: captureImage();
-                visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
+                visible: imageMode.canCapture && !cameraMode.busy && dimmer.opacity == 0.0 && !previewAnimationRunning && cam.running
 
                 onExited: {
                         if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
@@ -89,62 +93,39 @@ CameraPage {
                         interval: 200
                         running: capture.pressed
                         repeat: false
-                        onTriggered: cam.autoFocus.startAutoFocus();
+                        onTriggered: {
+                                if (cam.autoFocus.cafStatus != AutoFocus.Success) {
+                                        cam.autoFocus.startAutoFocus();
+                                }
+                        }
                 }
         }
 
         ImageMode {
                 id: imageMode
                 camera: cam
-                onPreviewAvailable: { page.setPreview(preview); cam.autoFocus.stopAutoFocus(); }
+                onPreviewAvailable: {
+                        page.setPreview(preview);
+                        cam.autoFocus.stopAutoFocus();
+                }
+
                 onSaved: mountProtector.unlock();
         }
 
-        FlashButton {
-                id: flash
-                visible: controlsVisible
+        Rectangle {
+                id: indicators
                 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
-        }
-
-        ImageEvCompButton {
-                id: evComp
-                visible: controlsVisible
-                anchors.top: scene.bottom
-                anchors.left: parent.left
-                anchors.topMargin: 10
-                anchors.leftMargin: 20
-        }
-
-        MouseArea {
-                id: indicators
-                anchors.bottom: parent.bottom
-                anchors.bottomMargin: 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
@@ -157,7 +138,7 @@ CameraPage {
 
                         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
                         }
 
@@ -188,6 +169,13 @@ CameraPage {
                                         alwaysRunToEnd: true
                                 }
                         }
+
+                        Indicator {
+                                id: faceDetectionIndicator
+                                visible: settings.faceDetectionEnabled
+                                source: "image://theme/icon-m-camera-face-detection-screen"
+                        }
+
                 }
         }
 
@@ -205,4 +193,46 @@ CameraPage {
                 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: imageSettingsDialog.open();
+                }
+                ]
+        }
+
+        ImageSettingsDialog {
+                id: imageSettingsDialog
+        }
 }