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")
50 selectedIndex: stationListProxyModel.sortingMode
54 name: QT_TR_NOOP("Stations by Name")
57 name: QT_TR_NOOP("Stations by Distance")
60 name: QT_TR_NOOP("Stations Recently Seen")
63 onSelectedIndexChanged: {
64 header.text = dialogOptions.get(selectedIndex).name
65 console.log("Selection changed to: " + selectedIndex)
66 console.log("Selection text is: " + header.text)
71 anchors.top: header.bottom
74 target: stationListProxyModel
75 property: "searchPattern"
76 value: searchField.text
79 target: stationListProxyModel
80 property: "sortingMode"
81 value: header.selectedIndex
86 anchors.top: mainView.top
89 GradientStop {color: "#aa000000"; position: 0.0}
90 GradientStop {color: "#00000000"; position: 1.0}
97 anchors.top: searchField.bottom
98 width: parent.width - 32
104 height: parent.height
105 model: stationListProxyModel
114 visible: mouseArea.pressed
115 source: "image://theme/meegotouch-list-background-pressed-center"
121 anchors.verticalCenter: parent.verticalCenter
125 text: highlightSearch(model.display)
132 anchors.fill: background
134 stationListPage.loadStation(model.display)
143 acceptButtonText: qsTr("Save")
144 rejectButtonText: qsTr("Cancel")
148 width: parent.width - 32
149 height: parent.height - 32
156 anchors.left: parent.left
157 anchors.right: parent.right
160 text: "Show Last Station on Startup"
161 anchors.verticalCenter: parent.verticalCenter
164 anchors.verticalCenter: parent.verticalCenter
165 id: showLastStationSwitch
166 anchors.right: parent.right
172 anchors.left: parent.left
173 anchors.right: parent.right
176 text: "Update Display Periodically"
177 anchors.verticalCenter: parent.verticalCenter
180 anchors.verticalCenter: parent.verticalCenter
181 anchors.right: parent.right
182 id: periodicCheckSwitch