summaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-11-08 16:58:33 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-11-18 16:50:09 -0800
commit6b283e598a3a08c6133d66b5d5617370296e7d0e (patch)
tree685ccf1fd839d72471b179bf12aa72d2bdcec7de /qt-models/divetripmodel.cpp
parentbc7afebc23477ef23f2b9741bf45b2180cbafe15 (diff)
downloadsubsurface-6b283e598a3a08c6133d66b5d5617370296e7d0e.tar.gz
Dive list: replace dive-list of trips by a table
The dives of each trip were kept in a list. Replace this by a struct dive_table. This will make it significantly easier to keep the dives of a trip in sorted state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r--qt-models/divetripmodel.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index 7c5bb4efb..6eadbbb24 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -57,20 +57,19 @@ QVariant DiveTripModel::tripData(const dive_trip *trip, int column, int role)
switch (column) {
case DiveTripModel::NR:
QString shownText;
- struct dive *d = trip->dives;
int countShown = 0;
- while (d) {
+ for (int i = 0; i < trip->dives.nr; ++i) {
+ struct dive *d = trip->dives.dives[i];
if (!d->hidden_by_filter)
countShown++;
oneDayTrip &= is_same_day (trip->when, d->when);
- d = d->next;
}
- if (countShown < trip->nrdives)
+ if (countShown < trip->dives.nr)
shownText = tr("(%1 shown)").arg(countShown);
if (!empty_string(trip->location))
- return QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + " "+ shownText;
+ return QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->dives.nr, oneDayTrip) + " "+ shownText;
else
- return get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + shownText;
+ return get_trip_date_string(trip->when, trip->dives.nr, oneDayTrip) + shownText;
}
}