Handles searching for and loading card images from local and custom image folders.
More...
#include <card_picture_loader_local.h>
|
| void | picsPathChanged () |
| | Updates internal paths when the user changes picture settings.
|
|
| void | refreshIndex () |
| | Rebuilds the index of the custom image folder.
|
| QImage | tryLoadCardImageFromDisk (const QString &setName, const QString &correctedCardName, const QString &collectorNumber, const QString &providerId) const |
| | Attempts to load a card image from disk given its set and name info.
|
|
| QString | picsPath |
| | Path to standard card image folder.
|
| QString | customPicsPath |
| | Path to custom card image folder.
|
| QMultiHash< QString, QString > | customFolderIndex |
| | Multimap from cardName to file paths in CUSTOM folder.
|
| QTimer * | refreshTimer |
| | Timer for periodic folder index refresh.
|
Handles searching for and loading card images from local and custom image folders.
This class maintains an index of the CUSTOM folder to avoid repeatedly scanning directories, and supports periodic refreshes to update the index.
Responsibilities:
- Load images for ExactCard objects from local disk or custom folders.
- Maintain an index for fast lookup of images in the CUSTOM folder.
- Refresh the index periodically to account for changes in local image directories.
◆ CardPictureLoaderLocal()
| CardPictureLoaderLocal::CardPictureLoaderLocal |
( |
QObject * | parent | ) |
|
|
explicit |
Constructs a CardPictureLoaderLocal object.
- Parameters
-
| parent | Optional parent QObject. |
Initializes paths from SettingsCache, connects to settings change signals, builds the initial folder index, and starts a periodic refresh timer.
◆ picsPathChanged
| void CardPictureLoaderLocal::picsPathChanged |
( |
| ) |
|
|
privateslot |
◆ refreshIndex()
| void CardPictureLoaderLocal::refreshIndex |
( |
| ) |
|
|
private |
Rebuilds the index of the custom image folder.
Iterates through all subdirectories of the CUSTOM folder and populates customFolderIndex with all discovered image files keyed by base name and complete base name.
◆ tryLoad()
| QImage CardPictureLoaderLocal::tryLoad |
( |
const ExactCard & | toLoad | ) |
const |
|
nodiscard |
Attempts to load a card image from local disk or custom folders.
- Parameters
-
| toLoad | ExactCard object representing the card to load. |
- Returns
- Loaded QImage if found; otherwise, an empty QImage.
Uses a set of name variants and folder paths to attempt to locate the correct image.
◆ tryLoadCardImageFromDisk()
| QImage CardPictureLoaderLocal::tryLoadCardImageFromDisk |
( |
const QString & | setName, |
|
|
const QString & | correctedCardName, |
|
|
const QString & | collectorNumber, |
|
|
const QString & | providerId ) const |
|
nodiscardprivate |
Attempts to load a card image from disk given its set and name info.
- Parameters
-
| setName | Corrected short name of the card's set. |
| correctedCardName | Corrected card name (e.g., normalized name). |
| collectorNumber | Collector number of the card. |
| providerId | Optional provider UUID of the card. |
- Returns
- Loaded QImage if found; otherwise, an empty QImage.
Searches in both the custom folder index and standard pictures paths. Uses several filename patterns to match card images, in order from most-specific to least-specific.
◆ customFolderIndex
| QMultiHash<QString, QString> CardPictureLoaderLocal::customFolderIndex |
|
private |
Multimap from cardName to file paths in CUSTOM folder.
◆ customPicsPath
| QString CardPictureLoaderLocal::customPicsPath |
|
private |
Path to custom card image folder.
◆ picsPath
| QString CardPictureLoaderLocal::picsPath |
|
private |
Path to standard card image folder.
◆ refreshTimer
| QTimer* CardPictureLoaderLocal::refreshTimer |
|
private |
Timer for periodic folder index refresh.
The documentation for this class was generated from the following files: