Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
card_picture_loader_worker_work.h
Go to the documentation of this file.
1#ifndef PICTURE_LOADER_WORKER_WORK_H
2#define PICTURE_LOADER_WORKER_WORK_H
3
6
7#include <QLoggingCategory>
8#include <QMutex>
9#include <QNetworkAccessManager>
10#include <QObject>
11#include <QThread>
13
14inline Q_LOGGING_CATEGORY(CardPictureLoaderWorkerWorkLog, "card_picture_loader.worker");
15
17
30class CardPictureLoaderWorkerWork : public QObject
31{
32 Q_OBJECT
33public:
39 explicit CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad);
40
42
43public slots:
48 void handleNetworkReply(QNetworkReply *reply);
49
50private:
52
55
57 void picDownloadFailed();
58
60 void handleFailedReply(const QNetworkReply *reply);
61
63 void handleSuccessfulReply(QNetworkReply *reply);
64
70 QImage tryLoadImageFromReply(QNetworkReply *reply);
71
78 void concludeImageLoad(const QImage &image);
79
80private slots:
82 void picDownloadChanged();
83
84signals:
92 void imageLoaded(const ExactCard &card, const QImage &image);
93
95 void requestSucceeded(const QUrl &url);
96
98 void requestImageDownload(const QUrl &url, CardPictureLoaderWorkerWork *instance);
99
101 void urlRedirected(const QUrl &originalUrl, const QUrl &redirectUrl);
102
104 void cachedUrlInvalidated(const QUrl &url);
105};
106
107#endif // PICTURE_LOADER_WORKER_WORK_H
Q_LOGGING_CATEGORY(CardPictureLoaderWorkerWorkLog, "card_picture_loader.worker")
void cachedUrlInvalidated(const QUrl &url)
Emitted when a cached URL is invalid and must be removed.
void imageLoaded(const ExactCard &card, const QImage &image)
Emitted when the image has been loaded or all attempts failed.
QImage tryLoadImageFromReply(QNetworkReply *reply)
Attempts to read an image from a network reply.
Definition card_picture_loader_worker_work.cpp:173
void concludeImageLoad(const QImage &image)
Finalizes the image loading process.
Definition card_picture_loader_worker_work.cpp:196
void picDownloadChanged()
Updates the picDownload setting when it changes.
Definition card_picture_loader_worker_work.cpp:202
void requestSucceeded(const QUrl &url)
Emitted when a network request completes successfully.
void urlRedirected(const QUrl &originalUrl, const QUrl &redirectUrl)
Emitted when a URL has been redirected.
void picDownloadFailed()
Called when all URLs have been exhausted or download failed.
Definition card_picture_loader_worker_work.cpp:52
void handleNetworkReply(QNetworkReply *reply)
Handles a finished network reply for the card image.
Definition card_picture_loader_worker_work.cpp:70
bool picDownload
Whether network downloading is enabled.
Definition card_picture_loader_worker_work.h:51
void requestImageDownload(const QUrl &url, CardPictureLoaderWorkerWork *instance)
Request that a URL be downloaded.
CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad)
Constructs a worker for downloading a specific card image.
Definition card_picture_loader_worker_work.cpp:17
void handleFailedReply(const QNetworkReply *reply)
Processes a failed network reply.
Definition card_picture_loader_worker_work.cpp:98
CardPictureToLoad cardToDownload
The card and associated URLs to try downloading.
Definition card_picture_loader_worker_work.h:41
void startNextPicDownload()
Starts downloading the next URL for this card.
Definition card_picture_loader_worker_work.cpp:36
void handleSuccessfulReply(QNetworkReply *reply)
Processes a successful network reply.
Definition card_picture_loader_worker_work.cpp:125
Handles asynchronous loading of card images, both locally and via network.
Definition card_picture_loader_worker.h:41
Manages all URLs and sets for downloading a specific card image.
Definition card_picture_to_load.h:20
Represents a specific card instance, defined by its CardInfo and a particular printing.
Definition exact_card.h:19