Added gallery integration
[harmattan/cameraplus] / qml / main.qml
index 127c36d..421d06f 100644 (file)
@@ -29,16 +29,13 @@ import QtMobility.systeminfo 1.2
 import QtMobility.location 1.2
 
 // TODO: postcapture
-// TODO: flash not ready
-// TODO: touch focus
+// TODO: flash not ready (battery low or flash not ready message)
 // TODO: portrait/landscape
-// TODO: stop viewfinder in settings pages ?
-// TODO: grid lines, face tracking, ambr
+// TODO: grid lines, face tracking
 // TODO: select primary/secondary camera.
 // TODO: disable debug builds.
 // TODO: a way to get buffers to the application
 // TODO: fcam like functionality (precise control over capture parameters).
-// TODO: mute video sound
 
 PageStackWindow {
         id: root
@@ -160,8 +157,8 @@ PageStackWindow {
 
         platformStyle: PageStackWindowStyle {
                 cornersVisible: false
-                // TODO: Hack
-                background: " "
+                background: ""
+                backgroundColor: "transparent"
         }
 
         ImageSettings {
@@ -214,6 +211,17 @@ PageStackWindow {
         }
 
         Camera {
+                id: cam
+                anchors.fill: parent
+
+                FocusReticle {
+                        id: focusReticle
+                        cam: cam
+                        visible: pageStack.currentPage && pageStack.currentPage.controlsVisible && pageStack.currentPage.focusReticleVisible && cam && cam.autoFocus.canFocus(cam.scene.value);
+                        cafStatus: cam ? cam.autoFocus.cafStatus : -1
+                        status: cam ? cam.autoFocus.status : -1
+                }
+
 /*
                 onDeviceIdChanged: {
                         // TODO: is this needed ?
@@ -222,14 +230,22 @@ PageStackWindow {
                         }
                 }
 */
-                id: cam
-                anchors.fill: parent
-
                 onError: {
+                        if (pipelineManager.error) {
+                                // Ignore any subsequent errors.
+                                // Killing pulseaudio while recording will lead to an
+                                // infinite supply of errors which will break the UI
+                                // if we show a banner for each.
+                                return;
+                        }
+
+                        pipelineManager.error = true;
+                        pageStack.currentPage.cameraError();
                         console.log("Camera error (" + code + "): " + message + " " + debug);
                         showError(qsTr("Camera error. Please restart the application."));
-                        cam.stop();
-                        mountProtector.unlock();
+
+                        // We cannot stop camera here. Seems there is a race condition somewhere
+                        // which leads to a freeze if we do so.
                 }
 
                 onRunningChanged: {
@@ -240,7 +256,7 @@ PageStackWindow {
 
                 Component.onDestruction: cam.stop();
 
-                // TODO: Hack
+                // We need to show viewfinder below pages.
                 z: -1
 
                 Rectangle {
@@ -356,6 +372,12 @@ PageStackWindow {
                 value: cam.iso.value
         }
 
+        Binding {
+                target: cam.videoMute
+                property: "enabled"
+                value: settings.videoMuted
+        }
+
         TrackerStore {
                 id: trackerStore
                 active: cam.running
@@ -380,4 +402,9 @@ PageStackWindow {
                         }
                 }
         }
+
+        Standby {
+                policyLost: pipelineManager.state == "policyLost"
+                show: !pageStack.currentPage || (pageStack.currentPage.standbyVisible && pageStack.currentPage.status == PageStatus.Active && pipelineManager.showStandBy)
+        }
 }