3 import Sailfish.Silica 1.0
4 import net.cirulla.quandoparte 1.0
9 property alias arrivalTime: arrivalTimeLabel.text
10 property alias departureTime: departureTimeLabel.text
11 property alias train: trainLabel.text
12 property string arrivalStation
13 property string departureStation
14 property alias delay: delayLabel.text
15 property string actualPlatform
16 property string expectedPlatfrom
18 implicitHeight: Theme.itemSizeExtraLarge
19 height: Theme.itemSizeExtraLarge
24 margins: Theme.paddingSmall
34 leftMargin: Theme.paddingMedium
38 anchors.top: parent.top
39 spacing: Theme.paddingMedium
42 font.pixelSize: Theme.fontSizeMedium
43 visible: type === StationScheduleModel.ArrivalSchedule
46 id: departureTimeLabel
47 font.pixelSize: Theme.fontSizeMedium
48 visible: type === StationScheduleModel.DepartureSchedule
52 font.pixelSize: Theme.fontSizeMedium
53 color: Theme.highlightColor
58 height: Theme.fontSizeMedium
59 anchors.top: firstRow.bottom
61 text: qsTr("from %1").arg(root.arrivalStation)
62 font.pixelSize: Theme.fontSizeMedium
63 visible: type === StationScheduleModel.ArrivalSchedule
66 text: qsTr("to %1").arg(root.departureStation)
67 font.pixelSize: Theme.fontSizeMedium
68 visible: type === StationScheduleModel.DepartureSchedule
72 height: Theme.fontSizeSmall
80 anchors.top: parent.top
81 font.pixelSize: Theme.fontSizeSmall
87 rightMargin: Theme.paddingMedium
89 text: displayPlatform(root.expectedPlatfrom, root.actualPlatform)
90 font.pixelSize: Theme.fontSizeSmall
91 textFormat: Text.RichText
103 // Load an external page about the train, for now
104 Qt.openUrlExternally(settings.queryBaseUrl + "/" + detailsUrl)
105 console.log(settings.queryBaseUrl + "/" + detailsUrl)
107 function displayPlatform(expected, actual)
109 if (actual === "--") {
110 return qsTr("Platform %1").arg(expected)
111 } else if (actual === expected || expected === "--") {
112 return qsTr("Platform <span style='font-weight:bold;color:%2'>%1</span>").arg(actual).arg("#0f0")
114 return qsTr("Platform " +
115 "<span style='text-decoration:line-through'>%1</span> " +
116 "<span style='font-weight:bold;color:%3'>%2</span>").arg(expected).arg(actual).arg("#f00")