1#ifndef PICTURE_LOADER_WORKER_WORK_H
2#define PICTURE_LOADER_WORKER_WORK_H
8#include <QLoggingCategory>
10#include <QNetworkAccessManager>
12#include <QRandomGenerator>
Q_LOGGING_CATEGORY(CardPictureLoaderWorkerWorkLog, "card_picture_loader.worker")
void cachedUrlInvalidated(const QUrl &url)
Emitted when a cached URL is invalid and must be removed.
static ServerRateLimiter s_rateLimiter
Shared per-server 429 backoff state.
Definition card_picture_loader_worker_work.h:56
void rateLimited(const QString &host)
Emitted when a server returned HTTP 429.
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:253
void concludeImageLoad(const QImage &image)
Finalizes the image loading process.
Definition card_picture_loader_worker_work.cpp:312
void picDownloadChanged()
Updates the picDownload setting when it changes.
Definition card_picture_loader_worker_work.cpp:318
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:89
void handleNetworkReply(QNetworkReply *reply)
Handles a finished network reply for the card image.
Definition card_picture_loader_worker_work.cpp:107
bool picDownload
Whether network downloading is enabled.
Definition card_picture_loader_worker_work.h:54
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:25
void scheduleDeferredRetry()
Schedules a deferred retry after the relevant server backoff expires.
Definition card_picture_loader_worker_work.cpp:276
void handleFailedReply(const QNetworkReply *reply)
Processes a failed network reply.
Definition card_picture_loader_worker_work.cpp:141
CardPictureToLoad cardToDownload
The card and associated URLs to try downloading.
Definition card_picture_loader_worker_work.h:44
void startNextPicDownload()
Starts downloading the next URL for this card.
Definition card_picture_loader_worker_work.cpp:45
void handleSuccessfulReply(QNetworkReply *reply)
Processes a successful network reply.
Definition card_picture_loader_worker_work.cpp:202
Handles asynchronous loading of card images, both locally and via network.
Definition card_picture_loader_worker.h:43
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
Tracks per-server backoff state triggered by HTTP 429 responses.
Definition server_rate_limiter.h:19