19#ifndef QGSNETWORKCONTENTFETCHERREGISTRY_H
20#define QGSNETWORKCONTENTFETCHERREGISTRY_H
25#include <QNetworkReply>
27#include <QTemporaryFile>
56 const QString &authConfig = QString() )
60 , mAuthConfig( authConfig )
73 QFile *
file()
const {
return mFile;}
77 const QString
filePath()
const {
return mFilePath;}
83 QNetworkReply::NetworkError
error()
const {
return mError;}
96 void download(
bool redownload =
false );
112 void errorOccurred( QNetworkReply::NetworkError code,
const QString &errorMsg );
115 void taskCompleted();
119 QTemporaryFile *mFile =
nullptr;
121 QPointer< QgsNetworkContentFetcherTask > mFetchingTask;
123 QNetworkReply::NetworkError mError = QNetworkReply::NoError;
125 QString mErrorString;
165 QFile *localFile(
const QString &filePathOrUrl );
172 QString localPath(
const QString &filePathOrUrl );
175 QMap<QString, QgsFetchedContent *> mFileRegistry;
ActionStart
Enum to determine when an operation would begin.
@ Deferred
Do not start immediately the action.
FetchedContent holds useful information about a network content being fetched.
QNetworkReply::NetworkError error() const
Returns the potential error of the download.
~QgsFetchedContent() override
QFile * file() const
Returns a pointer to the local file, or nullptr if the file is not accessible yet.
ContentStatus status() const
Returns the status of the download.
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.
const QString filePath() const
Returns the path to the local file, an empty string if the file is not accessible yet.
void errorOccurred(QNetworkReply::NetworkError code, const QString &errorMsg)
Emitted when an error with code error occurred while processing the request errorMsg is a textual des...
ContentStatus
Status of fetched content.
@ Finished
Download finished and successful.
@ NotStarted
No download started for such URL.
@ Downloading
Currently downloading.
void fetched()
Emitted when the file is fetched and accessible.
QString authConfig() const
Returns the authentication configuration id use for this fetched content.
Registry for temporary fetched files.
QgsNetworkContentFetcherRegistry()=default
Create the registry for temporary downloaded files.