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
10 orientationLock: PageOrientation.LockPortrait
12 property bool canRefresh: realtimeResult.sourceUrl != '' || (realtimeResult.isStation && realtimeResult.gstation != '')
13 //property alias stationSelect: stationSelector
14 property variant nearbyStations
17 lineSearchButton.clicked()
21 realtimeResult.refresh()
24 function fillNearbyStations(lat, lon) {
25 nearbyStations = itip.get_nearby_stations(lat, lon)
28 function showNearby() {
29 console.log("show nearby")
31 var stations = nearbyStations;
32 stationSelectorModel.clear();
33 for (var idx in stations) {
34 stationSelectorModel.append({'name': stations[idx]});
37 stationSelector.open();
41 visible: !parent.canRefresh
42 anchors.centerIn: parent
44 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>'
61 GradientStop { position: 0; color: '#777' }
62 GradientStop { position: 1; color: '#aaa' }
73 verticalCenter: parent.verticalCenter
88 fillNearbyStations(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude)
94 titleText: 'Select nearby station'
97 id: stationSelectorModel
101 realtimeResult.isStation = true
102 realtimeResult.gline = ''
103 realtimeResult.sourceUrl = ''
105 gstation.text = stationSelectorModel.get(selectedIndex).name
106 realtimeResult.gstation = stationSelectorModel.get(selectedIndex).name
107 console.log('station to get: ' + realtimeResult.gstation)
113 placeholderText: 'Line'
122 right: lineSearchButton.left
132 drag.axis: Drag.YAxis
134 drag.maximumY: parent.height
141 gline.text = currentLine
143 /* We usually want to select a station after selecting a line */
144 stationPickerButton.clicked()
160 iconSource: 'image://theme/icon-m-common-search'
163 lineSheet.currentLine = ''
169 placeholderText: 'Station'
176 right: stationPickerButton.left
179 rightMargin: 10*stationPickerButton.opacity
186 gstation.text = stationSheet.currentStation
188 realtimeResult.gline = stationSheet.currentLine
189 realtimeResult.gdirection = stationSheet.currentDirection
190 realtimeResult.isStation = false
191 realtimeResult.sourceUrl = itip.get_directions_url(stationSheet.currentLine, stationSheet.currentDirection, stationSheet.currentStation)
192 realtimeResult.gstation = stationSheet.currentStation
194 console.debug('url to get: ' + realtimeResult.sourceUrl)
195 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