Manages all URLs and sets for downloading a specific card image.
More...
#include <card_picture_to_load.h>
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.
◆ CardPictureToLoad()
| CardPictureToLoad::CardPictureToLoad |
( |
const ExactCard & | _card | ) |
|
|
explicit |
Constructs a CardPictureToLoad for a given ExactCard.
- Parameters
-
| _card | The card to download |
Initializes URL templates and pre-populates the first set URLs.
◆ extractSetsSorted()
Extract all sets from the card and sort them by priority.
- Parameters
-
| card | The 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.
◆ getCard()
| const ExactCard & CardPictureToLoad::getCard |
( |
| ) |
const |
|
inlinenodiscard |
- Returns
- The card being loaded.
◆ getCurrentSet()
| CardSetPtr CardPictureToLoad::getCurrentSet |
( |
| ) |
const |
|
inlinenodiscard |
- Returns
- The current set being attempted.
◆ 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.
◆ 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.
◆ 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.
◆ populateSetUrls()
| void CardPictureToLoad::populateSetUrls |
( |
| ) |
|
Populates the currentSetUrls list with URLs for the current set.
Includes custom URLs first, followed by template-based URLs.
◆ transformUrl()
| QString CardPictureToLoad::transformUrl |
( |
const QString & | urlTemplate | ) |
const |
Transforms a URL template into a concrete URL for this card/set.
- Parameters
-
| urlTemplate | The URL template to transform |
- Returns
- The transformed URL or empty string if the template cannot be fulfilled
◆ card
◆ currentSet
◆ currentSetUrls
| QList<QString> CardPictureToLoad::currentSetUrls |
|
private |
URLs for the current set being attempted.
◆ currentUrl
| QString CardPictureToLoad::currentUrl |
|
private |
Currently active URL to download.
◆ sortedSets
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: