mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/divelist: implement model that shows all dives in trip-order
MobileSwipeModel is probably not an ideal name, but all I could come up with. One of the main complications here is that our list is reversed with respect to the source model. We should change that one day. Probably by moving the sorting down to the core-model. Since looking up the source row is somewhat expensive, the lookup is cached for a single entry because accesses come in bursts for a single dive. This should be a good compromise and avoids keeping track of a full row-to-dive array. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
71b378aa82
commit
c34b7857fc
4 changed files with 449 additions and 5 deletions
|
@ -230,7 +230,7 @@ Kirigami.Page {
|
|||
}
|
||||
|
||||
function showDiveIndex(id) {
|
||||
currentIndex = diveModel.getIdxForId(id);
|
||||
currentIndex = swipeModel.getIdxForId(id);
|
||||
diveDetailsListView.positionViewAtIndex(currentIndex, ListView.End);
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ Kirigami.Page {
|
|||
ListView {
|
||||
id: diveDetailsListView
|
||||
anchors.fill: parent
|
||||
model: diveModel
|
||||
model: swipeModel
|
||||
currentIndex: -1
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
maximumFlickVelocity: parent.width * 5
|
||||
|
@ -335,7 +335,7 @@ Kirigami.Page {
|
|||
}
|
||||
ScrollIndicator.horizontal: ScrollIndicator { }
|
||||
Connections {
|
||||
target: diveModel
|
||||
target: swipeModel
|
||||
onCurrentDiveChanged: {
|
||||
currentIndex = index.row
|
||||
diveDetailsListView.positionViewAtIndex(currentIndex, ListView.End)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue