mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: make diverse trip-related operations undo-able
AddDivesToTrip, CreateTrip, AutogroupDives, RemoveAutogenTrips and MergeTrips basically all did the same thing as RemoveDivesFromTrip, which was already implemented. Thus, factor our the common functionality and hook it up to make all these functions undo-able. Don't do the autogroup-call everytime the dive-list is rebuilt (that would create innumberable undo-actions), but only on dive-load / import or if expressly asked by the user [by switching the autogroup flag]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
4fbb8ef399
commit
f427226b3b
11 changed files with 296 additions and 76 deletions
|
@ -643,8 +643,6 @@ void DiveTripModel::setupModelData()
|
|||
|
||||
beginResetModel();
|
||||
|
||||
if (autogroup)
|
||||
autogroup_dives();
|
||||
items.clear();
|
||||
while (--i >= 0) {
|
||||
dive *d = get_dive(i);
|
||||
|
@ -665,7 +663,6 @@ void DiveTripModel::setupModelData()
|
|||
if (it == items.end()) {
|
||||
// We didn't find an entry for this trip -> add one
|
||||
items.emplace_back(trip, d);
|
||||
|
||||
} else {
|
||||
// We found the trip -> simply add the dive
|
||||
it->dives.push_back(d);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue