Page {
id: page
- property bool cycling: false
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
Button {
anchors.horizontalCenter: parent.horizontalCenter
- text: cycling ? qsTr("Finish") : qsTr("Start a journey")
+ text: currentStatus.cycling ? qsTr("Finish") : qsTr("Start a journey")
onClicked: {
- if (cycling) {
- var dialog = pageStack.push(Qt.resolvedUrl("AddJourney.qml"))
+ if (currentStatus.cycling) {
+ var dialog = pageStack.push(Qt.resolvedUrl("AddJourney.qml"), {title: "Finish journey", start: journeymodel.epochToDateTime(currentStatus.startTime), duration: currentStatus.getDuration()})
dialog.accepted.connect(function() {
- cycling = false
+ currentStatus.cycling = false
})
}
else {
- cycling = true
+ currentStatus.startJourney()
}
}
}