2 import Sailfish.Silica 1.0
3 import net.cirulla.quandoparte 1.0
7 property alias name: schedule.name
8 property alias code: schedule.code
15 text: qsTr("Update Schedule")
16 onClicked: updateStation()
19 text: qsTr("Departures")
20 onClicked: schedule.type = StationScheduleModel.DepartureSchedule
23 text: qsTr("Arrivals")
24 onClicked: schedule.type = StationScheduleModel.ArrivalSchedule
28 id: stationScheduleView
36 title: (schedule.type === StationScheduleModel.DepartureSchedule ? qsTr("Departures from ") : qsTr("Arrivals to ")) + name
39 delegate: StationScheduleDelegate {
40 width: stationScheduleView.width
42 arrivalTime: model.arrivalTime
43 departureTime: model.departureTime
45 arrivalStation: model.arrivalStation
46 departureStation: model.departureStation
48 actualPlatform: model.actualPlatform
49 expectedPlatfrom: model.expectedPlatform
54 anchors.centerIn: parent
56 size: BusyIndicatorSize.Large
63 spacing: Theme.paddingLarge
65 textFormat: Text.StyledText
66 wrapMode: Text.WordWrap
67 text: "<p>" + qsTr("Error!") + "</p><p>" + schedule.error + "</p>"
69 font.pixelSize: Theme.fontSizeHuge
70 horizontalAlignment: Text.AlignHCenter
79 target: stationScheduleView
94 target: stationScheduleView
102 target: busyIndicator
110 target: stationScheduleView
118 target: busyIndicator
124 function updateStation() {
125 view.state = "loading"
126 console.log("Updating station with " + schedule.name + ", " + schedule.code)
127 schedule.fetch(schedule.name, schedule.code)
129 StationScheduleModel {
131 onNameChanged: view.updateStation()
132 onLayoutChanged: if (error) view.state = "error"
133 else view.state = "ready"
136 Component.onCompleted: {
137 updateTimer.triggered.connect(view.updateStation)
138 view.state = "loading"