Reqorked the QML to show the first schedules on the application cover.
Had to move a few things around as well.
import QtQuick 2.0
import Sailfish.Silica 1.0
+import net.cirulla.quandoparte 1.0
+import "../pages/components"
CoverBackground {
CoverPlaceholder {
- anchors.centerIn: parent
+ anchors.fill: parent
text: qsTr("Quando Parte")
icon.source: "/usr/share/icons/hicolor/86x86/apps/quandoparte.png"
+ visible: stationScheduleView.count === 0
+ }
+ SilicaListView {
+ id: stationScheduleView
+ anchors.fill: parent
+ model: schedule
+ delegate: StationScheduleDelegate {
+ width: stationScheduleView.width
+ compact: true
+ type: schedule.type
+ arrivalTime: model.arrivalTime
+ departureTime: model.departureTime
+ train: model.train
+ arrivalStation: model.arrivalStation
+ departureStation: model.departureStation
+ delay: model.delay
+ actualPlatform: model.actualPlatform
+ expectedPlatfrom: model.expectedPlatform
+ }
}
}
-
-
import QtQuick 2.0
import Sailfish.Silica 1.0
+import net.cirulla.quandoparte 1.0
import "pages"
ApplicationWindow {
id: updateTimer
interval: 120
}
+ StationScheduleModel {
+ id: schedule
+ }
}
stationListPage.stationView = view
pageStack.push(view)
- /*
- XXX Ugliness ahead! Changing the name triggers the station
- schedule to be fetched. So any extra data (the code specifically)
- must be set before changing the name.
- */
- if (code !== undefined) view.code = code
- view.name = name
+ if (code === undefined) {
+ code = ""
+ }
+ schedule.fetch(name, code)
}
else
console.log('Cannot load component: ' + component.errorString());
import "components"
Page {
- property alias name: schedule.name
- property alias code: schedule.code
-
SilicaFlickable {
id: view
pressDelay: 0
}
PageHeader {
id: header
- title: name
+ title: schedule.name
}
SilicaListView {
id: stationScheduleView
visible: true
}
},
- State {
+ State {
name: "ready"
PropertyChanges {
target: stationScheduleView
}
]
+ /*
StationScheduleModel {
id: schedule
onNameChanged: view.updateStation()
onLayoutChanged: if (error) view.state = "error"
else view.state = "ready"
}
-
+ */
+ Connections {
+ target: schedule
+ // onNameChanged: view.updateStation()
+ onLayoutChanged: if (schedule.error) view.state = "error"
+ else view.state = "ready"
+ }
Component.onCompleted: {
updateTimer.triggered.connect(view.updateStation)
view.state = "loading"