set standby widget z to 2
[harmattan/cameraplus] / qml / ImagePage.qml
index 5830fe2..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,26 +75,37 @@ CameraPage {
                 width: 75
                 height: 75
                 opacity: 0.5
-                onClicked: {
-                        if (!fileSystem.available) {
-                                showError(qsTr("Camera cannot capture images in mass storage mode."));
-                                return;
-                        }
-
-                        metaData.setMetaData();
+                onClicked: captureImage();
+                visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
 
-                        if (!imageMode.capture(fileNaming.imageFileName())) {
-                                showError(qsTr("Failed to capture image. Please restart the camera."));
+                onExited: {
+                        if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
+                                // Release outside the button:
+                                cam.autoFocus.stopAutoFocus();
                         }
                 }
 
-                visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
+                Timer {
+                        interval: 200
+                        running: capture.pressed
+                        repeat: false
+                        onTriggered: {
+                                if (cam.autoFocus.cafStatus != AutoFocus.Success) {
+                                        cam.autoFocus.startAutoFocus();
+                                }
+                        }
+                }
         }
 
         ImageMode {
                 id: imageMode
                 camera: cam
-                onPreviewAvailable: page.setPreview(preview);
+                onPreviewAvailable: {
+                        page.setPreview(preview);
+                        cam.autoFocus.stopAutoFocus();
+                }
+
+                onSaved: mountProtector.unlock();
         }
 
         FlashButton {
@@ -83,7 +126,7 @@ CameraPage {
                 anchors.leftMargin: 20
         }
 
-        EvCompButton {
+        ImageEvCompButton {
                 id: evComp
                 visible: controlsVisible
                 anchors.top: scene.bottom
@@ -122,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
                         }