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.gstation = stationSelectorModel.get(selectedIndex).name
102 realtimeResult.gline = ''
103 realtimeResult.sourceUrl = ''
105 gstation.text = 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.gstation = stationSheet.currentStation
189 realtimeResult.gdirection = stationSheet.currentDirection
190 realtimeResult.isStation = false
192 realtimeResult.sourceUrl = itip.get_directions_url(stationSheet.currentLine, stationSheet.currentDirection, stationSheet.currentStation)
193 console.log('url to get: ' + realtimeResult.sourceUrl)
194 realtimeResult.refresh()
200 id: stationPickerButton
204 bottom: gstation.bottom
211 width: lineSearchButton.width * opacity
212 //iconSource: 'image://theme/icon-m-common-location-picker'
213 iconSource: 'image://theme/icon-m-toolbar-list'
217 stationSheet.loadData(gline.text)
228 bottom: parent.bottom
234 gline: stationSheet.currentLine
235 gstation: stationSheet.currentStation
236 gdirection: stationSheet.currentDirection
238 sourceUrl: stationSheet.currentUrl