Handles downloading a single card image from network or local sources.
More...
#include <card_picture_loader_worker_work.h>
|
| void | handleNetworkReply (QNetworkReply *reply) |
| | Handles a finished network reply for the card image.
|
|
| bool | picDownload |
| | Whether network downloading is enabled.
|
Handles downloading a single card image from network or local sources.
Responsibilities:
- Try to load images from all possible URLs and sets for a given ExactCard.
- Handle network redirects and cache invalidation.
- Check for blacklisted images and discard them.
- Emit signals when image is successfully loaded or all attempts fail.
- Delete itself after loading completes.
◆ CardPictureLoaderWorkerWork()
Constructs a worker for downloading a specific card image.
- Parameters
-
◆ cachedUrlInvalidated
| void CardPictureLoaderWorkerWork::cachedUrlInvalidated |
( |
const QUrl & | url | ) |
|
|
signal |
Emitted when a cached URL is invalid and must be removed.
◆ concludeImageLoad()
| void CardPictureLoaderWorkerWork::concludeImageLoad |
( |
const QImage & | image | ) |
|
|
private |
Finalizes the image loading process.
- Parameters
-
| image | The loaded image (empty if failed) |
Emits imageLoaded() and deletes this object.
◆ handleFailedReply()
| void CardPictureLoaderWorkerWork::handleFailedReply |
( |
const QNetworkReply * | reply | ) |
|
|
private |
Processes a failed network reply.
◆ handleNetworkReply
| void CardPictureLoaderWorkerWork::handleNetworkReply |
( |
QNetworkReply * | reply | ) |
|
|
slot |
Handles a finished network reply for the card image.
- Parameters
-
| reply | The QNetworkReply object to process. Ownership is transferred. |
◆ handleSuccessfulReply()
| void CardPictureLoaderWorkerWork::handleSuccessfulReply |
( |
QNetworkReply * | reply | ) |
|
|
private |
Processes a successful network reply.
◆ imageLoaded
| void CardPictureLoaderWorkerWork::imageLoaded |
( |
const ExactCard & | card, |
|
|
const QImage & | image ) |
|
signal |
Emitted when the image has been loaded or all attempts failed.
- Parameters
-
| card | The card corresponding to the image |
| image | The loaded image (empty if failed) |
The worker deletes itself after emitting this signal.
◆ picDownloadChanged
| void CardPictureLoaderWorkerWork::picDownloadChanged |
( |
| ) |
|
|
privateslot |
Updates the picDownload setting when it changes.
◆ picDownloadFailed()
| void CardPictureLoaderWorkerWork::picDownloadFailed |
( |
| ) |
|
|
private |
Called when all URLs have been exhausted or download failed.
◆ rateLimited
| void CardPictureLoaderWorkerWork::rateLimited |
( |
const QString & | host | ) |
|
|
signal |
Emitted when a server returned HTTP 429.
◆ requestImageDownload
Request that a URL be downloaded.
◆ requestSucceeded
| void CardPictureLoaderWorkerWork::requestSucceeded |
( |
const QUrl & | url | ) |
|
|
signal |
Emitted when a network request completes successfully.
◆ scheduleDeferredRetry()
| void CardPictureLoaderWorkerWork::scheduleDeferredRetry |
( |
| ) |
|
|
private |
Schedules a deferred retry after the relevant server backoff expires.
Waits on the current URL's server when it is the reason we are blocked, otherwise on the earliest active backoff. If no servers are in backoff, concludes with failure. Otherwise resets the CardPictureToLoad indices and retries after the backoff period.
◆ startNextPicDownload()
| void CardPictureLoaderWorkerWork::startNextPicDownload |
( |
| ) |
|
|
private |
Starts downloading the next URL for this card.
◆ tryLoadImageFromReply()
| QImage CardPictureLoaderWorkerWork::tryLoadImageFromReply |
( |
QNetworkReply * | reply | ) |
|
|
private |
Attempts to read an image from a network reply.
- Parameters
-
- Returns
- The loaded QImage or an empty image if reading failed
◆ urlRedirected
| void CardPictureLoaderWorkerWork::urlRedirected |
( |
const QUrl & | originalUrl, |
|
|
const QUrl & | redirectUrl ) |
|
signal |
Emitted when a URL has been redirected.
◆ cardToDownload
The card and associated URLs to try downloading.
◆ picDownload
| bool CardPictureLoaderWorkerWork::picDownload |
|
private |
Whether network downloading is enabled.
◆ s_rateLimiter
Shared per-server 429 backoff state.
The documentation for this class was generated from the following files: