2 import com.nokia.meego 1.1
3 import net.cirulla.quandoparte 1.0
4 import "uiconstants.js" as UiConstants
7 property alias name: schedule.name
8 property alias code: schedule.code
10 tools: ToolBarLayout {
13 iconId: "icon-m-toolbar-back" + (theme.inverted ? "-white": "")
14 onClicked: pageStack.pop()
17 iconId: "icon-m-toolbar-refresh" + (theme.inverted ? "-white": "")
18 onClicked: updateStation() }
20 iconId: "icon-m-toolbar-view-menu" + (theme.inverted ? "-white": "")
21 onClicked: menu.open()
26 anchors.top: parent.top
27 selectedIndex: schedule.type
35 anchors.top: header.bottom
41 value: header.selectedIndex
59 id: stationScheduleView
69 delegate: StationScheduleDelegate {
70 width: stationScheduleView.width
72 arrivalTime: model.arrivalTime
73 departureTime: model.departureTime
75 arrivalStation: model.arrivalStation
76 departureStation: model.departureStation
78 actualPlatform: model.actualPlatform
79 expectedPlatfrom: model.expectedPlatform
84 flickableItem: stationScheduleView
88 platformStyle: BusyIndicatorStyle {
91 anchors.centerIn: parent
103 textFormat: Text.RichText
104 visible: parent.visible
105 wrapMode: Text.WordWrap
106 text: "<h2>" + qsTr("Error!") + "</h2><p>" + schedule.error + "</p>"
108 // font.pixelSize: UiConstants.HeaderFontPixelSize
109 horizontalAlignment: Text.AlignHCenter
110 anchors.centerIn: parent
112 onVisibleChanged: if (visible) console.log("showing error: " + schedule.error)
119 target: stationScheduleView
127 target: busyIndicator
133 when: completed && schedule.error === ""
135 target: stationScheduleView
143 target: busyIndicator
149 when: schedule.error !== ""
151 target: stationScheduleView
159 target: busyIndicator
165 StationScheduleModel {
167 onNameChanged: updateStation()
168 onLayoutChanged: if (error) view.state = "error"
169 else view.state = "ready"
171 Component.onCompleted: {
172 updateTimer.timeout.connect(updateStation)
173 view.state = "loading"
175 function updateStation() {
176 view.state = "loading"
177 console.log("Updating station with " + schedule.name + ", " + schedule.code)
178 schedule.fetch(schedule.name, schedule.code)