Fixed VideoPlayerPage.qml failure to set cameraConfig
[harmattan/cameraplus] / qml / main.qml
index e3dce6c..748ff83 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-@IMPORT_QT_QUICK@
-import com.nokia.meego 1.1
-import com.nokia.extras 1.1
+import QtQuick 2.0
 import QtCamera 1.0
 import CameraPlus 1.0
 import QtMobility.location 1.2
 
 // TODO: flash not ready (battery low or flash not ready message)
 
-Window {
+CameraWindow {
     id: root
-    property alias camera: cam
 
     VisualItemModel {
         id: mainModel
 
         SettingsView {
+            camera: viewfinder.camera
             width: mainView.width
             height: mainView.height
         }
 
         CameraView {
-            id: cam
+            id: viewfinder
             width: mainView.width
             height: mainView.height
         }
 
         PostCaptureView {
+            camera: viewfinder.camera
             width: mainView.width
             height: mainView.height
         }
@@ -67,8 +66,6 @@ Window {
     }
 
     Component.onCompleted: {
-        screen.setAllowedOrientations(Screen.Landscape)
-        theme.inverted = true
         platformSettings.init()        
         // TODO: hardcoding device id
         root.resetCamera(0, settings.mode)
@@ -84,12 +81,12 @@ Window {
 
     PipelineManager {
         id: pipelineManager
-        camera: cam
+        camera: viewfinder.camera
         currentItem: mainView.currentItem
     }
 
     function resetCamera(deviceId, mode) {
-        if (!cam.reset(deviceId, mode)) {
+        if (!viewfinder.camera.reset(deviceId, mode)) {
             showError(qsTr("Failed to set camera device and mode. Please restart the application."))
         }
     }
@@ -101,16 +98,6 @@ Window {
 
     property alias dimmer: camDimmer
 
-    PageStack {
-        id: pageStack
-        anchors.fill: parent
-    }
-
-    MouseArea {
-        anchors.fill: parent
-        enabled: pageStack.busy
-    }
-
     PositionSource {
         // NOTE: The source will not reset the position when we lose the signal.
         // This shouldn't be a big problem as we are course enough.
@@ -125,7 +112,7 @@ Window {
 
     MetaData {
         id: metaData
-        camera: cam
+        camera: viewfinder.camera
         manufacturer: deviceInfo.manufacturer
         model: deviceInfo.model
         country: geocode.country
@@ -148,17 +135,17 @@ Window {
 
     Orientation {
         id: orientation
-        active: cam.running || (mainView.currentIndex == 2 && Qt.application.active)
+        active: viewfinder.camera.running || (mainView.currentIndex == 2 && Qt.application.active)
     }
 
     Compass {
         id: compass
-        active: cam.running
+        active: viewfinder.camera.running
     }
 
     ReverseGeocode {
         id: geocode
-        active: cam.running && settings.useGps && settings.useGeotags
+        active: viewfinder.camera.running && settings.useGps && settings.useGeotags
     }
 
     DeviceInfo {
@@ -169,14 +156,14 @@ Window {
         id: fileSystem
     }
 
-    InfoBanner {
+    CameraInfoBanner {
         id: error
     }
 
     FileNaming {
         id: fileNaming
-        imageSuffix: cam.imageSuffix
-        videoSuffix: cam.videoSuffix
+        imageSuffix: viewfinder.camera.imageSuffix
+        videoSuffix: viewfinder.camera.videoSuffix
     }
 
     MountProtector {
@@ -186,7 +173,7 @@ Window {
 
     TrackerStore {
         id: trackerStore
-        active: cam.running
+        active: viewfinder.camera.running
         manufacturer: deviceInfo.manufacturer
         model: deviceInfo.model
     }
@@ -197,7 +184,8 @@ Window {
 
     ImageSettings {
         id: imageSettings
-        camera: cam
+        camera: viewfinder.camera
+
         function setImageResolution() {
             if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
                 showError(qsTr("Failed to set required resolution"))
@@ -213,7 +201,7 @@ Window {
 
     VideoSettings {
         id: videoSettings
-        camera: cam
+        camera: viewfinder.camera
 
         function setVideoResolution() {
             if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
@@ -246,7 +234,7 @@ Window {
 
     ModeController {
         id: cameraMode
-        cam: cam
+        cam: viewfinder.camera
         dimmer: root.dimmer
     }
 
@@ -271,6 +259,6 @@ Window {
     Standby {
         policyLost: pipelineManager.state == "policyLost"
         show: !Qt.application.active || pipelineManager.showStandBy ||
-            (mainView.currentIndex == 1 && !camera.running)
+            (mainView.currentIndex == 1 && !viewfinder.camera.running)
     }
 }