Singleton class to manage card image loading and caching. Provides functionality to asynchronously load, cache, and manage card images for the client.
More...
#include <card_picture_loader.h>
|
| static void | clearNetworkCache () |
| | Clears the network disk cache of the worker.
|
| void | imageLoaded (const ExactCard &card, const QImage &image) |
| | Slot called by the worker when an image is loaded. Inserts the pixmap into the cache and emits pixmap updated signals.
|
|
| void | picDownloadChanged () |
| | Triggered when the user changes the picture download settings. Clears the QPixmap cache to reload images.
|
| void | picsPathChanged () |
| | Triggered when the pictures path changes. Clears the QPixmap cache to reload images.
|
Singleton class to manage card image loading and caching. Provides functionality to asynchronously load, cache, and manage card images for the client.
This class is a singleton and handles:
- Loading card images from disk or network.
- Caching images in QPixmapCache for fast reuse.
- Providing themed card backs, including fallback and in-progress/failed states.
- Emitting updates when pixmaps are loaded.
It interacts with CardPictureLoaderWorker for background loading and CardPictureLoaderStatusBar to display loading progress in the main window.
Provides static accessors for:
Uses a worker thread for asynchronous image loading and a status bar widget to track load progress.
◆ CardPictureLoader() [1/2]
| CardPictureLoader::CardPictureLoader |
( |
| ) |
|
|
explicitprivate |
◆ ~CardPictureLoader()
| CardPictureLoader::~CardPictureLoader |
( |
| ) |
|
|
overrideprivate |
◆ CardPictureLoader() [2/2]
◆ cacheCardPixmaps()
| void CardPictureLoader::cacheCardPixmaps |
( |
const QList< ExactCard > & | cards | ) |
|
|
static |
Preload a list of cards into the pixmap cache (limited to CACHED_CARD_PER_DECK_MAX).
- Parameters
-
◆ clearNetworkCache
| void CardPictureLoader::clearNetworkCache |
( |
| ) |
|
|
staticslot |
Clears the network disk cache of the worker.
◆ clearPixmapCache() [1/2]
| void CardPictureLoader::clearPixmapCache |
( |
| ) |
|
|
static |
Clears the in-memory QPixmap cache for all cards.
◆ clearPixmapCache() [2/2]
| void CardPictureLoader::clearPixmapCache |
( |
CardInfoPtr | card | ) |
|
|
static |
◆ getCardBackLoadingFailedPixmap()
| void CardPictureLoader::getCardBackLoadingFailedPixmap |
( |
QPixmap & | pixmap, |
|
|
QSize | size ) |
|
static |
Retrieve a card back pixmap for the loading-failed state.
- Parameters
-
| pixmap | Reference to QPixmap where result will be stored. |
| size | Desired size of pixmap. |
◆ getCardBackLoadingInProgressPixmap()
| void CardPictureLoader::getCardBackLoadingInProgressPixmap |
( |
QPixmap & | pixmap, |
|
|
QSize | size ) |
|
static |
Retrieve a card back pixmap for the loading-in-progress state.
- Parameters
-
| pixmap | Reference to QPixmap where result will be stored. |
| size | Desired size of pixmap. |
◆ getCardBackPixmap()
| void CardPictureLoader::getCardBackPixmap |
( |
QPixmap & | pixmap, |
|
|
QSize | size ) |
|
static |
Retrieve a generic card back pixmap.
- Parameters
-
| pixmap | Reference to QPixmap where result will be stored. |
| size | Desired size of pixmap. |
◆ getInstance()
Access the singleton instance of CardPictureLoader.
- Returns
- Reference to the singleton.
◆ getPixmap()
| void CardPictureLoader::getPixmap |
( |
QPixmap & | pixmap, |
|
|
const ExactCard & | card, |
|
|
QSize | size ) |
|
static |
Retrieve a card pixmap, either from cache or enqueued for loading.
- Parameters
-
| pixmap | Reference to QPixmap where result will be stored. |
| card | ExactCard to load. |
| size | Desired size of pixmap. |
◆ hasCustomArt()
| bool CardPictureLoader::hasCustomArt |
( |
| ) |
|
|
static |
Check if the user has custom card art in the picsPath directory.
- Returns
- True if any custom art exists.
◆ imageLoaded
| void CardPictureLoader::imageLoaded |
( |
const ExactCard & | card, |
|
|
const QImage & | image ) |
|
slot |
Slot called by the worker when an image is loaded. Inserts the pixmap into the cache and emits pixmap updated signals.
- Parameters
-
| card | ExactCard that was loaded. |
| image | Loaded QImage. |
◆ operator=()
◆ picDownloadChanged
| void CardPictureLoader::picDownloadChanged |
( |
| ) |
|
|
privateslot |
Triggered when the user changes the picture download settings. Clears the QPixmap cache to reload images.
◆ picsPathChanged
| void CardPictureLoader::picsPathChanged |
( |
| ) |
|
|
privateslot |
Triggered when the pictures path changes. Clears the QPixmap cache to reload images.
◆ statusBar
Status bar widget showing load progress.
◆ worker
Worker thread for async image loading.
The documentation for this class was generated from the following files: