Use the new code field to fetch the station schedule
[quandoparte] / application / resources / harmattan / qml / StationListPage.qml
index 60f6360..21fda92 100644 (file)
@@ -10,39 +10,45 @@ Page {
     id: stationListPage
     tools: ToolBarLayout {
         id: toolBar
-        ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
-        ToolIcon { iconId: "icon-m-toolbar-settings"; onClicked: settingsSheet.open(); }
+        ToolIcon { iconId: "icon-m-toolbar-search"; onClicked: searchField.visible = !searchField.visible; }
         ToolIcon { iconId: "icon-m-toolbar-view-menu"; onClicked: menu.open() }
     }
     Menu {
         id: menu
         content: MenuLayout {
             MenuItem {
+                text: qsTr("Update Periodically")
+                Switch {
+                    id: periodicCheckSwitch
+                    anchors {
+                        verticalCenter: parent.verticalCenter
+                        right: parent.right
+                        rightMargin: UiConstants.DefaultMargin
+                    }
+                    onCheckedChanged: settings.autoUpdate = checked
+                }
+            }
+            MenuItem {
                 text: qsTr("About Quando Parte")
                 onClicked: Private.showAboutPage()
             }
+            Component.onCompleted: periodicCheckSwitch.checked = settings.autoUpdate
         }
     }
     PageHeader {
         id: header
         anchors.top: parent.top
         selectedIndex: stationListProxyModel.sortingMode
-        options: ListModel {
-            id: dialogOptions
-            ListElement {
-                name: QT_TR_NOOP("Stations by Name")
-            }
-            ListElement {
-                name: QT_TR_NOOP("Stations by Distance")
-            }
-            ListElement {
-                name: QT_TR_NOOP("Stations Recently Seen")
-            }
-        }
+        options: [
+            qsTr("Stations by Name"),
+            qsTr("Stations by Distance"),
+            qsTr("Stations Recently Seen")
+        ]
     }
     SearchBar {
         id: searchField
         anchors.top: header.bottom
+        visible: false
     }
     Binding {
         target: stationListProxyModel
@@ -62,15 +68,9 @@ Page {
             left: parent.left
             right: parent.right
         }
-        Rectangle {
+        DroppedShadow {
             id: shadow
-            width: parent.width
             anchors.top: mainView.top
-            height: 5
-            gradient: Gradient {
-                GradientStop {color: "#aa000000"; position: 0.0}
-                GradientStop {color: "#00000000"; position: 1.0}
-            }
         }
         ListView {
             id: stationListView
@@ -90,7 +90,7 @@ Page {
                     anchors.fill: parent
                     // Fill page borders
                     visible: mouseArea.pressed
-                    source: "image://theme/meegotouch-list-background-pressed-center"
+                    source: "image://theme/meegotouch-list-fullwidth-background-pressed"
                 }
                 Row {
                     anchors.fill: parent
@@ -103,16 +103,29 @@ Page {
 
                         Label {
                             id: mainText
-                            text: Private.highlightSearch(model.display, UiConstants.AccentColor)
+                            text: Private.highlightSearch(model.name, UiConstants.AccentColor)
                             font.bold: true
                         }
+                        Label {
+                            id: subText
+                            text: (model.code !== undefined) ? model.code : "none"
+                            font.bold: UiConstants.SubtitleFontBoldness
+                            font.pixelSize: UiConstants.SubtitleFontPixelSize
+                        }
+                    }
+                }
+                Image {
+                    anchors {
+                        left: parent.left
+                        right: parent.right
                     }
+                    source: "image://theme/meegotouch-separator-background-horizontal"
                 }
                 MouseArea {
                     id: mouseArea
                     anchors.fill: background
                     onClicked: {
-                        Private.loadStation(model.display)
+                        Private.loadStation(model.name, model.code)
                     }
                 }
             }
@@ -122,54 +135,5 @@ Page {
             flickableItem: stationListView
         }
     }
-
-    Sheet {
-        id: settingsSheet
-        acceptButtonText: qsTr("Save")
-        rejectButtonText: qsTr("Cancel")
-        content: Item {
-            x: 16
-            y: 16
-            width: parent.width - 32
-            height: parent.height - 32
-            Column {
-                spacing: 16
-                anchors.fill: parent
-                Item {
-                    height: 40
-                    anchors.leftMargin: UiConstants.DefaultMargin
-                    anchors.left: parent.left
-                    anchors.right: parent.right
-                    Label {
-                        font.bold: true
-                        text: qsTr("Show Last Station on Startup")
-                        anchors.verticalCenter: parent.verticalCenter
-                        anchors.left: parent.left
-                    }
-                    Switch {
-                        anchors.verticalCenter: parent.verticalCenter
-                        id: showLastStationSwitch
-                        anchors.right: parent.right
-                    }
-                }
-                Item {
-                    height: 40
-                    anchors.leftMargin: UiConstants.DefaultMargin
-                    anchors.left: parent.left
-                    anchors.right: parent.right
-                    Label {
-                        font.bold: true
-                        text: qsTr("Update Display Periodically")
-                        anchors.verticalCenter: parent.verticalCenter
-                    }
-                    Switch {
-                        anchors.verticalCenter: parent.verticalCenter
-                        anchors.right: parent.right
-                        id: periodicCheckSwitch
-                    }
-                }
-            }
-        }
-    }
 }