set standby widget z to 2
[harmattan/cameraplus] / qml / RecordingPage.qml
index d4e6d87..6d0edab 100644 (file)
@@ -27,17 +27,29 @@ import CameraPlus 1.0
 import "data.js" as Data
 
 // TODO: on error ?
-// TODO: resources lost?
+// TODO: losing resources in the middle of recording will produce corrupted video
 // TODO: closing camera in the middle of recording will hang camera
+// TODO: optional resources?
+
 CameraPage {
         id: page
         modesVisible: false
 
-        Component.onCompleted: startRecording();
+        function policyLost() {
+                page.stopRecording();
+        }
+
         Component.onDestruction: videoMode.stopRecording();
 
+        onStatusChanged: {
+                if (page.status == PageStatus.Active) {
+                        startRecording();
+                }
+        }
+
         function startRecording() {
-                if (!resourcePolicy.acquired || resourcePolicy.hijacked) {
+                if (!pipelineManager.acquired || pipelineManager.hijacked) {
+                        showError(qsTr("Failed to acquire needed resources."));
                         pageStack.pop(undefined, true);
                         return;
                 }
@@ -58,6 +70,9 @@ CameraPage {
                         pageStack.pop(undefined, true);
                         mountProtector.unlock();
                 }
+
+                // TODO: sometimes this fails (fast stop after start).
+                trackerStore.storeVideo(file);
         }
 
         function stopRecording() {
@@ -67,7 +82,7 @@ CameraPage {
 
         policyMode: CameraResources.Recording
 
-        controlsVisible: cam.running && videoMode.recording && !cameraMode.animationRunning && !previewAnimationRunning && !standbyWidget.visible
+        controlsVisible: cam.running && videoMode.recording && !cameraMode.animationRunning && !previewAnimationRunning
 
         orientationLock: PageOrientation.LockLandscape
 
@@ -82,7 +97,7 @@ CameraPage {
                 }
         }
 
-        Button {
+        CaptureButton {
                 id: recording
                 anchors.right: parent.right
                 anchors.rightMargin: 20