Use a Component for initializing VideoSettingsDialog in order to decrease startup...
[harmattan/cameraplus] / qml / CameraPage.qml
index 24ba5e1..43da9c4 100644 (file)
@@ -24,45 +24,44 @@ import QtQuick 1.1
 import com.nokia.meego 1.1
 import QtCamera 1.0
 import CameraPlus 1.0
-import QtMobility.systeminfo 1.2
 
 Page {
         id: page
 
-        property alias standbyWidget: standby
-
-        property bool needsPipeline: true
         property int policyMode: CameraResources.None
 
         property Camera cam: null
+        property Item dimmer: null
+
         property bool controlsVisible: cam.running && !standby.visible
         property bool zoomVisible: true
         property bool modesVisible: true
         property bool standbyVisible: true
-
-        anchors.fill: parent
+        property bool focusReticleVisible: true
+        property bool enableViewfinder: true
 
         property alias previewAnimationRunning: preview.animationRunning
 
         signal batteryLow
 
-        function updatePolicy() {
-                if (needsPipeline && Qt.application.active && status == PageStatus.Active) {
-                        pipelineManager.reset();
-                }
+        function cameraError() {
+                // Nothing
+        }
+
+        function policyLost() {
+                // Nothing
         }
 
-        Rectangle {
-                // TODO: fade out transition
-                // TODO: there is a toolbar visible on the first startup
-                id: standby
-                color: "black"
-                anchors.fill: parent
-                visible: standbyVisible && page.status == PageStatus.Active && pipelineManager.showStandBy
-
-                Image {
-                        source: "image://theme/icon-l-camera-standby"
-                        anchors.centerIn: parent
+        onStatusChanged: {
+                if (status == PageStatus.Activating && enableViewfinder) {
+                        cam.renderingEnabled = true;
+                }
+                else if (status == PageStatus.Active) {
+                        focusReticle.resetReticle();
+
+                        if (!enableViewfinder) {
+                                cam.renderingEnabled = false;
+                        }
                 }
         }
 
@@ -94,36 +93,4 @@ Page {
         function checkDiskSpace() {
                 return fileSystem.hasFreeSpace(fileNaming.path);
         }
-
-        function checkBattery() {
-                // We are fine if we are connected to the charger:
-                if (batteryMonitor.chargingState == BatteryInfo.Charging) {
-                        return true;
-                }
-
-                // If we have enough battery then we are fine:
-                if (batteryMonitor.batteryStatus > BatteryInfo.BatteryCritical) {
-                        return true;
-                }
-
-                return false;
-        }
-
-        BatteryInfo {
-                id: batteryMonitor
-                monitorChargingStateChanges: cam.running
-                monitorBatteryStatusChanges: cam.running
-
-                onChargingStateChanged: {
-                        if (!checkBattery()) {
-                                parent.batteryLow();
-                        }
-                }
-
-                onBatteryStatusChanged:  {
-                        if (!checkBattery()) {
-                                parent.batteryLow();
-                        }
-                }
-        }
 }