pop toolbar if we start recording and its depth is greater than 1
[harmattan/cameraplus] / qml / VideoOverlay.qml
index 1eedaf8..d1df5bd 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-import QtQuick 1.1
-import com.nokia.meego 1.1
+import QtQuick 2.0
 import QtCamera 1.0
 import CameraPlus 1.0
-import "data.js" as Data
 
 Item {
     id: overlay
@@ -33,9 +31,8 @@ Item {
     property Camera cam
     property bool animationRunning: false
     property int policyMode: recording == true ? CameraResources.Recording : CameraResources.Video
-    property bool controlsVisible: !animationRunning && cam.running && dimmer.opacity == 0.0
-        && !cameraMode.busy
-// TODO:
+    property bool controlsVisible: !animationRunning && cam != null && cam.running
+        && dimmer.opacity == 0.0 && !cameraMode.busy
     property bool pressed: overlay.recording || capture.pressed ||
         zoomSlider.pressed || modeButton.pressed
 
@@ -82,7 +79,7 @@ Item {
         anchors.right: parent.right
         anchors.rightMargin: 20
         anchors.verticalCenter: parent.verticalCenter
-        iconSource: overlay.recording ? "image://theme/icon-m-camera-video-record" : "image://theme/icon-m-camera-video-record"
+        iconId: overlay.recording ? cameraTheme.captureButtonRecordingIconId : cameraTheme.captureButtonVideoIconId
         width: 75
         height: 75
         opacity: 0.5
@@ -104,26 +101,31 @@ Item {
         expanded: settings.showToolBar
         onExpandedChanged: settings.showToolBar = expanded;
 
-        items: [
+        tools: CameraToolBarTools {
             VideoTorchButton {
                 camera: cam
-            },
+            }
+
             VideoSceneButton {
-// TODO: hide when recording
-                onClicked: toolBar.push(items)
-            },
+                visible: !overlay.recording
+                onClicked: toolBar.push(tools)
+            }
+
             VideoEvCompButton {
-                onClicked: toolBar.push(items)
-            },
+                onClicked: toolBar.push(tools)
+            }
+
             VideoWhiteBalanceButton {
-                onClicked: toolBar.push(items)
-            },
+                onClicked: toolBar.push(tools)
+            }
+
             VideoColorFilterButton {
-                onClicked: toolBar.push(items)
-            },
+                onClicked: toolBar.push(tools)
+            }
+
             VideoMuteButton {
             }
-        ]
+        }
     }
 
     Rectangle {
@@ -146,25 +148,33 @@ Item {
 
             Indicator {
                 id: resolutionIndicator
-                source: "image://theme/" + Data.videoIcon(settings.videoResolution)
+                property string videoResolution: settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
+                property string videoRatio: settings.device == 1 ? settings.secondaryVideoAspectRatio : settings.primaryVideoAspectRatio
+                source: "image://theme/" + cameraTheme.videoIcon(videoRatio, videoResolution, settings.device)
             }
 
             Indicator {
                 id: wbIndicator
-                source: visible ? "image://theme/" + Data.wbIcon(settings.videoWhiteBalance) + "-screen" : ""
-                visible: settings.videoWhiteBalance != WhiteBalance.Auto
+                source: visible ? "image://theme/" + cameraTheme.whiteBalanceIndicatorIcon(settings.videoWhiteBalance) : ""
+                visible: settings.videoWhiteBalance != WhiteBalance.Auto && !toolBar.expanded
             }
 
             Indicator {
                 id: cfIndicator
-                source: "image://theme/" + Data.cfIcon(settings.videoColorFilter) + "-screen"
-                visible: settings.videoColorFilter != ColorTone.Normal
+                source: visible ? "image://theme/" + cameraTheme.colorFilterIndicatorIcon(settings.videoColorFilter) : ""
+                visible: settings.videoColorFilter != ColorTone.Normal && !toolBar.expanded
+            }
+
+            Indicator {
+                id: sceneIndicator
+                visible: settings.videoSceneMode != Scene.Auto && (!toolBar.expanded || overlay.recording)
+                source: visible ? "image://theme/" + cameraTheme.videoSceneModeIndicatorIcon(settings.videoSceneMode) : ""
             }
 
             Indicator {
                 id: gpsIndicator
                 visible: settings.useGps
-                source: "image://theme/icon-m-camera-location"
+                source: cameraTheme.gpsIndicatorIcon
 
                 PropertyAnimation on opacity  {
                     easing.type: Easing.OutSine
@@ -248,6 +258,10 @@ Item {
         }
 
         trackerStore.storeVideo(file);
+
+        if (toolBar.depth() > 1) {
+            toolBar.pop()
+        }
     }
 
     function startRecording() {