mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
c2e2391493
commit
853dfa6673
3 changed files with 69 additions and 2 deletions
41
qt-ui/undobuffer.cpp
Normal file
41
qt-ui/undobuffer.cpp
Normal file
|
@ -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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
24
qt-ui/undobuffer.h
Normal file
24
qt-ui/undobuffer.h
Normal file
|
@ -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
|
|
@ -104,7 +104,8 @@ HEADERS = \
|
||||||
qt-ui/statistics/statisticsbar.h \
|
qt-ui/statistics/statisticsbar.h \
|
||||||
qt-ui/statistics/yearstatistics.h \
|
qt-ui/statistics/yearstatistics.h \
|
||||||
qt-ui/diveshareexportdialog.h \
|
qt-ui/diveshareexportdialog.h \
|
||||||
qt-ui/filtermodels.h
|
qt-ui/filtermodels.h \
|
||||||
|
qt-ui/undobuffer.h
|
||||||
|
|
||||||
android: HEADERS -= \
|
android: HEADERS -= \
|
||||||
qt-ui/usermanual.h \
|
qt-ui/usermanual.h \
|
||||||
|
@ -198,7 +199,8 @@ SOURCES = \
|
||||||
qt-ui/statistics/statisticsbar.cpp \
|
qt-ui/statistics/statisticsbar.cpp \
|
||||||
qt-ui/statistics/monthstatistics.cpp \
|
qt-ui/statistics/monthstatistics.cpp \
|
||||||
qt-ui/diveshareexportdialog.cpp \
|
qt-ui/diveshareexportdialog.cpp \
|
||||||
qt-ui/filtermodels.cpp
|
qt-ui/filtermodels.cpp \
|
||||||
|
qt-ui/undobuffer.cpp
|
||||||
|
|
||||||
android: SOURCES += android.cpp
|
android: SOURCES += android.cpp
|
||||||
else: win32: SOURCES += windows.c
|
else: win32: SOURCES += windows.c
|
||||||
|
|
Loading…
Add table
Reference in a new issue