}
model: schedule
delegate: StationScheduleDelegate {
+ width: stationScheduleView.width
type: schedule.type
arrivalTime: model.arrivalTime
departureTime: model.departureTime
size: "large"
}
anchors.centerIn: parent
- visible: !stationScheduleView.visible
running: visible
}
+ Item {
+ id: errorDisplay
+ anchors.centerIn: parent
+ Column {
+ anchors.centerIn: parent
+ spacing: UiConstants.DefaultMargin
+ Text {
+ text: qsTr("Error")
+ font.pixelSize: UiConstants.HeaderFontPixelSize
+ font.bold: UiConstants.HeaderFontBoldness
+ horizontalAlignment: Text.AlignHCenter
+ }
+ Text {
+ text: schedule.error
+ font.pixelSize: UiConstants.DefaultFontBoldness
+ font.bold: UiConstants.DefaultFontBoldness
+ horizontalAlignment: Text.AlignHCenter
+ }
+ }
+ }
states: [
State {
name: "loading"
+ when: !completed
PropertyChanges {
target: stationScheduleView
visible: false
}
+ PropertyChanges {
+ target: errorDisplay
+ visible: false
+ }
+ PropertyChanges {
+ target: busyIndicator
+ visible: true
+ }
},
State {
name: "ready"
target: stationScheduleView
visible: true
}
+ PropertyChanges {
+ target: errorDisplay
+ visible: false
+ }
+ PropertyChanges {
+ target: busyIndicator
+ visible: false
+ }
+ },
+ State {
+ name: "error"
+ when: schedule.error
+ PropertyChanges {
+ target: stationScheduleView
+ visible: true
+ }
+ PropertyChanges {
+ target: errorDisplay
+ visible: false
+ }
+ PropertyChanges {
+ target: busyIndicator
+ visible: false
+ }
}
]
}
StationScheduleModel {
id: schedule
onNameChanged: updateStation()
- onLayoutChanged: view.state = "ready"
+ onLayoutChanged: if (error) view.state = "error"
+ else view.state = "ready"
}
Component.onCompleted: {
updateTimer.timeout.connect(updateStation)
+ view.state = "loading"
}
function updateStation() {
console.log("Updating station with " + schedule.name + ", " + schedule.code)
property string actualPlatform
property string expectedPlatfrom
- height: UiConstants.ListItemHeightDefault
- width: parent.width
+ implicitHeight: UiConstants.ListItemHeightLarge
+ height: UiConstants.ListItemHeightLarge
BorderImage {
id: background
anchors.fill: parent
visible: mouseArea.pressed
source: "image://theme/meegotouch-list-background-pressed-center"
}
- Row {
+ Item {
id: bodyRow
- anchors.fill: parent
- spacing: UiConstants.ButtonSpacing
+ anchors {
+ fill: parent
+ margins: UiConstants.ButtonSpacing
+ }
DelayIndicator {
+ id: indicator
+ anchors {
+ top: parent.top
+ left: parent.left
+ }
level: delayClass
}
- Column {
- anchors.verticalCenter: parent.verticalCenter
+ Item {
+ anchors {
+ left: indicator.right
+ right: bodyRow.right
+ margins: UiConstants.ButtonSpacing
+ }
+ height: UiConstants.TitleFontPixelSize
Row {
+ id: firstRow
+ anchors.top: parent.top
spacing: UiConstants.ButtonSpacing
Label {
id: arrivalTimeLabel
- font.bold: UiConstants.SpecialFontBoldness
- font.pixelSize: UiConstants.SpecialFontPixelSize
+ font.bold: UiConstants.TitleFontBoldness
+ font.pixelSize: UiConstants.TitleFontPixelSize
visible: type === StationScheduleModel.ArrivalSchedule
}
Label {
id: departureTimeLabel
- font.bold: UiConstants.SpecialFontBoldness
- font.pixelSize: UiConstants.SpecialFontPixelSize
+ font.bold: UiConstants.TitleFontBoldness
+ font.pixelSize: UiConstants.TitleFontPixelSize
visible: type === StationScheduleModel.DepartureSchedule
}
Label {
id: trainLabel
- font.bold: UiConstants.SpecialFontBoldness
- font.pixelSize: UiConstants.SpecialFontPixelSize
+ font.bold: UiConstants.TitleFontBoldness
+ font.pixelSize: UiConstants.TitleFontPixelSize
color: UiConstants.AccentColor
}
}
- Label {
- text: qsTr("from %1").arg(root.arrivalStation)
- font.bold: UiConstants.DefaultFontBoldness
- font.pixelSize: UiConstants.DefaultFontPixelSize
- visible: type === StationScheduleModel.ArrivalSchedule
- }
- Label {
- text: qsTr("to %1").arg(root.departureStation)
- font.bold: UiConstants.DefaultFontBoldness
- font.pixelSize: UiConstants.DefaultFontPixelSize
- visible: type === StationScheduleModel.DepartureSchedule
+ Item {
+ id: secondRow
+ height: UiConstants.DefaultFontPixelSize
+ anchors.top: firstRow.bottom
+ Label {
+ text: qsTr("from %1").arg(root.arrivalStation)
+ font.bold: UiConstants.DefaultFontBoldness
+ font.pixelSize: UiConstants.DefaultFontPixelSize
+ visible: type === StationScheduleModel.ArrivalSchedule
+ }
+ Label {
+ text: qsTr("to %1").arg(root.departureStation)
+ font.bold: UiConstants.DefaultFontBoldness
+ font.pixelSize: UiConstants.DefaultFontPixelSize
+ visible: type === StationScheduleModel.DepartureSchedule
+ }
}
- Label {
- id: delayLabel
- font.bold: UiConstants.SubtitleFontBoldness
- font.pixelSize: UiConstants.SubtitleFontPixelSize
+ Item {
+ height: UiConstants.SubtitleFontPixelSize
+ anchors {
+ top: secondRow.bottom
+ left: parent.left
+ right: parent.right
+ }
+ Label {
+ id: delayLabel
+ anchors.top: parent.top
+ font.bold: UiConstants.SubtitleFontBoldness
+ font.pixelSize: UiConstants.SubtitleFontPixelSize
+ }
+ Label {
+ anchors {
+ top: parent.top
+ right: parent.right
+ rightMargin: UiConstants.DefaultMargin
+ }
+ text: displayPlatform(root.expectedPlatfrom, root.actualPlatform)
+ font.bold: UiConstants.SubtitleFontBoldness
+ font.pixelSize: UiConstants.SubtitleFontPixelSize
+ }
}
}
}
- Label {
- anchors {
- bottom: bodyRow.bottom
- right: bodyRow.right
- rightMargin: UiConstants.DefaultMargin
- }
- text: displayPlatform(root.expectedPlatfrom, root.actualPlatform)
- font.bold: UiConstants.SubtitleFontBoldness
- font.pixelSize: UiConstants.SubtitleFontPixelSize
- }
Image {
anchors {
+ leftMargin: UiConstants.DefaultMargin
+ rightMargin: UiConstants.DefaultMargin
left: parent.left
right: parent.right
}