X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=qml%2Fpages%2FJourneyInfo.qml;fp=qml%2Fpages%2FJourneyInfo.qml;h=6b0377dce1cd6e58fbf537e8603f72fce70b6b99;hp=0000000000000000000000000000000000000000;hb=41bb8de4779e59d272f753bc53033bd467bff811;hpb=cc1952786f991bf5d584bbbffb554b0c40cec401 diff --git a/qml/pages/JourneyInfo.qml b/qml/pages/JourneyInfo.qml new file mode 100644 index 0000000..6b0377d --- /dev/null +++ b/qml/pages/JourneyInfo.qml @@ -0,0 +1,107 @@ +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 + } + } + } +}