Add missing capability.cpp
[harmattan/cameraplus] / qml / MainPage.qml
index 0f5c517..811ba31 100644 (file)
@@ -25,7 +25,7 @@ import QtCamera 1.0
 import CameraPlus 1.0
 
 // TODO: flash not ready (battery low or flash not ready message)
-// TODO: front camera
+// TODO: front camera night mode
 
 CameraPage {
     id: root
@@ -197,7 +197,10 @@ CameraPage {
         camera: viewfinder.camera
 
         function setImageResolution() {
-            if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
+            var aspectRatio = settings.device == 1 ? settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
+            var resolution = settings.device == 1 ? settings.secondaryImageResolution : settings.primaryImageResolution
+
+            if (!imageSettings.setResolution(aspectRatio, resolution)) {
                 showError(qsTr("Failed to set required resolution"))
             }
         }
@@ -214,7 +217,10 @@ CameraPage {
         camera: viewfinder.camera
 
         function setVideoResolution() {
-            if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
+            var aspectRatio = settings.device == 1 ? settings.secondaryVideoAspectRatio : settings.primaryVideoAspectRatio
+            var resolution = settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
+
+            if (!videoSettings.setResolution(aspectRatio, resolution)) {
                 showError(qsTr("Failed to set required resolution"))
             }
         }
@@ -229,17 +235,15 @@ CameraPage {
     Connections {
         target: settings
 
-        onImageAspectRatioChanged: {
-            imageSettings.setImageResolution()
-        }
-
-        onImageResolutionChanged: {
-            imageSettings.setImageResolution()
-        }
+        onPrimaryImageResolutionChanged: imageSettings.setImageResolution()
+        onPrimaryImageAspectRatioChanged: imageSettings.setImageResolution()
+        onSecondaryImageResolutionChanged: imageSettings.setImageResolution()
+        onSecondaryImageAspectRatioChanged: imageSettings.setImageResolution()
 
-        onVideoResolutionChanged: {
-            videoSettings.setVideoResolution()
-        }
+        onPrimaryVideoResolutionChanged: videoSettings.setVideoResolution()
+        onPrimaryVideoAspectRatioChanged: videoSettings.setVideoResolution()
+        onSecondaryVideoResolutionChanged: videoSettings.setVideoResolution()
+        onSecondaryVideoAspectRatioChanged: videoSettings.setVideoResolution()
     }
 
     ModeController {