2 import com.nokia.meego 1.0
3 import "UIConstants.js" as UIConstants
4 import "ExtrasConstants.js" as ExtrasConstants
8 property string currentLine: ''
9 property string currentDirection: ''
10 property string currentStation: ''
12 acceptButtonText: 'Select'
13 rejectButtonText: 'Cancel'
15 function loadData(lineName) {
16 stationSheet.currentLine = lineName
18 directionChooser.direction1 = ''
19 directionChooser.direction2 = ''
21 directionChooserBusyIndicator.running = true
22 itip.load_directions(stationSheet.currentLine)
24 firstDirection.clicked()
25 directionChooser.checkedButton = firstDirection
32 directionChooserBusyIndicator.running = false
34 directionChooser.direction1 = itip.get_direction(0)
35 directionChooser.direction2 = itip.get_direction(1)
37 firstDirection.clicked()
38 directionChooser.checkedButton = firstDirection
47 property string direction1
48 property string direction2
50 visible: !directionChooserBusyIndicator.running
52 function chosen(idx) {
53 console.log('direction chosen: '+ idx)
55 stationSelectorListView.selectedIndex = -1
58 stationSheet.currentDirection = directionChooser.direction1
60 stationSheet.currentDirection = directionChooser.direction2
63 directionChooserModel.clear()
64 var stations = itip.get_stations(stationSheet.currentLine, stationSheet.currentDirection)
66 for (var s in stations) {
67 directionChooserModel.append({'station': stations[s]})
80 text: 'Richtung ' + directionChooser.direction1
81 onClicked: directionChooser.chosen(1)
86 text: 'Richtung ' + directionChooser.direction2
87 onClicked: directionChooser.chosen(2)
92 id: stationSelectorListView
93 visible: !directionChooserBusyIndicator.running
95 property int selectedIndex: -1
96 onSelectedIndexChanged: {
97 console.log('current index: ' + selectedIndex)
98 if (selectedIndex != -1) {
99 stationSheet.currentStation = directionChooserModel.get(selectedIndex).station
101 stationSheet.currentStation = ''
107 top: directionChooser.bottom
110 bottom: parent.bottom
116 id: directionChooserModel
119 delegate: SheetListItem { selector: stationSelectorListView }
123 flickableItem: stationSelectorListView
127 id: directionChooserBusyIndicator
128 anchors.centerIn: parent
130 platformStyle: BusyIndicatorStyle { size: 'large' }
135 gstation.text = stationSheet.currentStation
137 realtimeResult.gline = stationSheet.currentLine
138 realtimeResult.gstation = stationSheet.currentStation
139 realtimeResult.gdirection = stationSheet.currentDirection
141 realtimeResult.sourceUrl = itip.get_directions_url(stationSheet.currentLine, stationSheet.currentDirection, stationSheet.currentStation)
142 console.log('url to get: ' + realtimeResult.sourceUrl)