Rename ZoomCaptureCancel.qml to CaptureCancel.qml
[harmattan/cameraplus] / qml / ImageOverlay.qml
index 415a0c3..1a73e78 100644 (file)
@@ -104,10 +104,11 @@ Item {
         onReleased: parent.captureImage()
     }
 
-    ZoomCaptureCancel {
+    CaptureCancel {
         anchors.fill: parent
-        zoomCapture: zoomCapture
-        onCanceled: {
+        enabled: zoomCapture.zoomPressed
+        onPressed: {
+            zoomCapture.zoomPressed = false
             if (!autoFocusTimer.running) {
                 stopAutoFocus()
             }
@@ -128,6 +129,7 @@ Item {
         tools: CameraToolBarTools {
             FlashButton {
                 onClicked: toolBar.push(tools)
+                visible: !overlay.cam.quirks.hasQuirk(Quirks.NoFlash)
             }
 
             ImageSceneButton {
@@ -173,7 +175,7 @@ Item {
 
             Indicator {
                 id: flashIndicator
-                visible: !toolBar.expanded
+                visible: !toolBar.expanded && !overlay.cam.quirks.hasQuirk(Quirks.NoFlash)
                 source: cameraTheme.flashIcon(settings.imageFlashMode)
             }
 
@@ -184,8 +186,7 @@ Item {
                 anchors.rightMargin: 5
                 anchors.topMargin: 5
                 anchors.bottomMargin: 5
-                property string mp: imageSettings.currentResolutionMegapixel == "" ? "?" : imageSettings.currentResolutionMegapixel
-                text: qsTr("%1M").arg(mp)
+                text: imageSettings.currentResolution ? qsTr("%1M").arg(imageSettings.currentResolution.megaPixels) : qsTr("?M")
                 font.bold: true
                 verticalAlignment: Text.AlignVCenter
                 horizontalAlignment: Text.AlignHCenter
@@ -283,15 +284,24 @@ Item {
     }
 
     function startAutoFocus() {
-        if (cam.device == 0) {
+        if (!overlay.cam.quirks.hasQuirk(Quirks.NoAutoFocus)) {
             cam.autoFocus.startAutoFocus()
         }
     }
 
     function stopAutoFocus() {
-        if (cam.device == 0) {
+        if (!overlay.cam.quirks.hasQuirk(Quirks.NoAutoFocus)) {
             cam.autoFocus.stopAutoFocus()
         }
     }
 
+    function resetToolBar() {
+        if (toolBar.depth() > 1) {
+            toolBar.pop()
+        }
+    }
+
+    function cameraDeviceChanged() {
+        resetToolBar()
+    }
 }