diff options
author | Grace Karanja <gracie.karanja89@gmail.com> | 2015-02-09 09:44:10 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-09 21:02:19 -0800 |
commit | d60a6201931ed11e019e7582a6d6f72d6f4e0400 (patch) | |
tree | 39d99b9267d924ca97bfe8435c56aa640e03fe3e /qt-ui/undobuffer.h | |
parent | 8d1e4557a96f81a4cf263ea3d4e2228222d99e42 (diff) | |
download | subsurface-d60a6201931ed11e019e7582a6d6f72d6f4e0400.tar.gz |
Add ability to undo deleted dives
Before the dive is deleted, a copy is made and passed to the
undo buffer. When edit->undo is clicked, this dive is restored
to the dive list.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/undobuffer.h')
-rw-r--r-- | qt-ui/undobuffer.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qt-ui/undobuffer.h b/qt-ui/undobuffer.h index beae8e390..9fac14710 100644 --- a/qt-ui/undobuffer.h +++ b/qt-ui/undobuffer.h @@ -12,7 +12,7 @@ private: public: explicit UndoCommand(QString commandName, dive* affectedDive); - void setStateAfter(dive* affectedDive); + void setStateAfter(dive* affectedDive) { stateAfter = affectedDive; } void undo(); void redo(); }; @@ -25,7 +25,9 @@ public: ~UndoBuffer(); bool canUndo(); bool canRedo(); + UndoCommand *current() const { return list.at(curIdx - 1); } private: + QList<UndoCommand*> list; int curIdx; public slots: void redo(); |