Page {
tools: commonTools
+ property bool canRefresh: realtimeResult.sourceUrl != ''
+
+ function refresh() {
+ realtimeResult.refresh()
+ }
+
Image {
id: logo
source: 'logo.png'
onTextChanged: {
// TODO: Check if text matches an item in lineSelectorModel and
// set selectedIndex in lineSelector to the right item
+ gstation.text = ''
if (lineSelector.selectedIndex == -1) {
return
TextField {
placeholderText: 'Station'
id: gstation
+
anchors {
top: gline.bottom
left: parent.left
leftMargin: 10
rightMargin: 10*stationPickerButton.opacity
}
- onTextChanged: {
- directionLabel.currentDirection = ''
- }
}
Sheet {
property int selectedIndex: -1
onSelectedIndexChanged: {
console.log('current index: ' + selectedIndex)
+ if (selectedIndex != -1) {
+ stationSheet.currentStation = directionChooserModel.get(selectedIndex).station
+ } else {
+ stationSheet.currentStation = ''
+ }
}
anchors {
}
onAccepted: {
- if (stationSelectorListView.selectedIndex == -1) {
- gstation.text = ''
- } else {
- gstation.text = directionChooserModel.get(stationSelectorListView.selectedIndex).station
- }
+ gstation.text = stationSheet.currentStation
+
+ realtimeResult.gline = stationSheet.currentLine
+ realtimeResult.gstation = stationSheet.currentStation
+ realtimeResult.gdirection = stationSheet.currentDirection
+
+ realtimeResult.sourceUrl = itip.get_directions_url(stationSheet.currentLine, stationSheet.currentDirection, stationSheet.currentStation)
+ console.log('url to get: ' + realtimeResult.sourceUrl)
- directionLabel.currentDirection = stationSheet.currentDirection
}
}
}
}
- ResultRealtime { id: resu }
-
- Label {
- id: directionLabel
- property string currentDirection: ''
- text: 'Richtung ' + currentDirection
+ ResultRealtime {
+ id: realtimeResult
anchors {
+ margins: 10
+ top: gstation.bottom
left: parent.left
+ bottom: parent.bottom
right: parent.right
- top: gstation.bottom
- margins: 20*directionLabel.opacity
}
- font.pixelSize: UIConstants.FONT_SMALL
-
- opacity: currentDirection != ''
- scale: opacity
+ clip: true
- Behavior on opacity { PropertyAnimation { } }
- }
+ gline: stationSheet.currentLine
+ gstation: stationSheet.currentStation
+ gdirection: stationSheet.currentDirection
- Button {
- id: btnSearch
- text: 'Search'
- anchors {
- top: directionLabel.bottom
- topMargin: 10
- horizontalCenter: parent.horizontalCenter
- }
- onClicked: {
- resu.gline = gline.text
- resu.gstation = gstation.text
- pageStack.push(resu)
- itip.search(gline.text, gstation.text)
- resu.busy = false
- }
+ sourceUrl: stationSheet.currentUrl
}
}