Bind checked property to the corresponding setting value for CameraTextSwitch
[harmattan/cameraplus] / qml / CameraSettings.qml
index 2cf55d8..9791aa8 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-import QtQuick 1.1
-import com.nokia.meego 1.1
+import QtQuick 2.0
+import QtCamera 1.0
 
 Column {
-        id: col
-        spacing: 10
-        width: parent.width
-
-        Label {
-                font.pixelSize: 36
-                text: qsTr("Camera settings");
-                width: parent.width
-        }
-
-        TextSwitch {
-                text: qsTr("Show grid lines");
+    property Camera camera: null
 
-                // 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;
+    id: col
+    spacing: 10
+    width: parent.width
 
-                onCheckedChanged: settings.gridEnabled = checked;
-        }
-
-        SectionHeader {
-                text: qsTr("Creator name");
-                width: parent.width
-        }
+    CameraLabel {
+        font.pixelSize: 36
+        text: qsTr("Camera settings")
+        width: parent.width
+    }
 
-        TextField {
-                placeholderText: qsTr("Name or copyright");
-                width: parent.width
-                text: settings.creatorName
-                onTextChanged: settings.creatorName = text;
-        }
+    SectionHeader {
+        text: qsTr("Camera")
+        width: parent.width
+    }
 
-        TextSwitch {
-                text: qsTr("Use zoom keys for capture");
+    CameraButtonRow {
+        anchors.horizontalCenter: parent.horizontalCenter
+        enabled: camera != null && camera.running && camera.idle
 
-                // 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;
-                onCheckedChanged: settings.zoomAsShutter = checked;
+        CameraButton {
+            text: qsTr("Back (Primary)");
+            checkable: true
+            checked: settings.device == 0
+            onClicked: settings.device = 0
         }
 
-        TextSwitch {
-                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;
-                onCheckedChanged: settings.soundEnabled = checked;
+        CameraButton {
+            text: qsTr("Front (Secondary)");
+            checkable: true
+            checked: settings.device == 1
+            onClicked: settings.device = 1
         }
+    }
 
-        TextSwitch {
-                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;
-                onCheckedChanged: settings.useGps = checked;
-        }
+    CameraTextSwitch {
+        text: qsTr("Show grid lines")
 
-        TextSwitch {
-                // TODO: transition when hiding/showing and we should scroll a bit to show it
-                visible: useGps.checked
+        checked: settings.gridEnabled
+        onCheckedChanged: settings.gridEnabled = checked
+    }
 
-                text: qsTr("Use geotags");
+    SectionHeader {
+        text: qsTr("Creator name")
+        width: parent.width
+    }
 
-                // 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;
-                onCheckedChanged: settings.useGeotags = checked;
-        }
+    CameraTextField {
+        placeholderText: qsTr("Name or copyright")
+        width: parent.width
+        text: settings.creatorName
+        onTextChanged: settings.creatorName = text
+    }
+
+    CameraTextSwitch {
+        text: qsTr("Use zoom keys for capture")
+        checked: settings.zoomAsShutter
+        onCheckedChanged: settings.zoomAsShutter = checked
+    }
+
+    CameraTextSwitch {
+        text: qsTr("Use proximity sensor for capture")
+
+        checked: settings.proximityAsShutter
+        onCheckedChanged: settings.proximityAsShutter = checked
+    }
+
+    CameraTextSwitch {
+        text: qsTr("Enable camera sounds")
+
+        checked: settings.soundEnabled
+        onCheckedChanged: settings.soundEnabled = checked
+    }
+
+    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")
+
+        checked: settings.useGps
+        onCheckedChanged: settings.useGps = checked
+    }
+
+    CameraTextSwitch {
+        // TODO: transition when hiding/showing and we should scroll a bit to show it
+        visible: useGps.checked
+
+        text: qsTr("Use geotags")
+        checked: settings.useGeotags
+        onCheckedChanged: settings.useGeotags = checked
+    }
 }