blob: beae8e39058871eb14a3505e0606afd474a551d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#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);
void undo();
void redo();
};
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
|