Bind checked property to the corresponding setting value for CameraTextSwitch
[harmattan/cameraplus] / qml / CameraSettings.qml
index 6d63c78..9791aa8 100644 (file)
 // -*- qml -*-
-import QtQuick 1.1
-import com.nokia.meego 1.1
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+import QtQuick 2.0
+import QtCamera 1.0
 
 Column {
-        id: col
-        spacing: 10
+    property Camera camera: null
 
-        Label {
-                // TODO:
-                text: qsTr("Camera settings");
-        }
+    id: col
+    spacing: 10
+    width: parent.width
 
-        SectionHeader {
-                text: qsTr("Show captured content");
-        }
+    CameraLabel {
+        font.pixelSize: 36
+        text: qsTr("Camera settings")
+        width: parent.width
+    }
 
-        ButtonRow {
-                anchors.horizontalCenter: parent.horizontalCenter
-                Button { text: qsTr("Disabled"); }
-                Button { text: qsTr("2 seconds"); }
-                Button { text: qsTr("5 seconds"); }
-                Button { text: qsTr("No timeout"); }
-        }
+    SectionHeader {
+        text: qsTr("Camera")
+        width: parent.width
+    }
+
+    CameraButtonRow {
+        anchors.horizontalCenter: parent.horizontalCenter
+        enabled: camera != null && camera.running && camera.idle
 
-        SectionHeader {
-                text: qsTr("Creator name");
+        CameraButton {
+            text: qsTr("Back (Primary)");
+            checkable: true
+            checked: settings.device == 0
+            onClicked: settings.device = 0
         }
 
-        TextField {
-                placeholderText: qsTr("Name or copyright");
-                width: parent.width
+        CameraButton {
+            text: qsTr("Front (Secondary)");
+            checkable: true
+            checked: settings.device == 1
+            onClicked: settings.device = 1
         }
+    }
 
-        Item {
-                width: parent.width
-                height: 40 // TODO: hardcoded
+    CameraTextSwitch {
+        text: qsTr("Show grid lines")
 
-                Label {
-                        id: gpsLabel
-                        anchors.left: parent.left
-                        text: qsTr("Use GPS");
-                }
+        checked: settings.gridEnabled
+        onCheckedChanged: settings.gridEnabled = checked
+    }
 
-                Switch {
-                        anchors.right: parent.right
-                }
-        }
+    SectionHeader {
+        text: qsTr("Creator name")
+        width: parent.width
+    }
 
-        Item {
-                width: parent.width
-                height: 40 // TODO: hardcoded
+    CameraTextField {
+        placeholderText: qsTr("Name or copyright")
+        width: parent.width
+        text: settings.creatorName
+        onTextChanged: settings.creatorName = text
+    }
 
-                Label {
-                        id: geotagsLabel
-                        anchors.left: parent.left
-                        text: qsTr("Use geotags");
-                }
+    CameraTextSwitch {
+        text: qsTr("Use zoom keys for capture")
+        checked: settings.zoomAsShutter
+        onCheckedChanged: settings.zoomAsShutter = checked
+    }
 
-                Switch {
-                        anchors.right: parent.right
-                }
-        }
+    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
+    }
 }