2 import QtMobility.location 1.1
3 import com.nokia.meego 1.0
4 import net.cirulla.quandoparte 1.0
7 property variant stationView
9 Component.onCompleted: {
10 stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
12 tools: ToolBarLayout {
14 ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
15 ToolIcon { iconId: "icon-m-toolbar-settings"; onClicked: settingsSheet.open(); }
16 ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
19 function loadStation()
21 var component = Qt.createComponent("StationPage.qml");
22 if (component.status == Component.Ready) {
23 var view = component.createObject(stationListPage)
24 stationListPage.stationView = view
26 view.html = "<h1>Hello World</h1><p>Lorem ipsum</p>"
29 console.log('Cannot load component: ' + component.errorString());
32 function highlightSearch(s)
34 // TODO compile RegExp on change, or find a way to cleanly use
35 // stationListProxyModel.filterRegExp
36 if (searchField.text.length) {
37 var r = new RegExp(searchField.text, 'i')
39 return s.replace(r, '<span style="text-decoration:underline">' +
48 anchors.top: parent.top
49 text: qsTr("Stations")
53 name: QT_TR_NOOP("Stations by Name")
56 name: QT_TR_NOOP("Stations by Distance")
59 name: QT_TR_NOOP("Stations Recently Seen")
62 onSelectedIndexChanged: {
63 header.text = dialogOptions.get(selectedIndex).name
64 switch (selectedIndex) {
66 stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
69 stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
72 stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
79 anchors.top: header.bottom
82 target: stationListProxyModel
83 property: "searchPattern"
84 value: searchField.text
89 anchors.top: searchField.bottom
90 width: parent.width - 32
98 model: stationListProxyModel
107 visible: mouseArea.pressed
108 source: "image://theme/meegotouch-list-background-pressed-center"
114 anchors.verticalCenter: parent.verticalCenter
118 text: highlightSearch(model.display)
125 anchors.fill: background
127 stationListPage.loadStation(model.display)
136 acceptButtonText: qsTr("Save")
137 rejectButtonText: qsTr("Cancel")
141 width: parent.width - 32
142 height: parent.height - 32
149 anchors.left: parent.left
150 anchors.right: parent.right
153 text: "Show Last Station on Startup"
154 anchors.verticalCenter: parent.verticalCenter
157 anchors.verticalCenter: parent.verticalCenter
158 id: showLastStationSwitch
159 anchors.right: parent.right
165 anchors.left: parent.left
166 anchors.right: parent.right
169 text: "Update Display Periodically"
170 anchors.verticalCenter: parent.verticalCenter
173 anchors.verticalCenter: parent.verticalCenter
174 anchors.right: parent.right
175 id: periodicCheckSwitch