1#ifndef COCKATRICE_DECK_STATE_MANAGER_H
2#define COCKATRICE_DECK_STATE_MANAGER_H
7#include <QSharedPointer>
161 void setName(
const QString &name);
164 void setTags(
const QStringList &tags);
232 void undo(
int steps = 1);
238 void redo(
int steps = 1);
Definition deck_list_history_manager.h:11
Qt model representing a decklist for use in views (tree/table).
Definition deck_list_model.h:214
Represents a complete deck, including metadata, zones, cards, and sideboard plans.
Definition deck_list.h:63
DeckListHistoryManager * historyManager
Definition deck_state_manager.h:28
void isModifiedChanged(bool isModified)
void focusIndexChanged(QModelIndex index, bool preserveWidgetFocus)
QSharedPointer< DeckList > deckList
Definition deck_state_manager.h:26
bool removeCardAtIndex(const QModelIndex &idx)
Removes all copies of the card at the given index. No-ops if index is invalid or not a card node....
Definition deck_state_manager.cpp:263
void doCardModified()
Handles updating state and emitting signals whenever the cards are modified.
Definition deck_state_manager.cpp:347
QModelIndex addCard(const ExactCard &card, const QString &zoneName)
Adds the given card to the given zone. Saves the operation to history if successful.
Definition deck_state_manager.cpp:170
void setModified(bool state)
Sets the new isModified state, emitting a signal if the state changed. This class will automatically ...
Definition deck_state_manager.cpp:47
bool offsetCountAtIndex(const QModelIndex &idx, int offset)
Definition deck_state_manager.cpp:286
bool isModified() const
Checks if the deck has been modified since it was last saved.
Definition deck_state_manager.cpp:42
QString getSimpleDeckName() const
Gets the deck's simplified name.
Definition deck_state_manager.cpp:32
DeckListHistoryManager * getHistoryManager() const
Definition deck_state_manager.h:39
void setComments(const QString &comments)
Definition deck_state_manager.cpp:119
void setFormat(const QString &format)
Definition deck_state_manager.cpp:158
void undo(int steps=1)
Definition deck_state_manager.cpp:303
LoadedDeck toLoadedDeck() const
Creates a LoadedDeck containing the contents of the current deck and the current LoadInfo.
Definition deck_state_manager.cpp:22
void setBannerCard(const CardRef &bannerCard)
Definition deck_state_manager.cpp:132
bool decrementCountAtIndex(const QModelIndex &idx)
Decrements the number of copies of the card at the given index by 1. No-ops if index is invalid or no...
Definition deck_state_manager.cpp:281
DeckStateManager(QObject *parent=nullptr)
Definition deck_state_manager.cpp:6
void uniqueCardsChanged()
DeckListModel * deckListModel
Definition deck_state_manager.h:27
DeckList::Metadata const & getMetadata() const
Gets a view of the metadata in the DeckList.
Definition deck_state_manager.cpp:27
void setTags(const QStringList &tags)
Definition deck_state_manager.cpp:145
DeckListModel * getModel() const
Gets the underlying DeckListModel. You should generally refrain modifying the returned model directly...
Definition deck_state_manager.h:50
LoadedDeck::LoadInfo lastLoadInfo
Definition deck_state_manager.h:25
void redo(int steps=1)
Definition deck_state_manager.cpp:321
void doMetadataModified()
Handles updating state and emitting signals whenever the metadata is modified.
Definition deck_state_manager.cpp:357
void clearDeck()
Resets the deck to a blank new deck, resetting all history.
Definition deck_state_manager.cpp:74
bool isBlankNewDeck() const
Checks if the deck state is as if it was a new deck.
Definition deck_state_manager.cpp:57
QModelIndex decrementCard(const ExactCard &card, const QString &zoneName)
Removes 1 copy of the given card from the given zone. Saves the operation to history if successful.
Definition deck_state_manager.cpp:191
void replaceDeck(const LoadedDeck &deck)
Overwrites the current deck with a new deck, resetting all history.
Definition deck_state_manager.cpp:62
void requestHistorySave(const QString &reason)
Definition deck_state_manager.cpp:339
bool incrementCountAtIndex(const QModelIndex &idx)
Increments the number of copies of the card at the given index by 1. No-ops if index is invalid or no...
Definition deck_state_manager.cpp:276
bool swapCardAtIndex(const QModelIndex &idx)
Swaps one copy of the card at the given index between the maindeck and sideboard. No-ops if index is ...
Definition deck_state_manager.cpp:238
QString getDeckHash() const
Gets the deck hash.
Definition deck_state_manager.cpp:37
void setName(const QString &name)
Definition deck_state_manager.cpp:106
void setLastLoadInfo(const LoadedDeck::LoadInfo &loadInfo)
Sets the lastLoadInfo.
Definition deck_state_manager.h:115
bool modified
Definition deck_state_manager.h:30
const DeckList & getDeckList() const
Gets a view of the current deck.
Definition deck_state_manager.cpp:17
bool modifyDeck(const QString &reason, const std::function< bool(DeckListModel *)> &operation)
Modifies the cards in the deck, in a wrapped operation that is saved to the history.
Definition deck_state_manager.cpp:79
Represents a specific card instance, defined by its CardInfo and a particular printing.
Definition exact_card.h:19
Defines the DeckList class, which manages a full deck structure including cards, zones,...
Information about where the deck was loaded from.
Definition loaded_deck.h:23
Represents a deck that was loaded from somewhere. Contains the DeckList itself, as well as info about...
Definition loaded_deck.h:14