12#include <QLoggingCategory>
79 static std::optional<LoadedDeck>
88 static std::optional<LoadedDeck>
loadFromRemote(
const QString &nativeString,
int remoteDeckId);
97 static std::optional<LoadedDeck::LoadInfo>
119 static void saveToClipboard(
const DeckList &deckList,
bool addComments =
true,
bool addSetNameAndNumber =
true);
122 bool addComments =
true,
123 bool addSetNameAndNumber =
true);
160 bool addComments =
true,
161 bool addSetNameAndNumber =
true);
164 QList<DecklistCardNode *> cards,
165 bool addComments =
true,
166 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:110
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:83
static void printDeckList(QPrinter *printer, const DeckList &deckList)
Prints the decklist to the provided QPrinter.
Definition deck_loader.cpp:556
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:33
bool hasNotBeenLoaded() const
Definition deck_loader.h:50
const LoadedDeck & getDeck() const
Definition deck_loader.h:144
static void saveToStream_DeckHeader(QTextStream &out, const DeckList &deckList)
Definition deck_loader.cpp:347
static bool saveToNewFile(LoadedDeck &deck, const QString &fileName, DeckFileFormat::Format fmt)
Saves a LoadedDeck to a new local file.
Definition deck_loader.cpp:166
static const QStringList ACCEPTED_FILE_EXTENSIONS
Definition deck_loader.h:23
static bool convertToCockatriceFormat(LoadedDeck &deck)
Definition deck_loader.cpp:442
void setDeck(const LoadedDeck &deck)
Definition deck_loader.h:148
DeckLoader(QObject *parent)
Definition deck_loader.cpp:28
void loadFinished(bool success)
static void printDeckListNode(QTextCursor *cursor, const InnerDecklistNode *node)
Definition deck_loader.cpp:496
static void saveToStream_DeckZone(QTextStream &out, const InnerDecklistNode *zoneNode, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:362
LoadedDeck & getDeck()
Definition deck_loader.h:140
static QString exportDeckToDecklist(const DeckList &deckList, DecklistWebsite website)
Definition deck_loader.cpp:295
DeckLoader & operator=(const DeckLoader &)=delete
static void saveToClipboard(const DeckList &deckList, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:318
static bool updateLastLoadedTimestamp(LoadedDeck &deck)
Updates the lastLoadedTimestamp field in the file corresponding to the deck, without changing the Fil...
Definition deck_loader.cpp:181
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:129
bool reload()
Loads the file that the lastLoadInfo currently points to into this instance. No-ops if the lastLoadIn...
Definition deck_loader.cpp:94
LoadedDeck loadedDeck
Definition deck_loader.h:43
DecklistWebsite
Definition deck_loader.h:37
@ DecklistOrg
Definition deck_loader.h:38
@ DecklistXyz
Definition deck_loader.h:39
static void saveToStream_DeckZoneCards(QTextStream &out, const InnerDecklistNode *zoneNode, QList< DecklistCardNode * > cards, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:409
static const QStringList FILE_NAME_FILTERS
Definition deck_loader.h:25
static bool saveToStream_Plain(QTextStream &out, const DeckList &deckList, bool addComments=true, bool addSetNameAndNumber=true)
Definition deck_loader.cpp:327
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