QGIS API Documentation  3.24.2-Tisler (13c1a02865)
Public Types | Public Slots | Signals | Public Member Functions | List of all members
QgsFetchedContent Class Reference

FetchedContent holds useful information about a network content being fetched. More...

#include <qgsnetworkcontentfetcherregistry.h>

Inheritance diagram for QgsFetchedContent:
Inheritance graph
[legend]

Public Types

enum  ContentStatus { NotStarted , Downloading , Finished , Failed }
 Status of fetched content. More...
 

Public Slots

void cancel ()
 Cancel the download operation. More...
 
void download (bool redownload=false)
 Start the download. More...
 

Signals

void errorOccurred (QNetworkReply::NetworkError code, const QString &errorMsg)
 Emitted when an error with code error occurred while processing the request errorMsg is a textual description of the error. More...
 
void fetched ()
 Emitted when the file is fetched and accessible. More...
 

Public Member Functions

 QgsFetchedContent (const QString &url, QTemporaryFile *file=nullptr, ContentStatus status=NotStarted, const QString &authConfig=QString())
 Constructs a FetchedContent with pointer to the downloaded file and status of the download. More...
 
 ~QgsFetchedContent () override
 
QString authConfig () const
 Returns the authentication configuration id use for this fetched content. More...
 
QNetworkReply::NetworkError error () const
 Returns the potential error of the download. More...
 
QFile * file () const
 Returns a pointer to the local file, or nullptr if the file is not accessible yet. More...
 
const QString filePath () const
 Returns the path to the local file, an empty string if the file is not accessible yet. More...
 
ContentStatus status () const
 Returns the status of the download. More...
 

Detailed Description

FetchedContent holds useful information about a network content being fetched.

See also
QgsNetworkContentFetcherRegistry
Since
QGIS 3.2

Definition at line 40 of file qgsnetworkcontentfetcherregistry.h.

Member Enumeration Documentation

◆ ContentStatus

Status of fetched content.

Enumerator
NotStarted 

No download started for such URL.

Downloading 

Currently downloading.

Finished 

Download finished and successful.

Failed 

Download failed.

Definition at line 45 of file qgsnetworkcontentfetcherregistry.h.

Constructor & Destructor Documentation

◆ QgsFetchedContent()

QgsFetchedContent::QgsFetchedContent ( const QString &  url,
QTemporaryFile *  file = nullptr,
ContentStatus  status = NotStarted,
const QString &  authConfig = QString() 
)
inlineexplicit

Constructs a FetchedContent with pointer to the downloaded file and status of the download.

Definition at line 54 of file qgsnetworkcontentfetcherregistry.h.

◆ ~QgsFetchedContent()

QgsFetchedContent::~QgsFetchedContent ( )
inlineoverride

Definition at line 62 of file qgsnetworkcontentfetcherregistry.h.

Member Function Documentation

◆ authConfig()

QString QgsFetchedContent::authConfig ( ) const
inline

Returns the authentication configuration id use for this fetched content.

Definition at line 87 of file qgsnetworkcontentfetcherregistry.h.

◆ cancel

void QgsFetchedContent::cancel ( )
slot

Cancel the download operation.

Definition at line 142 of file qgsnetworkcontentfetcherregistry.cpp.

◆ download

void QgsFetchedContent::download ( bool  redownload = false)
slot

Start the download.

Parameters
redownloadif set to true, it will restart any achieved or pending download.

Definition at line 116 of file qgsnetworkcontentfetcherregistry.cpp.

◆ error()

QNetworkReply::NetworkError QgsFetchedContent::error ( ) const
inline

Returns the potential error of the download.

Definition at line 82 of file qgsnetworkcontentfetcherregistry.h.

◆ errorOccurred

void QgsFetchedContent::errorOccurred ( QNetworkReply::NetworkError  code,
const QString &  errorMsg 
)
signal

Emitted when an error with code error occurred while processing the request errorMsg is a textual description of the error.

Since
QGIS 3.22

◆ fetched

void QgsFetchedContent::fetched ( )
signal

Emitted when the file is fetched and accessible.

◆ file()

QFile* QgsFetchedContent::file ( ) const
inline

Returns a pointer to the local file, or nullptr if the file is not accessible yet.

Definition at line 72 of file qgsnetworkcontentfetcherregistry.h.

◆ filePath()

const QString QgsFetchedContent::filePath ( ) const
inline

Returns the path to the local file, an empty string if the file is not accessible yet.

Definition at line 76 of file qgsnetworkcontentfetcherregistry.h.

◆ status()

ContentStatus QgsFetchedContent::status ( ) const
inline

Returns the status of the download.

Definition at line 79 of file qgsnetworkcontentfetcherregistry.h.


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