Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardPictureLoaderWorkerWork Class Reference

Handles downloading a single card image from network or local sources. More...

#include <card_picture_loader_worker_work.h>

Inheritance diagram for CardPictureLoaderWorkerWork:
[legend]
Collaboration diagram for CardPictureLoaderWorkerWork:
[legend]

Public Slots

void handleNetworkReply (QNetworkReply *reply)
 Handles a finished network reply for the card image.

Signals

void imageLoaded (const ExactCard &card, const QImage &image)
 Emitted when the image has been loaded or all attempts failed.
void requestSucceeded (const QUrl &url)
 Emitted when a network request completes successfully.
void requestImageDownload (const QUrl &url, CardPictureLoaderWorkerWork *instance)
 Request that a URL be downloaded.
void urlRedirected (const QUrl &originalUrl, const QUrl &redirectUrl)
 Emitted when a URL has been redirected.
void cachedUrlInvalidated (const QUrl &url)
 Emitted when a cached URL is invalid and must be removed.

Public Member Functions

 CardPictureLoaderWorkerWork (const CardPictureLoaderWorker *worker, const ExactCard &toLoad)
 Constructs a worker for downloading a specific card image.

Public Attributes

CardPictureToLoad cardToDownload
 The card and associated URLs to try downloading.

Private Slots

void picDownloadChanged ()
 Updates the picDownload setting when it changes.

Private Member Functions

void startNextPicDownload ()
 Starts downloading the next URL for this card.
void picDownloadFailed ()
 Called when all URLs have been exhausted or download failed.
void handleFailedReply (const QNetworkReply *reply)
 Processes a failed network reply.
void handleSuccessfulReply (QNetworkReply *reply)
 Processes a successful network reply.
QImage tryLoadImageFromReply (QNetworkReply *reply)
 Attempts to read an image from a network reply.
void concludeImageLoad (const QImage &image)
 Finalizes the image loading process.

Private Attributes

bool picDownload
 Whether network downloading is enabled.

Detailed Description

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.

Constructor & Destructor Documentation

◆ CardPictureLoaderWorkerWork()

CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork ( const CardPictureLoaderWorker * worker,
const ExactCard & toLoad )
explicit

Constructs a worker for downloading a specific card image.

Parameters
workerThe orchestrating CardPictureLoaderWorker
toLoadThe ExactCard to download
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ cachedUrlInvalidated

void CardPictureLoaderWorkerWork::cachedUrlInvalidated ( const QUrl & url)
signal

Emitted when a cached URL is invalid and must be removed.

Here is the caller graph for this function:

◆ concludeImageLoad()

void CardPictureLoaderWorkerWork::concludeImageLoad ( const QImage & image)
private

Finalizes the image loading process.

Parameters
imageThe loaded image (empty if failed)

Emits imageLoaded() and deletes this object.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleFailedReply()

void CardPictureLoaderWorkerWork::handleFailedReply ( const QNetworkReply * reply)
private

Processes a failed network reply.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleNetworkReply

void CardPictureLoaderWorkerWork::handleNetworkReply ( QNetworkReply * reply)
slot

Handles a finished network reply for the card image.

Parameters
replyThe QNetworkReply object to process. Ownership is transferred.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSuccessfulReply()

void CardPictureLoaderWorkerWork::handleSuccessfulReply ( QNetworkReply * reply)
private

Processes a successful network reply.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ imageLoaded

void CardPictureLoaderWorkerWork::imageLoaded ( const ExactCard & card,
const QImage & image )
signal

Emitted when the image has been loaded or all attempts failed.

Parameters
cardThe card corresponding to the image
imageThe loaded image (empty if failed)

The worker deletes itself after emitting this signal.

Here is the caller graph for this function:

◆ picDownloadChanged

void CardPictureLoaderWorkerWork::picDownloadChanged ( )
privateslot

Updates the picDownload setting when it changes.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ picDownloadFailed()

void CardPictureLoaderWorkerWork::picDownloadFailed ( )
private

Called when all URLs have been exhausted or download failed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestImageDownload

void CardPictureLoaderWorkerWork::requestImageDownload ( const QUrl & url,
CardPictureLoaderWorkerWork * instance )
signal

Request that a URL be downloaded.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestSucceeded

void CardPictureLoaderWorkerWork::requestSucceeded ( const QUrl & url)
signal

Emitted when a network request completes successfully.

Here is the caller graph for this function:

◆ startNextPicDownload()

void CardPictureLoaderWorkerWork::startNextPicDownload ( )
private

Starts downloading the next URL for this card.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryLoadImageFromReply()

QImage CardPictureLoaderWorkerWork::tryLoadImageFromReply ( QNetworkReply * reply)
private

Attempts to read an image from a network reply.

Parameters
replyThe network reply
Returns
The loaded QImage or an empty image if reading failed
Here is the caller graph for this function:

◆ urlRedirected

void CardPictureLoaderWorkerWork::urlRedirected ( const QUrl & originalUrl,
const QUrl & redirectUrl )
signal

Emitted when a URL has been redirected.

Here is the caller graph for this function:

Member Data Documentation

◆ cardToDownload

CardPictureToLoad CardPictureLoaderWorkerWork::cardToDownload

The card and associated URLs to try downloading.

◆ picDownload

bool CardPictureLoaderWorkerWork::picDownload
private

Whether network downloading is enabled.


The documentation for this class was generated from the following files: