Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardPictureToLoad Class Reference

Manages all URLs and sets for downloading a specific card image. More...

#include <card_picture_to_load.h>

Collaboration diagram for CardPictureToLoad:
[legend]

Public Member Functions

 CardPictureToLoad (const ExactCard &_card)
 Constructs a CardPictureToLoad for a given ExactCard.
const ExactCardgetCard () const
QString getCurrentUrl () const
CardSetPtr getCurrentSet () const
QString getSetName () const
QString transformUrl (const QString &urlTemplate) const
 Transforms a URL template into a concrete URL for this card/set.
bool nextSet ()
 Advance to the next set in the list.
bool nextUrl ()
 Advance to the next URL in the current set's list.
void populateSetUrls ()
 Populates the currentSetUrls list with URLs for the current set.

Static Public Member Functions

static QList< CardSetPtrextractSetsSorted (const ExactCard &card)
 Extract all sets from the card and sort them by priority.

Private Attributes

ExactCard card
 The ExactCard being downloaded.
QList< CardSetPtrsortedSets
 All sets for this card, sorted by priority.
QList< QString > urlTemplates
 URL templates from settings.
QList< QString > currentSetUrls
 URLs for the current set being attempted.
QString currentUrl
 Currently active URL to download.
CardSetPtr currentSet
 Currently active set.

Detailed Description

Manages all URLs and sets for downloading a specific card image.

Responsibilities:

  • Maintains a sorted list of sets for a card.
  • Generates URLs to download images from, including custom URLs and URL templates.
  • Tracks which URL and set is currently being attempted.
  • Provides helper methods to advance to next URL or set.

Constructor & Destructor Documentation

◆ CardPictureToLoad()

CardPictureToLoad::CardPictureToLoad ( const ExactCard & _card)
explicit

Constructs a CardPictureToLoad for a given ExactCard.

Parameters
_cardThe card to download

Initializes URL templates and pre-populates the first set URLs.

Here is the call graph for this function:

Member Function Documentation

◆ extractSetsSorted()

QList< CardSetPtr > CardPictureToLoad::extractSetsSorted ( const ExactCard & card)
static

Extract all sets from the card and sort them by priority.

Parameters
cardThe card to extract sets from
Returns
A non-empty list of CardSetPtr, sorted by priority

If the card has no sets, a dummy set is inserted. Also ensures the printing corresponding to the ExactCard is first in the list.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCard()

const ExactCard & CardPictureToLoad::getCard ( ) const
inlinenodiscard
Returns
The card being loaded.
Here is the caller graph for this function:

◆ getCurrentSet()

CardSetPtr CardPictureToLoad::getCurrentSet ( ) const
inlinenodiscard
Returns
The current set being attempted.
Here is the caller graph for this function:

◆ getCurrentUrl()

QString CardPictureToLoad::getCurrentUrl ( ) const
inlinenodiscard
Returns
The current URL being attempted.

◆ getSetName()

QString CardPictureToLoad::getSetName ( ) const
nodiscard
Returns
The short name of the current set, or empty string if no set.
Here is the caller graph for this function:

◆ nextSet()

bool CardPictureToLoad::nextSet ( )

Advance to the next set in the list.

Returns
True if a next set exists and was selected, false if at the end.

Updates currentSet and repopulates currentSetUrls. If we are already at the end of the list, then currentSet is set to empty.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextUrl()

bool CardPictureToLoad::nextUrl ( )

Advance to the next URL in the current set's list.

Returns
True if a next URL exists, false if at the end.

Updates currentUrl. If we are already at the end of the list, then currentUrl is set to empty.

Here is the caller graph for this function:

◆ populateSetUrls()

void CardPictureToLoad::populateSetUrls ( )

Populates the currentSetUrls list with URLs for the current set.

Includes custom URLs first, followed by template-based URLs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transformUrl()

QString CardPictureToLoad::transformUrl ( const QString & urlTemplate) const

Transforms a URL template into a concrete URL for this card/set.

Parameters
urlTemplateThe URL template to transform
Returns
The transformed URL or empty string if the template cannot be fulfilled
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ card

ExactCard CardPictureToLoad::card
private

The ExactCard being downloaded.

◆ currentSet

CardSetPtr CardPictureToLoad::currentSet
private

Currently active set.

◆ currentSetUrls

QList<QString> CardPictureToLoad::currentSetUrls
private

URLs for the current set being attempted.

◆ currentUrl

QString CardPictureToLoad::currentUrl
private

Currently active URL to download.

◆ sortedSets

QList<CardSetPtr> CardPictureToLoad::sortedSets
private

All sets for this card, sorted by priority.

◆ urlTemplates

QList<QString> CardPictureToLoad::urlTemplates
private

URL templates from settings.


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