summaryrefslogtreecommitdiffstats
path: root/qt-ui/undobuffer.h
diff options
context:
space:
mode:
authorGravatar Grace Karanja <gracie.karanja89@gmail.com>2015-02-11 09:10:34 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-11 07:59:46 -0800
commit013da6b0af3e3dd5d074f2dbbc342d9b948717b4 (patch)
tree4bc4cf314e0088f1c76736e45d3d7dcb817a0baf /qt-ui/undobuffer.h
parent6374d9cc0334c7dc7af908b4cb9233a091a48740 (diff)
downloadsubsurface-013da6b0af3e3dd5d074f2dbbc342d9b948717b4.tar.gz
Reverse undo buffer
Reverse all the code using the UndoBuffer class so that we can use the QUndoStack and QUndoCommand classes. These are Qt's own inbuild undo framework classes, offering a better undo/redo process. 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.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/qt-ui/undobuffer.h b/qt-ui/undobuffer.h
deleted file mode 100644
index 9fac14710..000000000
--- a/qt-ui/undobuffer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef UNDOBUFFER_H
-#define UNDOBUFFER_H
-
-#include <QObject>
-#include "dive.h"
-
-class UndoCommand {
-private:
- dive* stateBefore;
- dive* stateAfter;
- QString name;
-
-public:
- explicit UndoCommand(QString commandName, dive* affectedDive);
- void setStateAfter(dive* affectedDive) { stateAfter = affectedDive; }
- void undo();
- void redo();
-};
-
-class UndoBuffer : public QObject
-{
- Q_OBJECT
-public:
- explicit UndoBuffer(QObject *parent = 0);
- ~UndoBuffer();
- bool canUndo();
- bool canRedo();
- UndoCommand *current() const { return list.at(curIdx - 1); }
-private:
- QList<UndoCommand*> list;
- int curIdx;
-public slots:
- void redo();
- void undo();
- void recordbefore(QString commandName, dive *affectedDive);
- void recordAfter(dive *affectedDive);
-};
-
-#endif // UNDOBUFFER_H