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