mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: make "move dive computer to front" undoable
Instead of the elegant solution that just modifies the dive, keep two copies and add either the old or the new copy. This is primitive, but it trivially keeps the dives in the right order. The order might change on renumbering the dive computers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f0307abf50
commit
eba6e76b96
7 changed files with 106 additions and 23 deletions
|
|
@ -236,6 +236,23 @@ public:
|
|||
SplitDiveComputer(dive *d, int dc_num);
|
||||
};
|
||||
|
||||
// When moving the dive computer to the front, we go the ineffective,
|
||||
// but easy way: We keep two full copies of the dive (before and after).
|
||||
// Removing and readding assures that the dive stays at the correct
|
||||
// position in the list (the dive computer list is used for sorting dives).
|
||||
class MoveDiveComputerToFront : public DiveListBase {
|
||||
public:
|
||||
MoveDiveComputerToFront(dive *d, int dc_num);
|
||||
private:
|
||||
void undoit() override;
|
||||
void redoit() override;
|
||||
bool workToBeDone() override;
|
||||
|
||||
// For redo and undo
|
||||
DivesAndTripsToAdd diveToAdd;
|
||||
DivesAndSitesToRemove diveToRemove;
|
||||
};
|
||||
|
||||
class MergeDives : public DiveListBase {
|
||||
public:
|
||||
MergeDives(const QVector<dive *> &dives);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue