Added Menu item to open the about page
[quandoparte] / application / resources / harmattan / qml / StationListPage.qml
1 import QtQuick 1.0
2 import QtMobility.location 1.1
3 import com.nokia.meego 1.0
4 import net.cirulla.quandoparte 1.0
5 import "uiconstants.js" as UiConstants
6 import "StationListPage.js" as Private
7
8 Page {
9     property variant stationView
10     id: stationListPage
11     Component.onCompleted: {
12         stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
13     }
14     Menu {
15         id: menu
16         content: MenuLayout {
17             MenuItem {
18                 text: qsTr("About Quando Parte")
19                 onClicked: Private.showAboutPage()
20             }
21         }
22     }
23     tools: ToolBarLayout {
24         id: toolBar
25         ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
26         ToolIcon { iconId: "icon-m-toolbar-settings"; onClicked: settingsSheet.open(); }
27         ToolIcon { iconId: "icon-m-toolbar-view-menu"; onClicked: menu.open() }
28     }
29
30     DataProvider {
31         id: provider
32         onStationScheduleReady: {
33             if (Private.view !== undefined) {
34                 Private.view.html = result
35                 //Private.view.url = url
36             }
37         }
38     }
39     PageHeader {
40         id: header
41         anchors.top: parent.top
42         selectedIndex: stationListProxyModel.sortingMode
43         options: ListModel {
44             id: dialogOptions
45             ListElement {
46                 name: QT_TR_NOOP("Stations by Name")
47             }
48             ListElement {
49                 name: QT_TR_NOOP("Stations by Distance")
50             }
51             ListElement {
52                 name: QT_TR_NOOP("Stations Recently Seen")
53             }
54         }
55     }
56     SearchBar {
57         id: searchField
58         anchors.top: header.bottom
59     }
60     Binding {
61         target: stationListProxyModel
62         property: "searchPattern"
63         value: searchField.text
64     }
65     Binding {
66         target: stationListProxyModel
67         property: "sortingMode"
68         value: header.selectedIndex
69     }
70     Rectangle {
71         id: shadow
72         width: parent.width
73         anchors.top: mainView.top
74         height: 5
75         gradient: Gradient {
76             GradientStop {color: "#aa000000"; position: 0.0}
77             GradientStop {color: "#00000000"; position: 1.0}
78         }
79     }
80     Item {
81         id: mainView
82         x: 16
83         y: 16
84         anchors.top: searchField.bottom
85         width: parent.width - 32
86         height: parent.height
87         ListView {
88             id: stationListView
89             clip: true
90             width: parent.width
91             height: parent.height
92             model:  stationListProxyModel
93             delegate: Item {
94                 id: listItem
95                 height: 48
96                 width: parent.width
97                 BorderImage {
98                     id: background
99                     anchors.fill: parent
100                     // Fill page borders
101                     visible: mouseArea.pressed
102                     source: "image://theme/meegotouch-list-background-pressed-center"
103                 }
104                 Row {
105                     anchors.fill: parent
106
107                     Column {
108                         anchors.verticalCenter: parent.verticalCenter
109
110                         Label {
111                             id: mainText
112                             text: Private.highlightSearch(model.display, UiConstants.AccentColor)
113                             font.bold: true
114                         }
115                     }
116                 }
117                 MouseArea {
118                     id: mouseArea
119                     anchors.fill: background
120                     onClicked: {
121                         Private.loadStation(model.display)
122                     }
123                 }
124             }
125         }
126     }
127
128     Sheet {
129         id: settingsSheet
130         acceptButtonText: qsTr("Save")
131         rejectButtonText: qsTr("Cancel")
132         content: Item {
133             x: 16
134             y: 16
135             width: parent.width - 32
136             height: parent.height - 32
137             Column {
138                 spacing: 16
139                 anchors.fill: parent
140                 Item {
141                     height: 40
142                     anchors.leftMargin: UiConstants.DefaultMargins
143                     anchors.left: parent.left
144                     anchors.right: parent.right
145                     Label {
146                         font.bold: true
147                         text: "Show Last Station on Startup"
148                         anchors.verticalCenter: parent.verticalCenter
149                         anchors.left: parent.left
150                     }
151                     Switch {
152                         anchors.verticalCenter: parent.verticalCenter
153                         id: showLastStationSwitch
154                         anchors.right: parent.right
155                     }
156                 }
157                 Item {
158                     height: 40
159                     anchors.leftMargin: UiConstants.DefaultMargins
160                     anchors.left: parent.left
161                     anchors.right: parent.right
162                     Label {
163                         font.bold: true
164                         text: "Update Display Periodically"
165                         anchors.verticalCenter: parent.verticalCenter
166                     }
167                     Switch {
168                         anchors.verticalCenter: parent.verticalCenter
169                         anchors.right: parent.right
170                         id: periodicCheckSwitch
171                     }
172                 }
173             }
174         }
175     }
176 }
177