Reworked CameraButton to get rid of meego bits
[harmattan/cameraplus] / qml / ImageResolutionSettings.qml
index b968b95..6cb05b1 100644 (file)
@@ -28,11 +28,6 @@ Column {
 
     spacing: 10
 
-    property string __aspectRatio: settings.device == 1 ?
-        settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
-    property string __resolution: settings.device == 1 ?
-        settings.secondaryImageResolution : settings.primaryImageResolution
-
     SectionHeader {
         text: qsTr("Aspect ratio")
         visible: aspectRatioRow.visible
@@ -46,17 +41,13 @@ Column {
         visible: imageSettings.aspectRatioCount > 1
 
         Repeater {
+            id: aspectRatios
             model: imageSettings.aspectRatios
             delegate: CameraButton {
+                width: aspectRatioRow.width / aspectRatios.count
                 text: qsTr(modelData)
-                checked: __aspectRatio == modelData
-                onClicked: {
-                    if (settings.device == 1) {
-                        settings.secondaryImageAspectRatio = modelData
-                    } else {
-                        settings.primaryImageAspectRatio = modelData
-                    }
-                }
+                checked: settings.imageAspectRatio == modelData
+                onClicked: settings.imageAspectRatio = modelData
             }
         }
     }
@@ -76,34 +67,20 @@ Column {
         Binding {
             target: imageSettings.resolutions
             property: "aspectRatio"
-            value: settings.primaryImageAspectRatio
-            when: settings.device == 0
-        }
-
-        Binding {
-            target: imageSettings.resolutions
-            property: "aspectRatio"
-            value: settings.secondaryImageAspectRatio
-            when: settings.device == 1
+            value: settings.imageAspectRatio
         }
 
         Repeater {
             id: resolutions
-
-            model: imageSettings.resolutions.aspectRatio == __aspectRatio ?
+            model: imageSettings.resolutions.aspectRatio == settings.imageAspectRatio ?
                 imageSettings.resolutions : undefined
 
             delegate: CameraButton {
+                width: resolutionsRow.width / resolutions.count
                 capitalize: true
                 text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels)
-                checked: __resolution == resolutionName
-                onClicked: {
-                    if (settings.device == 1) {
-                        settings.secondaryImageResolution = resolutionName
-                    } else {
-                        settings.primaryImageResolution = resolutionName
-                    }
-                }
+                checked: settings.imageResolution == resolutionName
+                onClicked: settings.imageResolution = resolutionName
             }
         }
     }