summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Grace Karanja <gracie.karanja89@gmail.com>2015-02-09 09:17:38 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-09 21:02:07 -0800
commit853dfa66735db874cc16688e6fd9ad9320474e37 (patch)
tree64f82e2fefb7dd957c083a5274713d7d67d31022
parentc2e23914932cdfa254e817c06af064992888d377 (diff)
downloadsubsurface-853dfa66735db874cc16688e6fd9ad9320474e37.tar.gz
Create UndoBuffer class
Add an empty UndoBuffer class. This will be built up on to implement a working undo/redo mechanism. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/undobuffer.cpp41
-rw-r--r--qt-ui/undobuffer.h24
-rw-r--r--subsurface.pro6
3 files changed, 69 insertions, 2 deletions
diff --git a/qt-ui/undobuffer.cpp b/qt-ui/undobuffer.cpp
new file mode 100644
index 000000000..fd74466be
--- /dev/null
+++ b/qt-ui/undobuffer.cpp
@@ -0,0 +1,41 @@
+#include "undobuffer.h"
+
+UndoBuffer::UndoBuffer(QObject *parent) : QObject(parent)
+{
+
+}
+
+UndoBuffer::~UndoBuffer()
+{
+
+}
+
+bool UndoBuffer::canUndo()
+{
+
+}
+
+bool UndoBuffer::canRedo()
+{
+
+}
+
+void UndoBuffer::redo()
+{
+
+}
+
+void UndoBuffer::undo()
+{
+
+}
+
+void UndoBuffer::recordbefore(QString commandName, dive *affectedDive)
+{
+
+}
+
+void UndoBuffer::recordAfter(dive *affectedDive)
+{
+
+}
diff --git a/qt-ui/undobuffer.h b/qt-ui/undobuffer.h
new file mode 100644
index 000000000..a292d3ba7
--- /dev/null
+++ b/qt-ui/undobuffer.h
@@ -0,0 +1,24 @@
+#ifndef UNDOBUFFER_H
+#define UNDOBUFFER_H
+
+#include <QObject>
+#include "dive.h"
+
+class UndoBuffer : public QObject
+{
+ Q_OBJECT
+public:
+ explicit UndoBuffer(QObject *parent = 0);
+ ~UndoBuffer();
+ bool canUndo();
+ bool canRedo();
+private:
+ int curIdx;
+public slots:
+ void redo();
+ void undo();
+ void recordbefore(QString commandName, dive *affectedDive);
+ void recordAfter(dive *affectedDive);
+};
+
+#endif // UNDOBUFFER_H
diff --git a/subsurface.pro b/subsurface.pro
index 2cc6b0982..000806f19 100644
--- a/subsurface.pro
+++ b/subsurface.pro
@@ -104,7 +104,8 @@ HEADERS = \
qt-ui/statistics/statisticsbar.h \
qt-ui/statistics/yearstatistics.h \
qt-ui/diveshareexportdialog.h \
- qt-ui/filtermodels.h
+ qt-ui/filtermodels.h \
+ qt-ui/undobuffer.h
android: HEADERS -= \
qt-ui/usermanual.h \
@@ -198,7 +199,8 @@ SOURCES = \
qt-ui/statistics/statisticsbar.cpp \
qt-ui/statistics/monthstatistics.cpp \
qt-ui/diveshareexportdialog.cpp \
- qt-ui/filtermodels.cpp
+ qt-ui/filtermodels.cpp \
+ qt-ui/undobuffer.cpp
android: SOURCES += android.cpp
else: win32: SOURCES += windows.c