#include <deck_loader.h>
|
| static std::optional< LoadedDeck > | loadFromFile (const QString &fileName, DeckFileFormat::Format fmt, bool userRequest=false) |
| | Loads a deck from a local file.
|
| static std::optional< LoadedDeck > | loadFromRemote (const QString &nativeString, int remoteDeckId) |
| | Loads a deck from the response of a remote deck request.
|
| static std::optional< LoadedDeck::LoadInfo > | saveToFile (const DeckList &deck, const QString &fileName, DeckFileFormat::Format fmt) |
| | Saves a DeckList to a local file.
|
| static bool | saveToFile (const LoadedDeck &deck) |
| | Saves a LoadedDeck to a local file. Uses the lastLoadInfo in the LoadedDeck to determine where to save to.
|
| static bool | saveToNewFile (LoadedDeck &deck, const QString &fileName, DeckFileFormat::Format fmt) |
| | Saves a LoadedDeck to a new local file.
|
| static QString | exportDeckToDecklist (const DeckList &deckList, DecklistWebsite website) |
| static void | saveToClipboard (const DeckList &deckList, bool addComments=true, bool addSetNameAndNumber=true) |
| static bool | saveToStream_Plain (QTextStream &out, const DeckList &deckList, bool addComments=true, bool addSetNameAndNumber=true) |
| static void | printDeckList (QPrinter *printer, const DeckList &deckList) |
| | Prints the decklist to the provided QPrinter.
|
| static bool | convertToCockatriceFormat (LoadedDeck &deck) |
|
| static bool | updateLastLoadedTimestamp (LoadedDeck &deck) |
| | Updates the lastLoadedTimestamp field in the file corresponding to the deck, without changing the FileModificationTime of the file.
|
| static void | printDeckListNode (QTextCursor *cursor, const InnerDecklistNode *node) |
| static void | saveToStream_DeckHeader (QTextStream &out, const DeckList &deckList) |
| static void | saveToStream_DeckZone (QTextStream &out, const InnerDecklistNode *zoneNode, bool addComments=true, bool addSetNameAndNumber=true) |
| static void | saveToStream_DeckZoneCards (QTextStream &out, const InnerDecklistNode *zoneNode, QList< DecklistCardNode * > cards, bool addComments=true, bool addSetNameAndNumber=true) |
◆ DecklistWebsite
| Enumerator |
|---|
| DecklistOrg | |
| DecklistXyz | |
◆ DeckLoader() [1/2]
| DeckLoader::DeckLoader |
( |
QObject * | parent | ) |
|
◆ DeckLoader() [2/2]
◆ convertToCockatriceFormat()
| bool DeckLoader::convertToCockatriceFormat |
( |
LoadedDeck & | deck | ) |
|
|
static |
Converts the given deck's file to the cockatrice file format. Uses the lastLoadInfo in the LoadedDeck to determine the current name of the file and where to save to.
- Parameters
-
| deck | The deck to convert. Should have valid lastLoadInfo. Will update the lastLoadInfo. |
- Returns
- Whether the conversion succeeded.
◆ exportDeckToDecklist()
Export deck to decklist function, called to format the deck in a way to be sent to a server
- Parameters
-
| deckList | The decklist to export |
| website | The website we're sending the deck to |
◆ getDeck() [1/2]
◆ getDeck() [2/2]
◆ hasNotBeenLoaded()
| bool DeckLoader::hasNotBeenLoaded |
( |
| ) |
const |
|
inlinenodiscard |
◆ loadFinished
| void DeckLoader::loadFinished |
( |
bool | success | ) |
|
|
signal |
◆ loadFromFile()
Loads a deck from a local file.
- Parameters
-
| fileName | The file to load |
| fmt | The format of the file to load |
| userRequest | Whether the load was manually requested by the user, instead of being done in the background. |
- Returns
- An optional containing the LoadedDeck, or empty if the load failed.
◆ loadFromFileAsync()
Asynchronously loads a deck from a local file into this DeckLoader. The loadFinished signal will be emitted when the load finishes. Once the loading finishes, the deck can be accessed with getDeck
- Parameters
-
| fileName | The file to load |
| fmt | The format of the file to load |
| userRequest | Whether the load was manually requested by the user, instead of being done in the background. |
◆ loadFromRemote()
| std::optional< LoadedDeck > DeckLoader::loadFromRemote |
( |
const QString & | nativeString, |
|
|
int | remoteDeckId ) |
|
static |
Loads a deck from the response of a remote deck request.
- Parameters
-
| nativeString | The deck string, in cod format |
| remoteDeckId | The remote deck id |
- Returns
- An optional containing the LoadedDeck, or empty if the load failed.
◆ operator=()
◆ printDeckList()
| void DeckLoader::printDeckList |
( |
QPrinter * | printer, |
|
|
const DeckList & | deckList ) |
|
static |
Prints the decklist to the provided QPrinter.
- Parameters
-
| printer | The printer to render the decklist to. |
| deckList | |
◆ printDeckListNode()
| void DeckLoader::printDeckListNode |
( |
QTextCursor * | cursor, |
|
|
const InnerDecklistNode * | node ) |
|
staticprivate |
◆ reload()
| bool DeckLoader::reload |
( |
| ) |
|
Loads the file that the lastLoadInfo currently points to into this instance. No-ops if the lastLoadInfo is missing the required info or the load fails.
- Returns
- Whether the loaded succeeded.
◆ saveToClipboard()
| void DeckLoader::saveToClipboard |
( |
const DeckList & | deckList, |
|
|
bool | addComments = true, |
|
|
bool | addSetNameAndNumber = true ) |
|
static |
◆ saveToFile() [1/2]
Saves a DeckList to a local file.
- Parameters
-
| deck | The DeckList |
| fileName | The file to write to |
| fmt | The deck file format to use |
- Returns
- An optional containing the LoadInfo for the new file, or empty if the save failed.
◆ saveToFile() [2/2]
| bool DeckLoader::saveToFile |
( |
const LoadedDeck & | deck | ) |
|
|
static |
Saves a LoadedDeck to a local file. Uses the lastLoadInfo in the LoadedDeck to determine where to save to.
- Parameters
-
| deck | The LoadedDeck to save. Should have valid lastLoadInfo. |
- Returns
- Whether the save succeeded.
◆ saveToNewFile()
Saves a LoadedDeck to a new local file.
- Parameters
-
| deck | The LoadedDeck to save. Will update the lastLoadInfo. |
| fileName | The file to write to |
| fmt | The deck file format to use |
- Returns
- Whether the save succeeded.
◆ saveToStream_DeckHeader()
| void DeckLoader::saveToStream_DeckHeader |
( |
QTextStream & | out, |
|
|
const DeckList & | deckList ) |
|
staticprivate |
◆ saveToStream_DeckZone()
| void DeckLoader::saveToStream_DeckZone |
( |
QTextStream & | out, |
|
|
const InnerDecklistNode * | zoneNode, |
|
|
bool | addComments = true, |
|
|
bool | addSetNameAndNumber = true ) |
|
staticprivate |
◆ saveToStream_DeckZoneCards()
| void DeckLoader::saveToStream_DeckZoneCards |
( |
QTextStream & | out, |
|
|
const InnerDecklistNode * | zoneNode, |
|
|
QList< DecklistCardNode * > | cards, |
|
|
bool | addComments = true, |
|
|
bool | addSetNameAndNumber = true ) |
|
staticprivate |
◆ saveToStream_Plain()
| bool DeckLoader::saveToStream_Plain |
( |
QTextStream & | out, |
|
|
const DeckList & | deckList, |
|
|
bool | addComments = true, |
|
|
bool | addSetNameAndNumber = true ) |
|
static |
◆ setDeck()
| void DeckLoader::setDeck |
( |
const LoadedDeck & | deck | ) |
|
|
inline |
◆ updateLastLoadedTimestamp()
| bool DeckLoader::updateLastLoadedTimestamp |
( |
LoadedDeck & | deck | ) |
|
|
staticprivate |
Updates the lastLoadedTimestamp field in the file corresponding to the deck, without changing the FileModificationTime of the file.
◆ ACCEPTED_FILE_EXTENSIONS
| const QStringList DeckLoader::ACCEPTED_FILE_EXTENSIONS = {"*.cod", "*.dec", "*.dek", "*.txt", "*.mwDeck"} |
|
static |
Supported file extensions for decklist files
◆ FILE_NAME_FILTERS
| const QStringList DeckLoader::FILE_NAME_FILTERS |
|
static |
Initial value:= {
static const QStringList ACCEPTED_FILE_EXTENSIONS
Definition deck_loader.h:23
For use with QFileDialog::setNameFilters
◆ loadedDeck
The documentation for this class was generated from the following files: