3 import com.nokia.meego 1.0
4 import net.cirulla.quandoparte 1.0
5 import "uiconstants.js" as UiConstants
10 property alias arrivalTime: arrivalTimeLabel.text
11 property alias departureTime: departureTimeLabel.text
12 property alias train: trainLabel.text
13 property string arrivalStation
14 property string departureStation
15 property alias delay: delayLabel.text
16 property string actualPlatform
17 property string expectedPlatfrom
19 implicitHeight: UiConstants.ListItemHeightLarge
20 height: UiConstants.ListItemHeightLarge
25 visible: mouseArea.pressed
26 source: "image://theme/meegotouch-list-background-pressed-center"
32 margins: UiConstants.ButtonSpacing
46 margins: UiConstants.ButtonSpacing
48 height: UiConstants.TitleFontPixelSize
51 anchors.top: parent.top
52 spacing: UiConstants.ButtonSpacing
55 font.bold: UiConstants.TitleFontBoldness
56 font.pixelSize: UiConstants.TitleFontPixelSize
57 visible: type === StationScheduleModel.ArrivalSchedule
60 id: departureTimeLabel
61 font.bold: UiConstants.TitleFontBoldness
62 font.pixelSize: UiConstants.TitleFontPixelSize
63 visible: type === StationScheduleModel.DepartureSchedule
67 font.bold: UiConstants.TitleFontBoldness
68 font.pixelSize: UiConstants.TitleFontPixelSize
69 color: UiConstants.AccentColor
74 height: UiConstants.DefaultFontPixelSize
75 anchors.top: firstRow.bottom
77 text: qsTr("from %1").arg(root.arrivalStation)
78 font.bold: UiConstants.DefaultFontBoldness
79 font.pixelSize: UiConstants.DefaultFontPixelSize
80 visible: type === StationScheduleModel.ArrivalSchedule
83 text: qsTr("to %1").arg(root.departureStation)
84 font.bold: UiConstants.DefaultFontBoldness
85 font.pixelSize: UiConstants.DefaultFontPixelSize
86 visible: type === StationScheduleModel.DepartureSchedule
90 height: UiConstants.SubtitleFontPixelSize
98 anchors.top: parent.top
99 font.bold: UiConstants.SubtitleFontBoldness
100 font.pixelSize: UiConstants.SubtitleFontPixelSize
106 rightMargin: UiConstants.DefaultMargin
108 text: displayPlatform(root.expectedPlatfrom, root.actualPlatform)
109 font.bold: UiConstants.SubtitleFontBoldness
110 font.pixelSize: UiConstants.SubtitleFontPixelSize
117 leftMargin: UiConstants.DefaultMargin
118 rightMargin: UiConstants.DefaultMargin
122 source: "image://theme/meegotouch-separator-background-horizontal"
126 anchors.fill: background
128 // Load an external page about the train, for now
129 Qt.openUrlExternally(settings.queryBaseUrl + "/" + detailsUrl)
130 console.log(settings.queryBaseUrl + "/" + detailsUrl)
133 function displayPlatform(expected, actual)
135 if (actual === "--") {
136 return qsTr("Platform %1").arg(expected)
137 } else if (actual === expected || expected === "--") {
138 return qsTr("Platform <span style='font-weight:bold;color:#080'>%2</span>").arg(actual)
140 return qsTr("Platform " +
141 "<span style='text-decoration:line-through'>%1</span> " +
142 "<span style='font-weight:bold;color:#800'>%2</span>").arg(expected).arg(actual)