diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-11-09 16:41:45 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-11-18 16:50:09 -0800 |
commit | ef98a4ff5ad05b3a1fc51ffb5996d49d1c462a75 (patch) | |
tree | 06294189116ec9786df8d355597cb50310f2c203 /desktop-widgets | |
parent | 9d3a5fa99769d4381f622b97f7776f747a7e562e (diff) | |
download | subsurface-ef98a4ff5ad05b3a1fc51ffb5996d49d1c462a75.tar.gz |
Dive list: keep dives-in-trip list ordered after shift-times
On shift-times, the list of dives in a trip may become disordered.
Reestablish order with sort_table().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/command_divelist.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp index d5fbc2139..2c474cf94 100644 --- a/desktop-widgets/command_divelist.cpp +++ b/desktop-widgets/command_divelist.cpp @@ -605,15 +605,17 @@ void ShiftTime::redoit() // Changing times may have unsorted the dive table sort_table(&dive_table); - // We send one dives-deleted signal per trip (see comments in DiveListNotifier.h). - // Therefore, collect all dives in a array and sort by trip. + // We send one time changed signal per trip (see comments in DiveListNotifier.h). + // Therefore, collect all dives in an array and sort by trip. std::vector<std::pair<dive_trip *, dive *>> dives; dives.reserve(diveList.size()); for (dive *d: diveList) dives.push_back({ d->divetrip, d }); - // Send signals. + // Send signals and sort tables. processByTrip(dives, [&](dive_trip *trip, const QVector<dive *> &divesInTrip) { + if (trip) + sort_table(&trip->dives); // Keep the trip-table in order emit diveListNotifier.divesTimeChanged(trip, timeChanged, divesInTrip); }); |