CommonSettings will now store and load settings
authorMohammed Sameer <msameer@foolab.org>
Sun, 9 Sep 2012 10:48:00 +0000 (13:48 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 9 Sep 2012 10:48:00 +0000 (13:48 +0300)
qml/CameraSettings.qml

index 6d63c78..7194c45 100644 (file)
@@ -17,10 +17,30 @@ Column {
 
         ButtonRow {
                 anchors.horizontalCenter: parent.horizontalCenter
-                Button { text: qsTr("Disabled"); }
-                Button { text: qsTr("2 seconds"); }
-                Button { text: qsTr("5 seconds"); }
-                Button { text: qsTr("No timeout"); }
+
+                Button {
+                        text: qsTr("Disabled");
+                        checked: settings.postCaptureTimeout == 0;
+                        onClicked: settings.postCaptureTimeout = 0;
+                }
+
+                Button {
+                        text: qsTr("2 seconds");
+                        checked: settings.postCaptureTimeout == 2;
+                        onClicked: settings.postCaptureTimeout = 2;
+                }
+
+                Button {
+                        text: qsTr("5 seconds");
+                        checked: settings.postCaptureTimeout == 10;
+                        onClicked: settings.postCaptureTimeout = 10;
+                }
+
+                Button {
+                        text: qsTr("No timeout");
+                        checked: settings.postCaptureTimeout == -1;
+                        onClicked: settings.postCaptureTimeout = -1;
+                }
         }
 
         SectionHeader {
@@ -30,35 +50,50 @@ Column {
         TextField {
                 placeholderText: qsTr("Name or copyright");
                 width: parent.width
+                text: settings.creatorName
+                onTextChanged: settings.creatorName = text;
         }
 
         Item {
                 width: parent.width
-                height: 40 // TODO: hardcoded
+                height: Math.max(useGpsLabel.height, useGps.height);
 
                 Label {
-                        id: gpsLabel
+                        id: useGpsLabel
                         anchors.left: parent.left
                         text: qsTr("Use GPS");
                 }
 
                 Switch {
+                        id: useGps
                         anchors.right: parent.right
+                        // 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;
                 }
         }
 
         Item {
                 width: parent.width
-                height: 40 // TODO: hardcoded
+                height: Math.max(useGeotagsLabel.height, useGeotags.height);
+
+                // TODO: transition when hiding/showing and we should scroll a bit to show it
+                visible: useGps.checked
 
                 Label {
-                        id: geotagsLabel
+                        id: useGeotagsLabel
                         anchors.left: parent.left
                         text: qsTr("Use geotags");
                 }
 
                 Switch {
+                        id: useGeotags
                         anchors.right: parent.right
+                        // 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;
                 }
         }
 }