Skip to content

Commit

Permalink
Keep track of "favorite routes" through long-press.
Browse files Browse the repository at this point in the history
This might need some more UI work.
Related to iRail#14 in function of iRail#44
  • Loading branch information
rubdos committed Dec 7, 2019
1 parent 9b64d39 commit 656987e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions qml/components/TripDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ListItem {
anchors.fill: parent
z: 1
onClicked: _showVias == true? _showVias = false: _showVias = true
onPressAndHold: app.toggleTracked(model)
enabled: vias.count() > 0
}

Expand Down
16 changes: 16 additions & 0 deletions qml/harbour-berail.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ ApplicationWindow
readonly property real fadeInValue: 1.0
readonly property real fadeSeeThroughValue: 0.7

property var trackedRoutes: ({});

// App settings
ConfigurationGroup {
id: settings
Expand Down Expand Up @@ -112,5 +114,19 @@ ApplicationWindow
}
}
}

function toggleTracked(model) {
console.debug("toggle tracked route" + model)
if (trackedRoutes[model.id] === undefined) {
console.debug("Adding to tracked routes")
sfos.createToaster("Added to tracked routes", "icon-s-new", "x-harbour-berail")
trackedRoutes[model.id] = model;
} else {
console.debug("Deleting from tracked routes")
sfos.createToaster("Deleted from tracked routes", "icon-m-input-remove", "x-harbour-berail")
trackedRoutes[model.id] = undefined;
}
console.log("tracked routes:", trackedRoutes);
}
}

0 comments on commit 656987e

Please sign in to comment.