Don't disable all interactions when standby is visible
[harmattan/cameraplus] / qml / MainPage.qml
index fb13033..731b334 100644 (file)
@@ -25,12 +25,12 @@ import QtCamera 1.0
 import CameraPlus 1.0
 
 // TODO: flash not ready (battery low or flash not ready message)
-// TODO: front camera night mode
 
 CameraPage {
     id: root
 
     property bool deviceChangeInProgress: false
+    property bool inCaptureMode: mainView.currentIndex == 1
 
     CameraTheme {
         id: cameraTheme
@@ -99,15 +99,27 @@ CameraPage {
         }
 
         onImageAspectRatioChanged: {
-            imageSettings.setImageResolution()
+            if (!root.deviceChangeInProgress) {
+                imageSettings.setImageResolution()
+            }
         }
 
         onImageResolutionChanged: {
-            imageSettings.setImageResolution()
+            if (!root.deviceChangeInProgress) {
+                imageSettings.setImageResolution()
+            }
         }
 
         onVideoResolutionChanged: {
-            videoSettings.setVideoResolution()
+            if (!root.deviceChangeInProgress) {
+                videoSettings.setVideoResolution()
+            }
+        }
+
+        onVideoAspectRatioChanged: {
+            if (!root.deviceChangeInProgress) {
+                videoSettings.setVideoResolution()
+            }
         }
     }
 
@@ -123,6 +135,13 @@ CameraPage {
             return false
         }
 
+        if (mode == Camera.ImageMode) {
+            imageSettings.setImageResolution()
+        }
+        else if (mode == Camera.VideoMode) {
+            videoSettings.setVideoResolution()
+        }
+
         return true
     }
 
@@ -198,6 +217,7 @@ CameraPage {
         imagePath: platformSettings.imagePath
         videoPath: platformSettings.videoPath
         temporaryVideoPath: platformSettings.temporaryVideoPath
+        settings: settings
     }
 
     MountProtector {
@@ -220,12 +240,6 @@ CameraPage {
                 showError(qsTr("Failed to set required resolution"))
             }
         }
-
-        onReadyChanged: {
-            if (ready) {
-                imageSettings.setImageResolution()
-            }
-        }
     }
 
     VideoSettings {
@@ -237,12 +251,6 @@ CameraPage {
                 showError(qsTr("Failed to set required resolution"))
             }
         }
-
-        onReadyChanged: {
-            if (ready) {
-                videoSettings.setVideoResolution()
-            }
-        }
     }
 
     ModeController {
@@ -265,13 +273,18 @@ CameraPage {
 
     DeviceKeys {
         id: keys
-        active: Qt.application.active && pipelineManager.scaleAcquired
+        active: Qt.application.active && pipelineManager.scaleAcquired && root.inCaptureMode && !mainView.moving
         repeat: !settings.zoomAsShutter
     }
 
+    CameraProximitySensor {
+        id: proximitySensor
+        active: Qt.application.active && viewfinder.camera.running && settings.proximityAsShutter && root.inCaptureMode && !mainView.moving
+    }
+
     Standby {
         policyLost: pipelineManager.state == "policyLost"
         show: !Qt.application.active || pipelineManager.showStandBy ||
-            (mainView.currentIndex == 1 && !viewfinder.camera.running)
+            (inCaptureMode && !viewfinder.camera.running)
     }
 }