12#include <QLoggingCategory>
80 static std::optional<LoadedDeck>
89 static std::optional<LoadedDeck>
loadFromRemote(
const QString &nativeString,
int remoteDeckId);
98 static std::optional<LoadedDeck::LoadInfo>
120 static void saveToClipboard(
const DeckList &deckList,
bool addComments =
true,
bool addSetNameAndNumber =
true);
123 bool addComments =
true,
124 bool addSetNameAndNumber =
true);
161 bool addComments =
true,
162 bool addSetNameAndNumber =
true);
165 QList<DecklistCardNode *> cards,
166 bool addComments =
true,
167 bool addSetNameAndNumber =
true);
Represents a complete deck, including metadata, zones, cards, and sideboard plans.
Definition deck_list.h:63
static std::optional< LoadedDeck > loadFromRemote(const QString &nativeString, int remoteDeckId)
Loads a deck from the response of a remote deck request.
Definition deck_loader.cpp:111
void loadFromFileAsync(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest)
Asynchronously loads a deck from a local file into this DeckLoader. The loadFinished signal will be e...
Definition deck_loader.cpp:84
static void printDeckList(QPrinter *printer, const DeckList &deckList)
Prints the decklist to the provided QPrinter.
Definition deck_loader.cpp:557
static std::optional< LoadedDeck > loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest=false)
Loads a deck from a local file.
Definition deck_loader.cpp:34
bool hasNotBeenLoaded() const
Definition deck_loader.h:51
const LoadedDeck & getDeck() const
Definition deck_loader.h:145
static void saveToStream_DeckHeader(QTextStream &out, const DeckList &deckList)
Definition deck_loader.cpp:348
static bool saveToNewFile(LoadedDeck &deck, const QString &fileName, DeckFileFormat::Format fmt)
Saves a LoadedDeck to a new local file.
Definition deck_loader.cpp:167
static const QStringList ACCEPTED_FILE_EXTENSIONS
Definition deck_loader.h:24
static bool convertToCockatriceFormat(LoadedDeck &deck)
Definition deck_loader.cpp:443
void setDeck(const LoadedDeck &deck)
Definition deck_loader.h:149
DeckLoader(QObject *parent)
Definition deck_loader.cpp:29
void loadFinished(bool success)
static void printDeckListNode(QTextCursor *cursor, const InnerDecklistNode *node)
Definition deck_loader.cpp:497
static void saveToStream_DeckZone(QTextStream &out, const InnerDecklistNode *zoneNode, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:363
LoadedDeck & getDeck()
Definition deck_loader.h:141
static QString exportDeckToDecklist(const DeckList &deckList, DecklistWebsite website)
Definition deck_loader.cpp:296
DeckLoader & operator=(const DeckLoader &)=delete
static void saveToClipboard(const DeckList &deckList, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:319
static bool updateLastLoadedTimestamp(LoadedDeck &deck)
Updates the lastLoadedTimestamp field in the file corresponding to the deck, without changing the Fil...
Definition deck_loader.cpp:182
DeckLoader(const DeckLoader &)=delete
static std::optional< LoadedDeck::LoadInfo > saveToFile(const DeckList &deck, const QString &fileName, DeckFileFormat::Format fmt)
Saves a DeckList to a local file.
Definition deck_loader.cpp:130
bool reload()
Loads the file that the lastLoadInfo currently points to into this instance. No-ops if the lastLoadIn...
Definition deck_loader.cpp:95
LoadedDeck loadedDeck
Definition deck_loader.h:44
DecklistWebsite
Definition deck_loader.h:38
@ DecklistOrg
Definition deck_loader.h:39
@ DecklistXyz
Definition deck_loader.h:40
static void saveToStream_DeckZoneCards(QTextStream &out, const InnerDecklistNode *zoneNode, QList< DecklistCardNode * > cards, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:410
static const QStringList FILE_NAME_FILTERS
Definition deck_loader.h:26
static bool saveToStream_Plain(QTextStream &out, const DeckList &deckList, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:328
Represents a container node in the deck list hierarchy (zones and groupings).
Definition inner_deck_list_node.h:62
Defines the DeckList class, which manages a full deck structure including cards, zones,...
Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader")
Represents a deck that was loaded from somewhere. Contains the DeckList itself, as well as info about...
Definition loaded_deck.h:14