+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Page {
+ id: journeyInfoPage
+ property string title: "Journey info"
+ property var start: new Date()
+ property int duration: 0
+ property int overtook: -1
+ property int overtakenby: -1
+ property int index: -1
+
+ onDurationChanged: {
+ var structured = new Date(0, 0, 0, 0, parseInt(duration / 60))
+ durationTime.value = Qt.formatTime(structured, 'hh:mm')
+ endTime.time = new Date(0, 0, 0, start.getHours() + structured.getHours(), start.getMinutes() + structured.getMinutes())
+ }
+
+ onStartChanged: {
+ startDate.value = Qt.formatDate(start, 'd MMM yyyy')
+ startTime.value = Qt.formatTime(start, 'hh:mm')
+
+ var structured = new Date(0, 0, 0, 0, parseInt(duration / 60))
+ endTime.time = new Date(0, 0, 0, start.getHours() + structured.getHours(), start.getMinutes() + structured.getMinutes())
+ }
+
+ // The effective value will be restricted by ApplicationWindow.allowedOrientations
+ allowedOrientations: Orientation.All
+
+ SilicaFlickable {
+ id: journeyEditView
+ anchors.fill: parent
+ contentHeight: journeyEditColumn.implicitHeight
+
+ VerticalScrollDecorator {}
+
+ Column {
+ id: journeyEditColumn
+ spacing: Theme.paddingMedium
+ width: parent.width
+
+ PageHeader {
+ title: journeyInfoPage.title
+ }
+
+ ValueButton {
+ id: startDate
+ label: "Date"
+ value: Qt.formatDate(start, 'd MMM yyyy')
+ width: parent.width
+ enabled: false
+ }
+
+ ValueButton {
+ id: startTime
+ label: qsTr("Start time")
+ value: Qt.formatTime(start, 'hh:mm')
+ width: parent.width
+ enabled: false
+ }
+
+ ValueButton {
+ id: endTime
+ property date time: new Date()
+ label: qsTr("End time")
+ value: Qt.formatTime(time, 'hh:mm')
+ width: parent.width
+ enabled: false
+ onTimeChanged: {
+ value = Qt.formatTime(time, 'hh:mm')
+ }
+ }
+
+ ValueButton {
+ id: durationTime
+ label: qsTr("Duration")
+ value: Qt.formatTime(new Date(0, 0, 0, 0, parseInt(duration / 60)), 'hh:mm')
+ width: parent.width
+ enabled: false
+ }
+
+ TextField {
+ id: faster
+ width: parent.width
+ inputMethodHints: Qt.ImhDigitsOnly
+ label: qsTr("Cycles which you overtook")
+ placeholderText: label
+ text: overtook >= 0 ? "" + overtook : ""
+ horizontalAlignment: TextInput.AlignLeft
+ EnterKey.iconSource: "image://theme/icon-m-enter-next"
+ enabled: false
+ }
+
+ TextField {
+ id: slower
+ width: parent.width
+ inputMethodHints: Qt.ImhDigitsOnly
+ label: qsTr("Cycles which overtook you")
+ placeholderText: label
+ text: overtakenby >= 0 ? "" + overtakenby : ""
+ horizontalAlignment: TextInput.AlignLeft
+ EnterKey.iconSource: "image://theme/icon-m-enter-next"
+ enabled: false
+ }
+ }
+ }
+}