Prevent changing any camera properties while device change is in progress
[harmattan/cameraplus] / qml / ImageOverlay.qml
index 415a0c3..77fb6b5 100644 (file)
@@ -128,6 +128,7 @@ Item {
         tools: CameraToolBarTools {
             FlashButton {
                 onClicked: toolBar.push(tools)
+                visible: !overlay.cam.quirks.hasQuirk(Quirks.NoFlash)
             }
 
             ImageSceneButton {
@@ -173,7 +174,7 @@ Item {
 
             Indicator {
                 id: flashIndicator
-                visible: !toolBar.expanded
+                visible: !toolBar.expanded && !overlay.cam.quirks.hasQuirk(Quirks.NoFlash)
                 source: cameraTheme.flashIcon(settings.imageFlashMode)
             }
 
@@ -184,8 +185,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 +283,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()
+    }
 }