Refactor Picture Loader (#5457)

This commit is contained in:
BruebachL 2025-01-13 19:52:54 +01:00 committed by GitHub
parent a417b049da
commit ba89495dc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 614 additions and 581 deletions

View file

@ -0,0 +1,45 @@
#ifndef PICTURELOADER_H
#define PICTURELOADER_H
#include "../../../game/cards/card_database.h"
#include "picture_loader_worker.h"
class PictureLoader : public QObject
{
Q_OBJECT
public:
static PictureLoader &getInstance()
{
static PictureLoader instance;
return instance;
}
private:
explicit PictureLoader();
~PictureLoader() override;
// Singleton - Don't implement copy constructor and assign operator
PictureLoader(PictureLoader const &);
void operator=(PictureLoader const &);
PictureLoaderWorker *worker;
public:
static void getPixmap(QPixmap &pixmap, CardInfoPtr card, QSize size);
static void getCardBackPixmap(QPixmap &pixmap, QSize size);
static void getCardBackLoadingInProgressPixmap(QPixmap &pixmap, QSize size);
static void getCardBackLoadingFailedPixmap(QPixmap &pixmap, QSize size);
static void clearPixmapCache(CardInfoPtr card);
static void clearPixmapCache();
static void cacheCardPixmaps(QList<CardInfoPtr> cards);
public slots:
static void clearNetworkCache();
private slots:
void picDownloadChanged();
void picsPathChanged();
public slots:
void imageLoaded(CardInfoPtr card, const QImage &image);
};
#endif