set standby widget z to 2
[harmattan/cameraplus] / qml / ImagePage.qml
index 24c545b..792d2c1 100644 (file)
@@ -30,11 +30,43 @@ CameraPage {
         id: page
 
         policyMode: CameraResources.Image
-        controlsVisible: capture.visible && cam.running && !standbyWidget.visible
+        controlsVisible: capture.visible
 
         orientationLock: PageOrientation.LockLandscape
 
-        Button {
+        function captureImage() {
+                if (!checkBattery()) {
+                        showError(qsTr("Not enough battery to capture images."));
+                        return;
+                }
+
+                if (!checkDiskSpace()) {
+                        showError(qsTr("Not enough space to capture images."));
+                        return;
+                }
+
+                if (!fileSystem.available) {
+                        showError(qsTr("Camera cannot capture images in mass storage mode."));
+                        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
@@ -43,45 +75,36 @@ CameraPage {
                 width: 75
                 height: 75
                 opacity: 0.5
-                onClicked: {
-                        if (!checkBattery()) {
-                                showError(qsTr("Not enough battery to capture images."));
-                                return;
-                        }
-
-                        if (!checkDiskSpace()) {
-                                showError(qsTr("Not enough space to capture images."));
-                                return;
-                        }
-
-                        if (!fileSystem.available) {
-                                showError(qsTr("Camera cannot capture images in mass storage mode."));
-                                return;
-                        }
+                onClicked: captureImage();
+                visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
 
-                        if (!mountProtector.lock()) {
-                                showError(qsTr("Failed to lock images directory."));
-                                return;
+                onExited: {
+                        if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
+                                // Release outside the button:
+                                cam.autoFocus.stopAutoFocus();
                         }
+                }
 
-                        metaData.setMetaData();
-
-                        var fileName = fileNaming.imageFileName();
-                        if (!imageMode.capture(fileName)) {
-                                showError(qsTr("Failed to capture image. Please restart the camera."));
-                                return;
+                Timer {
+                        interval: 200
+                        running: capture.pressed
+                        repeat: false
+                        onTriggered: {
+                                if (cam.autoFocus.cafStatus != AutoFocus.Success) {
+                                        cam.autoFocus.startAutoFocus();
+                                }
                         }
-
-                        trackerStore.storeImage(fileName);
                 }
-
-                visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
         }
 
         ImageMode {
                 id: imageMode
                 camera: cam
-                onPreviewAvailable: page.setPreview(preview);
+                onPreviewAvailable: {
+                        page.setPreview(preview);
+                        cam.autoFocus.stopAutoFocus();
+                }
+
                 onSaved: mountProtector.unlock();
         }
 
@@ -142,7 +165,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
                         }