2 import com.nokia.meego 1.0
3 import QtMobility.location 1.1
5 import "UIConstants.js" as UIConstants
6 import "ExtrasConstants.js" as ExtrasConstants
11 property bool canRefresh: realtimeResult.sourceUrl != '' || (realtimeResult.isStation && realtimeResult.gstation != '')
12 //property alias stationSelect: stationSelector
13 property variant nearbyStations
16 lineSearchButton.clicked()
20 realtimeResult.refresh()
23 function fillNearbyStations(lat, lon) {
24 nearbyStations = itip.get_nearby_stations(lat, lon)
27 function showNearby() {
28 console.log("show nearby")
30 var stations = nearbyStations;
31 stationSelectorModel.clear();
32 for (var idx in stations) {
33 stationSelectorModel.append({'name': stations[idx]});
36 stationSelector.open();
40 visible: !parent.canRefresh
41 anchors.centerIn: parent
43 text: '<p><strong>Welcome, traveller!<br></strong></p><p>Press <img src="image://theme/icon-m-toolbar-search"> to search for<br>departure information.</p><p>Press <img src="image://theme/icon-m-toolbar-view-menu"> for nearby stations.<br></p><p><strong>Have a safe journey.</strong></p>'
60 GradientStop { position: 0; color: '#777' }
61 GradientStop { position: 1; color: '#aaa' }
72 verticalCenter: parent.verticalCenter
87 fillNearbyStations(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude)
93 titleText: 'Select nearby station'
96 id: stationSelectorModel
100 realtimeResult.isStation = true
101 realtimeResult.gline = ''
102 realtimeResult.sourceUrl = ''
104 gstation.text = stationSelectorModel.get(selectedIndex).name
105 realtimeResult.gstation = stationSelectorModel.get(selectedIndex).name
106 console.log('station to get: ' + realtimeResult.gstation)
112 placeholderText: 'Line'
121 right: lineSearchButton.left
131 drag.axis: Drag.YAxis
133 drag.maximumY: parent.height
140 gline.text = currentLine
142 /* We usually want to select a station after selecting a line */
143 stationPickerButton.clicked()
159 iconSource: 'image://theme/icon-m-common-search'
162 lineSheet.currentLine = ''
168 placeholderText: 'Station'
175 right: stationPickerButton.left
178 rightMargin: 10*stationPickerButton.opacity
185 gstation.text = stationSheet.currentStation
187 realtimeResult.gline = stationSheet.currentLine
188 realtimeResult.gdirection = stationSheet.currentDirection
189 realtimeResult.isStation = false
190 realtimeResult.sourceUrl = itip.get_directions_url(stationSheet.currentLine, stationSheet.currentDirection, stationSheet.currentStation)
191 realtimeResult.gstation = stationSheet.currentStation
193 console.debug('url to get: ' + realtimeResult.sourceUrl)
194 realtimeResult.refresh()
199 id: stationPickerButton
203 bottom: gstation.bottom
210 width: lineSearchButton.width * opacity
211 //iconSource: 'image://theme/icon-m-common-location-picker'
212 iconSource: 'image://theme/icon-m-toolbar-list'
216 stationSheet.loadData(gline.text)
227 bottom: parent.bottom
233 gline: stationSheet.currentLine
234 gstation: stationSheet.currentStation
235 gdirection: stationSheet.currentDirection
237 sourceUrl: stationSheet.currentUrl