Settings GUI improvements
authorThomas Perl <m@thp.io>
Wed, 14 Mar 2012 17:22:32 +0000 (18:22 +0100)
committerThomas Perl <m@thp.io>
Wed, 14 Mar 2012 17:22:32 +0000 (18:22 +0100)
qml/Settings.qml
qml/SettingsHeader.qml [new file with mode: 0644]

index 87f7f4f..dc6f93c 100644 (file)
@@ -18,7 +18,7 @@ Page {
         anchors.fill: parent
         anchors.margins: UIConstants.DEFAULT_MARGIN
 
-        contentHeight: content_column.height + 2 * UIConstants.DEFAULT_MARGIN
+        //contentHeight: content_column.height + 2 * UIConstants.DEFAULT_MARGIN
         flickableDirection: Flickable.VerticalFlick
 
         Component.onCompleted: {
@@ -40,6 +40,10 @@ Page {
                 anchors.left: parent.left
             }
 
+            SettingsHeader {
+                text: 'Location'
+            }
+
             Row {
                 anchors.left: parent.left
                 anchors.right: parent.right
@@ -50,7 +54,7 @@ Page {
                     color: !theme.inverted ? UIConstants.COLOR_FOREGROUND : UIConstants.COLOR_INVERTED_FOREGROUND
                     anchors.verticalCenter: parent.verticalCenter
                 }
-                CheckBox {
+                Switch {
                     id: gpsEnable
                     anchors.right: parent.right
                     checked: config.getGpsEnabled()
@@ -77,44 +81,36 @@ Page {
                 id:updateDialog
             }
 
-            Row {
-                anchors.left: parent.left
-                anchors.right: parent.right
-                Text {
-                    text: "Update stations"
-                    anchors.left: parent.left
-                    font.pixelSize: UIConstants.FONT_LARGE
-                    color: !theme.inverted ? UIConstants.COLOR_FOREGROUND : UIConstants.COLOR_INVERTED_FOREGROUND
-                    anchors.verticalCenter: parent.verticalCenter
-                }
+            SettingsHeader {
+                text: 'Station List'
+            }
 
-                Button {
-                    id: btnUpdate
-                    anchors.right: parent.right
-                    text: "Update"
-                    width: 100
+            Button {
+                id: btnUpdate
+                anchors.horizontalCenter: parent.horizontalCenter
+                text: "Update stations"
+                width: parent.width * .7
 
-                    Component.onCompleted: {
-                        if (config.checkStationsUpdate()) {
-                            btnUpdate.color = "green"
-                        }
+                Component.onCompleted: {
+                    if (config.checkStationsUpdate()) {
+                        btnUpdate.color = "green"
                     }
+                }
 
-                    onClicked: {
-                        var updateAvailable = config.checkStationsUpdate();
-                        if (updateAvailable) {
-                            var updated = config.updateStations();
-                            if (updated !== '') {
-                                updateDialog.text = "Stations updated\nPlease restart app"
-                                txtLastUpdate.text = updated
-                            } else {
-                                updateDialog.text = "[UpdateError]:\nTry again later or send me an email:\n<gotovienna@logic.at>"
-                            }
+                onClicked: {
+                    var updateAvailable = config.checkStationsUpdate();
+                    if (updateAvailable) {
+                        var updated = config.updateStations();
+                        if (updated !== '') {
+                            updateDialog.text = "Stations updated\nPlease restart app"
+                            txtLastUpdate.text = updated
                         } else {
-                            updateDialog.text = "No updates available";
+                            updateDialog.text = "[UpdateError]:\nTry again later or send me an email:\n<gotovienna@logic.at>"
                         }
-                        updateDialog.open();
+                    } else {
+                        updateDialog.text = "No updates available";
                     }
+                    updateDialog.open();
                 }
             }
 
diff --git a/qml/SettingsHeader.qml b/qml/SettingsHeader.qml
new file mode 100644 (file)
index 0000000..ef98e91
--- /dev/null
@@ -0,0 +1,39 @@
+
+import QtQuick 1.0
+
+Item {
+    id: settingsHeader
+    property alias text: headerCaption.text
+    property color color: headerCaption.visible?'#666':'#fff'
+
+    width: parent.width
+    height: headerCaption.visible?60*.7:10
+
+    Rectangle {
+        id: horizontalLine
+
+        anchors {
+            left: parent.left
+            right: headerCaption.left
+            rightMargin: headerCaption.visible?16:0
+            verticalCenter: headerCaption.verticalCenter
+        }
+
+        height: 1
+        color: settingsHeader.color
+    }
+
+    Text {
+        id: headerCaption
+        text: ''
+        visible: text !== ''
+        color: settingsHeader.color
+        font.pixelSize: 17
+
+        anchors {
+            right: parent.right
+            bottom: parent.bottom
+        }
+    }
+}
+