mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn trip-table into our own sorted_owning_table
Since the sorted_owning_table depends on the fact that different elements never compare as equal, make the comparison function safer in that respect. If all failes, compare the pointers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1cebafb08f
commit
eacad89531
21 changed files with 217 additions and 305 deletions
|
@ -74,8 +74,8 @@ struct TripWrapper {
|
|||
QString name;
|
||||
timestamp_t date;
|
||||
TripWrapper(const dive_trip *t) : t(t),
|
||||
name(formatTripTitle(t)), // safe to pass null
|
||||
date(trip_date(t)) // safe to pass null
|
||||
name(t ? formatTripTitle(*t) : QString()),
|
||||
date(t ? trip_date(*t) : 0)
|
||||
{
|
||||
}
|
||||
bool operator<(const TripWrapper &t2) const {
|
||||
|
@ -1868,7 +1868,7 @@ struct TripVariable : public StatsVariableTemplate<StatsVariable::Type::Discrete
|
|||
return StatsTranslations::tr("Dive trip");
|
||||
}
|
||||
QString diveCategories(const dive *d) const override {
|
||||
return formatTripTitle(d->divetrip);
|
||||
return d->divetrip ? formatTripTitle(*d->divetrip) : QString();
|
||||
}
|
||||
std::vector<const StatsBinner *> binners() const override {
|
||||
return { &trip_binner };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue