mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
bc7afebc23
commit
6b283e598a
9 changed files with 63 additions and 80 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue