Bind checked property to the corresponding setting value for CameraTextSwitch
[harmattan/cameraplus] / qml / CameraSettings.qml
index 1a504a3..9791aa8 100644 (file)
@@ -60,13 +60,10 @@ Column {
         }
     }
 
-    TextSwitch {
+    CameraTextSwitch {
         text: qsTr("Show grid lines")
 
-        // We have to do it that way because QML complains about a binding
-        // loop for checked if we bind the checked property to the settings value.
-        Component.onCompleted: checked = settings.gridEnabled
-
+        checked: settings.gridEnabled
         onCheckedChanged: settings.gridEnabled = checked
     }
 
@@ -82,43 +79,47 @@ Column {
         onTextChanged: settings.creatorName = text
     }
 
-    TextSwitch {
+    CameraTextSwitch {
         text: qsTr("Use zoom keys for capture")
-
-        // We have to do it that way because QML complains about a binding
-        // loop for checked if we bind the checked property to the settings value.
-        Component.onCompleted: checked = settings.zoomAsShutter
+        checked: settings.zoomAsShutter
         onCheckedChanged: settings.zoomAsShutter = checked
     }
 
-    TextSwitch {
+    CameraTextSwitch {
+        text: qsTr("Use proximity sensor for capture")
+
+        checked: settings.proximityAsShutter
+        onCheckedChanged: settings.proximityAsShutter = checked
+    }
+
+    CameraTextSwitch {
         text: qsTr("Enable camera sounds")
 
-        // We have to do it that way because QML complains about a binding
-        // loop for checked if we bind the checked property to the settings value.
-        Component.onCompleted: checked = settings.soundEnabled
+        checked: settings.soundEnabled
         onCheckedChanged: settings.soundEnabled = checked
     }
 
-    TextSwitch {
+    CameraTextSwitch {
+        text: qsTr("Preview images and videos after capturing")
+        visible: false
+        checked: settings.enablePreview
+        onCheckedChanged: settings.enablePreview = checked
+    }
+
+    CameraTextSwitch {
         id: useGps
         text: qsTr("Use GPS")
 
-        // We have to do it that way because QML complains about a binding
-        // loop for checked if we bind the checked property to the settings value.
-        Component.onCompleted: checked = settings.useGps
+        checked: settings.useGps
         onCheckedChanged: settings.useGps = checked
     }
 
-    TextSwitch {
+    CameraTextSwitch {
         // TODO: transition when hiding/showing and we should scroll a bit to show it
         visible: useGps.checked
 
         text: qsTr("Use geotags")
-
-        // We have to do it that way because QML complains about a binding
-        // loop for checked if we bind the checked property to the settings value.
-        Component.onCompleted: checked = settings.useGeotags
+        checked: settings.useGeotags
         onCheckedChanged: settings.useGeotags = checked
     }
 }