translations/*.ts \
harbour-pedalo.desktop \
qml/pages/MainPage.qml \
- qml/pages/AddJourney.qml \
qml/pages/Stats.qml \
qml/pages/JourneyList.qml \
qml/pages/About.qml \
qml/pages/DurationEditDialog.qml \
- qml/components/InfoRow.qml
+ qml/components/InfoRow.qml \
+ qml/pages/JourneyEdit.qml
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
+++ /dev/null
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-
-Dialog {
- id: addJourneyDialog
- canAccept: true
- property string title: "Add journey"
- 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: addJourneyView
- anchors.fill: parent
- contentHeight: addJourneyColumn.implicitHeight
-
- VerticalScrollDecorator {}
-
- Column {
- id: addJourneyColumn
- spacing: Theme.paddingMedium
- width: parent.width
-
- DialogHeader {
- title: addJourneyDialog.title
- }
-
- ValueButton {
- id: startDate
- label: "Date"
- value: Qt.formatDate(start, 'd MMM yyyy')
- width: parent.width
- onClicked: {
- var dialog = pageStack.push("Sailfish.Silica.DatePickerDialog", { date: start })
- dialog.accepted.connect(function() {
- start = new Date(dialog.year, dialog.month - 1, dialog.day, start.getHours(), start.getMinutes())
- })
- }
- }
-
- ValueButton {
- id: startTime
- label: qsTr("Start time")
- value: Qt.formatTime(start, 'hh:mm')
- width: parent.width
- onClicked: {
- var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", { hour: start.getHours(), minute: start.getMinutes()})
- dialog.accepted.connect(function() {
- start = new Date(start.getFullYear(), start.getMonth(), start.getDate(), dialog.hour, dialog.minute)
- })
- }
- }
-
- ValueButton {
- id: endTime
- property date time: new Date()
- label: qsTr("End time")
- value: Qt.formatTime(time, 'hh:mm')
- width: parent.width
- onClicked: {
- var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", { hour: time.getHours(), minute: time.getMinutes()})
- dialog.accepted.connect(function() {
- // We have to hack around the fact that % in Javascript is 'remainder' and not 'mod' (hence will happpily return negative numbers)
- duration = ((((((dialog.hour - start.getHours()) * 60) + (dialog.minute - start.getMinutes())) * 60) % 86400) + 86400) % 86400
- // Updating the duration will automatically trigger the end time to be udpated
- })
- }
- 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
- onClicked: {
- var dialog = pageStack.push("DurationEditDialog.qml", { hour: parseInt(duration / (60 * 60)), minute: parseInt(duration / 60) % 60})
- dialog.accepted.connect(function() {
- duration = ((dialog.hour * 60) + dialog.minute) * 60
- })
- }
- }
-
- 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"
- EnterKey.onClicked: slower.focus = true
- }
-
- 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"
- EnterKey.onClicked: addJourneyDialog.accept()
- }
- }
- }
-
- onAccepted: {
- var overtook = parseInt(faster.text)
- var overtakenby = parseInt(slower.text)
- if (index < 0) {
- journeymodel.addJourney(start, duration, overtook, overtakenby)
- }
- else {
- journeymodel.editJourney(index, start, duration, overtook, overtakenby)
- }
- }
-}
--- /dev/null
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Dialog {
+ id: journeyEditDialog
+ canAccept: true
+ property string title: "Add journey"
+ 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
+
+ DialogHeader {
+ title: journeyEditDialog.title
+ }
+
+ ValueButton {
+ id: startDate
+ label: "Date"
+ value: Qt.formatDate(start, 'd MMM yyyy')
+ width: parent.width
+ onClicked: {
+ var dialog = pageStack.push("Sailfish.Silica.DatePickerDialog", { date: start })
+ dialog.accepted.connect(function() {
+ start = new Date(dialog.year, dialog.month - 1, dialog.day, start.getHours(), start.getMinutes())
+ })
+ }
+ }
+
+ ValueButton {
+ id: startTime
+ label: qsTr("Start time")
+ value: Qt.formatTime(start, 'hh:mm')
+ width: parent.width
+ onClicked: {
+ var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", { hour: start.getHours(), minute: start.getMinutes()})
+ dialog.accepted.connect(function() {
+ start = new Date(start.getFullYear(), start.getMonth(), start.getDate(), dialog.hour, dialog.minute)
+ })
+ }
+ }
+
+ ValueButton {
+ id: endTime
+ property date time: new Date()
+ label: qsTr("End time")
+ value: Qt.formatTime(time, 'hh:mm')
+ width: parent.width
+ onClicked: {
+ var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", { hour: time.getHours(), minute: time.getMinutes()})
+ dialog.accepted.connect(function() {
+ // We have to hack around the fact that % in Javascript is 'remainder' and not 'mod' (hence will happpily return negative numbers)
+ duration = ((((((dialog.hour - start.getHours()) * 60) + (dialog.minute - start.getMinutes())) * 60) % 86400) + 86400) % 86400
+ // Updating the duration will automatically trigger the end time to be udpated
+ })
+ }
+ 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
+ onClicked: {
+ var dialog = pageStack.push("DurationEditDialog.qml", { hour: parseInt(duration / (60 * 60)), minute: parseInt(duration / 60) % 60})
+ dialog.accepted.connect(function() {
+ duration = ((dialog.hour * 60) + dialog.minute) * 60
+ })
+ }
+ }
+
+ 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"
+ EnterKey.onClicked: slower.focus = true
+ }
+
+ 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"
+ EnterKey.onClicked: journeyEditDialog.accept()
+ }
+ }
+ }
+
+ onAccepted: {
+ var overtook = parseInt(faster.text)
+ var overtakenby = parseInt(slower.text)
+ if (index < 0) {
+ journeymodel.addJourney(start, duration, overtook, overtakenby)
+ }
+ else {
+ journeymodel.editJourney(index, start, duration, overtook, overtakenby)
+ }
+ }
+}
color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
}
}
- onClicked: pageStack.push(Qt.resolvedUrl("AddJourney.qml"), {title: "Edit journey", index: index, start: journeymodel.epochToDateTime(start), duration: duration, overtook: overtook, overtakenby: overtakenby})
+ onClicked: pageStack.push(Qt.resolvedUrl("JourneyEdit.qml"), {title: "Edit journey", index: index, start: journeymodel.epochToDateTime(start), duration: duration, overtook: overtook, overtakenby: overtakenby})
Component {
id: journeyMenuComponent
ContextMenu {
MenuItem {
text: qsTr("Edit")
- onClicked: pageStack.push(Qt.resolvedUrl("AddJourney.qml"), {title: "Edit journey", index: index, start: journeymodel.epochToDateTime(start), duration: duration, overtook: overtook, overtakenby: overtakenby})
+ onClicked: pageStack.push(Qt.resolvedUrl("JourneyEdit.qml"), {title: "Edit journey", index: index, start: journeymodel.epochToDateTime(start), duration: duration, overtook: overtook, overtakenby: overtakenby})
}
MenuItem {
text: qsTr("Delete")
text: currentStatus.cycling ? qsTr("Finish") : qsTr("Start a journey")
onClicked: {
if (currentStatus.cycling) {
- var dialog = pageStack.push(Qt.resolvedUrl("AddJourney.qml"), {title: "Finish journey", start: journeymodel.epochToDateTime(currentStatus.startTime), duration: currentStatus.getDuration()})
+ var dialog = pageStack.push(Qt.resolvedUrl("JourneyEdit.qml"), {title: "Finish journey", start: journeymodel.epochToDateTime(currentStatus.startTime), duration: currentStatus.getDuration()})
dialog.accepted.connect(function() {
currentStatus.cycling = false
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Enter journey")
- onClicked: pageStack.push(Qt.resolvedUrl("AddJourney.qml"))
+ onClicked: pageStack.push(Qt.resolvedUrl("JourneyEdit.qml"))
}
SectionHeader {
</message>
</context>
<context>
- <name>AddJourney</name>
+ <name>CoverPage</name>
<message>
- <source>Start time</source>
- <translation type="unfinished"></translation>
+ <source>My Cover</source>
+ <translation>Mein Cover</translation>
</message>
+</context>
+<context>
+ <name>DurationEditDialog</name>
<message>
- <source>End time</source>
+ <source>LTR</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Duration</source>
+ <source>h</source>
+ <extracomment>"Hour abbrevation. Should be short form if possible."</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Cycles which you overtook</source>
+ <source>min</source>
+ <extracomment>"Minute abbrevation. Should be short form if possible."</extracomment>
<translation type="unfinished"></translation>
</message>
+</context>
+<context>
+ <name>JourneyEdit</name>
<message>
- <source>Cycles which overtook you</source>
+ <source>Start time</source>
<translation type="unfinished"></translation>
</message>
-</context>
-<context>
- <name>CoverPage</name>
<message>
- <source>My Cover</source>
- <translation>Mein Cover</translation>
+ <source>End time</source>
+ <translation type="unfinished"></translation>
</message>
-</context>
-<context>
- <name>DurationEditDialog</name>
<message>
- <source>LTR</source>
+ <source>Duration</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>h</source>
- <extracomment>"Hour abbrevation. Should be short form if possible."</extracomment>
+ <source>Cycles which you overtook</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>min</source>
- <extracomment>"Minute abbrevation. Should be short form if possible."</extracomment>
+ <source>Cycles which overtook you</source>
<translation type="unfinished"></translation>
</message>
</context>
</message>
</context>
<context>
- <name>AddJourney</name>
+ <name>CoverPage</name>
<message>
- <source>Start time</source>
+ <source>My Cover</source>
<translation type="unfinished"></translation>
</message>
+</context>
+<context>
+ <name>DurationEditDialog</name>
<message>
- <source>End time</source>
+ <source>LTR</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Duration</source>
+ <source>h</source>
+ <extracomment>"Hour abbrevation. Should be short form if possible."</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Cycles which you overtook</source>
+ <source>min</source>
+ <extracomment>"Minute abbrevation. Should be short form if possible."</extracomment>
<translation type="unfinished"></translation>
</message>
+</context>
+<context>
+ <name>JourneyEdit</name>
<message>
- <source>Cycles which overtook you</source>
+ <source>Start time</source>
<translation type="unfinished"></translation>
</message>
-</context>
-<context>
- <name>CoverPage</name>
<message>
- <source>My Cover</source>
+ <source>End time</source>
<translation type="unfinished"></translation>
</message>
-</context>
-<context>
- <name>DurationEditDialog</name>
<message>
- <source>LTR</source>
+ <source>Duration</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>h</source>
- <extracomment>"Hour abbrevation. Should be short form if possible."</extracomment>
+ <source>Cycles which you overtook</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>min</source>
- <extracomment>"Minute abbrevation. Should be short form if possible."</extracomment>
+ <source>Cycles which overtook you</source>
<translation type="unfinished"></translation>
</message>
</context>