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
60 anchors.centerIn: parent
62 anchors.centerIn: parent
63 spacing: Theme.paddingLarge
67 font.pixelSize: Theme.fontSizeHuge
68 horizontalAlignment: Text.AlignHCenter
73 font.pixelSize: Theme.fontSizeHuge
74 horizontalAlignment: Text.AlignHCenter
83 target: stationScheduleView
98 target: stationScheduleView
106 target: busyIndicator
114 target: stationScheduleView
122 target: busyIndicator
128 function updateStation() {
129 view.state = "loading"
130 console.log("Updating station with " + schedule.name + ", " + schedule.code)
131 schedule.fetch(schedule.name, schedule.code)
133 StationScheduleModel {
135 onNameChanged: view.updateStation()
136 onLayoutChanged: if (error) view.state = "error"
137 else view.state = "ready"
140 Component.onCompleted: {
141 updateTimer.triggered.connect(view.updateStation)
142 view.state = "loading"