Cockatrice 2026-01-14-Development-2.11.0-beta.46
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
DeckLoader Class Reference

#include <deck_loader.h>

Inheritance diagram for DeckLoader:
[legend]
Collaboration diagram for DeckLoader:
[legend]

Public Types

enum  DecklistWebsite { DecklistOrg , DecklistXyz }

Signals

void deckLoaded ()
void loadFinished (bool success)

Public Member Functions

 DeckLoader (QObject *parent)
 DeckLoader (const DeckLoader &)=delete
DeckLoaderoperator= (const DeckLoader &)=delete
bool hasNotBeenLoaded () const
bool loadFromFile (const QString &fileName, DeckFileFormat::Format fmt, bool userRequest=false)
bool loadFromFileAsync (const QString &fileName, DeckFileFormat::Format fmt, bool userRequest)
bool loadFromRemote (const QString &nativeString, int remoteDeckId)
bool saveToFile (const QString &fileName, DeckFileFormat::Format fmt)
bool updateLastLoadedTimestamp (const QString &fileName, DeckFileFormat::Format fmt)
bool convertToCockatriceFormat (const QString &fileName)
LoadedDeckgetDeck ()
const LoadedDeckgetDeck () const
void setDeck (const LoadedDeck &deck)

Static Public Member Functions

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 Public Attributes

static const QStringList ACCEPTED_FILE_EXTENSIONS = {"*.cod", "*.dec", "*.dek", "*.txt", "*.mwDeck"}
static const QStringList FILE_NAME_FILTERS

Static Private Member Functions

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)

Private Attributes

LoadedDeck loadedDeck

Member Enumeration Documentation

◆ DecklistWebsite

Enumerator
DecklistOrg 
DecklistXyz 

Constructor & Destructor Documentation

◆ DeckLoader() [1/2]

DeckLoader::DeckLoader ( QObject * parent)
Here is the caller graph for this function:

◆ DeckLoader() [2/2]

DeckLoader::DeckLoader ( const DeckLoader & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ convertToCockatriceFormat()

bool DeckLoader::convertToCockatriceFormat ( const QString & fileName)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deckLoaded

void DeckLoader::deckLoaded ( )
signal
Here is the caller graph for this function:

◆ exportDeckToDecklist()

QString DeckLoader::exportDeckToDecklist ( const DeckList & deckList,
DecklistWebsite website )
static

Export deck to decklist function, called to format the deck in a way to be sent to a server

Parameters
deckListThe decklist to export
websiteThe website we're sending the deck to
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDeck() [1/2]

LoadedDeck & DeckLoader::getDeck ( )
inline
Here is the caller graph for this function:

◆ getDeck() [2/2]

const LoadedDeck & DeckLoader::getDeck ( ) const
inline

◆ hasNotBeenLoaded()

bool DeckLoader::hasNotBeenLoaded ( ) const
inlinenodiscard

◆ loadFinished

void DeckLoader::loadFinished ( bool success)
signal
Here is the caller graph for this function:

◆ loadFromFile()

bool DeckLoader::loadFromFile ( const QString & fileName,
DeckFileFormat::Format fmt,
bool userRequest = false )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFromFileAsync()

bool DeckLoader::loadFromFileAsync ( const QString & fileName,
DeckFileFormat::Format fmt,
bool userRequest )
Here is the call graph for this function:

◆ loadFromRemote()

bool DeckLoader::loadFromRemote ( const QString & nativeString,
int remoteDeckId )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

DeckLoader & DeckLoader::operator= ( const DeckLoader & )
delete
Here is the call graph for this function:

◆ printDeckList()

void DeckLoader::printDeckList ( QPrinter * printer,
const DeckList & deckList )
static

Prints the decklist to the provided QPrinter.

Parameters
printerThe printer to render the decklist to.
deckList
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printDeckListNode()

void DeckLoader::printDeckListNode ( QTextCursor * cursor,
const InnerDecklistNode * node )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToClipboard()

void DeckLoader::saveToClipboard ( const DeckList & deckList,
bool addComments = true,
bool addSetNameAndNumber = true )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToFile()

bool DeckLoader::saveToFile ( const QString & fileName,
DeckFileFormat::Format fmt )
Here is the caller graph for this function:

◆ saveToStream_DeckHeader()

void DeckLoader::saveToStream_DeckHeader ( QTextStream & out,
const DeckList & deckList )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToStream_DeckZone()

void DeckLoader::saveToStream_DeckZone ( QTextStream & out,
const InnerDecklistNode * zoneNode,
bool addComments = true,
bool addSetNameAndNumber = true )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToStream_DeckZoneCards()

void DeckLoader::saveToStream_DeckZoneCards ( QTextStream & out,
const InnerDecklistNode * zoneNode,
QList< DecklistCardNode * > cards,
bool addComments = true,
bool addSetNameAndNumber = true )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToStream_Plain()

bool DeckLoader::saveToStream_Plain ( QTextStream & out,
const DeckList & deckList,
bool addComments = true,
bool addSetNameAndNumber = true )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDeck()

void DeckLoader::setDeck ( const LoadedDeck & deck)
inline
Here is the caller graph for this function:

◆ updateLastLoadedTimestamp()

bool DeckLoader::updateLastLoadedTimestamp ( const QString & fileName,
DeckFileFormat::Format fmt )
Here is the caller graph for this function:

Member Data Documentation

◆ 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:
= {
tr("Common deck formats (%1)").arg(ACCEPTED_FILE_EXTENSIONS.join(" ")), tr("All files (*.*)")}
static const QStringList ACCEPTED_FILE_EXTENSIONS
Definition deck_loader.h:23

For use with QFileDialog::setNameFilters

◆ loadedDeck

LoadedDeck DeckLoader::loadedDeck
private

The documentation for this class was generated from the following files: