Improved platform display
authorLuciano Montanaro <mikelima@cirulla.net>
Thu, 12 Jan 2012 22:28:19 +0000 (23:28 +0100)
committerLuciano Montanaro <mikelima@cirulla.net>
Thu, 12 Jan 2012 22:28:19 +0000 (23:28 +0100)
application/resources/harmattan/qml/StationScheduleDelegate.qml

index 366be29..79b3981 100644 (file)
@@ -80,8 +80,7 @@ Item {
             right: bodyRow.right
             rightMargin: UiConstants.DefaultMargin
         }
-        text: qsTr("Platform %1").arg((root.actualPlatform === "--") ? root.expectedPlatfrom : root.actualPlatform)
-        color: root.actualPlatform === "--" ? "#ddd" : UiConstants.AccentColor
+        text: displayPlatform(root.expectedPlatfrom, root.actualPlatform)
         font.bold: UiConstants.SubtitleFontBoldness
         font.pixelSize: UiConstants.SubtitleFontPixelSize
     }
@@ -101,4 +100,16 @@ Item {
             console.log(settings.queryBaseUrl + "/" + detailsUrl)
         }
     }
+    function displayPlatform(expected, actual)
+    {
+        if (actual === "--") {
+            return qsTr("Platform %1").arg(expected)
+        } else if (actual === expected || expected === "--") {
+            return qsTr("Platform <span style='font-weight:bold;color:#080'>%2</span>").arg(actual)
+        } else {
+            return qsTr("Platform " +
+                        "<span style='text-decoration:line-through'>%1</span> " +
+                        "<span style='font-weight:bold;color:#800'>%2</span>").arg(expected).arg(actual)
+        }
+    }
 }