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 realtimeResult.refresh()
19 function fillNearbyStations(lat, lon) {
20 nearbyStations = itip.get_nearby_stations(lat, lon)
23 function showNearby() {
24 console.log("show nearby")
26 var stations = nearbyStations
27 stationSelectorModel.clear()
28 for (var idx in stations) {
29 stationSelectorModel.append({'name': stations[idx]})
32 stationSelector.open()
42 fillNearbyStations(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude)
48 titleText: 'Select line'
53 Component.onCompleted: {
54 var lines = itip.get_lines()
56 for (var idx in lines) {
57 lineSelectorModel.append({'name': lines[idx]})
62 // XXX It would be nice if we could make a delegate with
63 // icons (i.e. U1, U2, ... in the right colors), but we
64 // would have to "copy" the default delegate style
67 console.log('accepted: ' + selectedIndex)
68 gline.text = lineSelectorModel.get(selectedIndex).name
74 titleText: 'Select nearby station'
77 id: stationSelectorModel
81 realtimeResult.isStation = true
82 realtimeResult.gstation = stationSelectorModel.get(selectedIndex).name
83 realtimeResult.gline = ''
84 realtimeResult.sourceUrl = ''
86 gstation.text = stationSelectorModel.get(selectedIndex).name
87 console.log('station to get: ' + realtimeResult.gstation)
92 placeholderText: 'Line'
101 right: lineSearchButton.left
105 // TODO: Check if text matches an item in lineSelectorModel and
106 // set selectedIndex in lineSelector to the right item
109 if (lineSelector.selectedIndex === -1) {
113 // Disable selection in line selector if user changes the text
114 if (lineSelectorModel.get(lineSelector.selectedIndex).name !== text) {
115 lineSelector.selectedIndex = -1
122 drag.axis: Drag.YAxis
124 drag.maximumY: parent.height
144 iconSource: 'image://theme/icon-m-common-search'
146 onClicked: lineSelector.open()
150 placeholderText: 'Station'
156 right: stationPickerButton.left
159 rightMargin: 10*stationPickerButton.opacity
168 id: stationPickerButton
172 bottom: gstation.bottom
177 Behavior on opacity { PropertyAnimation { } }
179 opacity: gline.text !== '' // XXX: Check if the line is valid
181 width: lineSearchButton.width * opacity
182 //iconSource: 'image://theme/icon-m-common-location-picker'
183 iconSource: 'image://theme/icon-m-toolbar-list'
187 stationSheet.loadData(gline.text)
198 bottom: parent.bottom
204 gline: stationSheet.currentLine
205 gstation: stationSheet.currentStation
206 gdirection: stationSheet.currentDirection
208 sourceUrl: stationSheet.currentUrl