Implemented capturing via proximity sensor
[harmattan/cameraplus] / qml / VideoOverlay.qml
index c255a29..164ebae 100644 (file)
@@ -66,12 +66,20 @@ Item {
 
     ZoomCaptureButton {
         id: zoomCapture
-        onReleased: overlay.toggleRecording()
     }
 
-    ZoomCaptureCancel {
+    CaptureControl {
+        id: captureControl
+        capturePressed: capture.pressed
+        zoomPressed: zoomCapture.zoomPressed
+        proximityClosed: proximitySensor.close
+        onStartCapture: overlay.toggleRecording()
+    }
+
+    CaptureCancel {
         anchors.fill: parent
-        zoomCapture: zoomCapture
+        enabled: captureControl.showCancelBanner
+        onPressed: captureControl.canceled = true
     }
 
     CaptureButton {
@@ -84,9 +92,14 @@ Item {
         height: 75
         opacity: 0.5
 
-        onClicked: overlay.toggleRecording()
+        visible: controlsVisible
 
-        visible: controlsVisible && (!settings.zoomAsShutter && keys.active)
+        onExited: {
+            if (mouseX <= 0 || mouseY <= 0 || mouseX > width || mouseY > height) {
+                // Release outside the button:
+                captureControl.canceled = true
+            }
+        }
     }
 
     CameraToolBar {
@@ -150,9 +163,8 @@ Item {
 
             Indicator {
                 id: resolutionIndicator
-                property string videoResolution: settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
-                property string videoRatio: settings.device == 1 ? settings.secondaryVideoAspectRatio : settings.primaryVideoAspectRatio
-                source: cameraTheme.videoIcon(videoRatio, videoResolution, settings.device)
+                source: cameraTheme.videoIcon(settings.videoAspectRatio,
+                    settings.videoResolution, settings.device)
             }
 
             Indicator {
@@ -230,6 +242,12 @@ Item {
         duration: recordingDuration.duration
     }
 
+    function resetToolBar() {
+        if (toolBar.depth() > 1) {
+            toolBar.pop()
+        }
+    }
+
     function doStartRecording() {
         if (!overlay.recording) {
             return
@@ -268,9 +286,7 @@ Item {
 
         trackerStore.storeVideo(file);
 
-        if (toolBar.depth() > 1) {
-            toolBar.pop()
-        }
+        resetToolBar()
     }
 
     function startRecording() {
@@ -320,4 +336,7 @@ Item {
         }
     }
 
+    function cameraDeviceChanged() {
+        resetToolBar()
+    }
 }