mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 04:43:56 -07:00
Clear history when setting deck.
Took 6 minutes
This commit is contained in:
parent
126b338d3e
commit
d4afa0e330
3 changed files with 11 additions and 0 deletions
|
|
@ -404,6 +404,7 @@ void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
|||
connect(deckLoader, &DeckLoader::deckLoaded, deckModel, &DeckListModel::rebuildTree);
|
||||
connect(deckLoader->getDeckList(), &DeckList::deckHashChanged, deckModel, &DeckListModel::deckHashChanged);
|
||||
|
||||
historyManager->clear();
|
||||
historyManagerWidget->setDeckListModel(deckModel);
|
||||
|
||||
syncDisplayWidgetsToModel();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@ void DeckListHistoryManager::save(DeckListMemento *memento)
|
|||
emit undoRedoStateChanged();
|
||||
}
|
||||
|
||||
void DeckListHistoryManager::clear()
|
||||
{
|
||||
undoStack.clear();
|
||||
redoStack.clear();
|
||||
|
||||
emit undoRedoStateChanged();
|
||||
}
|
||||
|
||||
void DeckListHistoryManager::undo(DeckList *deck)
|
||||
{
|
||||
if (undoStack.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ public:
|
|||
|
||||
void save(DeckListMemento *memento);
|
||||
|
||||
void clear();
|
||||
|
||||
bool canUndo() const
|
||||
{
|
||||
return !undoStack.isEmpty();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue