mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: implement rudimentary support for undo of dive-merging
For this, an output-parameter was added to the backend merge_dives() function. When non-zero, instead of adding the merged dive to the preferred trip, the preferred trip is returned to the caller. Since the new UndoObject, just like the delete-dives UndoObject, needs to remove/readd a set of dives, the corresponding functionality was split-off in a helper function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
302f6adb79
commit
014c04f8bd
7 changed files with 220 additions and 50 deletions
|
|
@ -180,7 +180,7 @@ private:
|
|||
void redo() override;
|
||||
|
||||
// For redo
|
||||
QVector<struct dive*> divesToDelete;
|
||||
std::vector<struct dive*> divesToDelete;
|
||||
|
||||
std::vector<OwningTripPtr> tripsToAdd;
|
||||
std::vector<DiveToAdd> divesToAdd;
|
||||
|
|
@ -246,4 +246,25 @@ private:
|
|||
dive *divesToUnsplit[2];
|
||||
};
|
||||
|
||||
class UndoMergeDives : public QUndoCommand {
|
||||
public:
|
||||
UndoMergeDives(const QVector<dive *> &dives);
|
||||
private:
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
// For redo
|
||||
// Add one and remove a batch of dives
|
||||
DiveToAdd mergedDive;
|
||||
std::vector<dive *> divesToMerge;
|
||||
|
||||
// For undo
|
||||
// Remove one and add a batch of dives
|
||||
dive *diveToUnmerge;
|
||||
std::vector<DiveToAdd> unmergedDives;
|
||||
|
||||
// For undo and redo
|
||||
QVector<QPair<int, int>> divesToRenumber;
|
||||
};
|
||||
|
||||
#endif // UNDOCOMMANDS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue