Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
deck_list_history_manager.h
Go to the documentation of this file.
1#ifndef COCKATRICE_DECK_LIST_HISTORY_MANAGER_H
2#define COCKATRICE_DECK_LIST_HISTORY_MANAGER_H
3
4#include "deck_list.h"
5#include "deck_list_memento.h"
6
7#include <QObject>
8#include <QStack>
9
10class DeckListHistoryManager : public QObject
11{
12 Q_OBJECT
13
14signals:
16
17public:
18 explicit DeckListHistoryManager(QObject *parent = nullptr) : QObject(parent)
19 {
20 }
21
22 void save(const DeckListMemento &memento);
23
24 void clear();
25
26 [[nodiscard]] bool canUndo() const
27 {
28 return !undoStack.isEmpty();
29 }
30
31 [[nodiscard]] bool canRedo() const
32 {
33 return !redoStack.isEmpty();
34 }
35
36 void undo(DeckList *deck);
37
38 void redo(DeckList *deck);
39
40 [[nodiscard]] QStack<DeckListMemento> getRedoStack() const
41 {
42 return redoStack;
43 }
44 [[nodiscard]] QStack<DeckListMemento> getUndoStack() const
45 {
46 return undoStack;
47 }
48
49private:
50 QStack<DeckListMemento> undoStack;
51 QStack<DeckListMemento> redoStack;
52};
53
54#endif // COCKATRICE_DECK_LIST_HISTORY_MANAGER_H
QStack< DeckListMemento > getRedoStack() const
Definition deck_list_history_manager.h:40
void undo(DeckList *deck)
Definition deck_list_history_manager.cpp:17
QStack< DeckListMemento > getUndoStack() const
Definition deck_list_history_manager.h:44
QStack< DeckListMemento > redoStack
Definition deck_list_history_manager.h:51
DeckListHistoryManager(QObject *parent=nullptr)
Definition deck_list_history_manager.h:18
void clear()
Definition deck_list_history_manager.cpp:10
void redo(DeckList *deck)
Definition deck_list_history_manager.cpp:36
bool canRedo() const
Definition deck_list_history_manager.h:31
bool canUndo() const
Definition deck_list_history_manager.h:26
void save(const DeckListMemento &memento)
Definition deck_list_history_manager.cpp:3
QStack< DeckListMemento > undoStack
Definition deck_list_history_manager.h:50
Definition deck_list_memento.h:6
Represents a complete deck, including metadata, zones, cards, and sideboard plans.
Definition deck_list.h:127