QGIS API Documentation  2.99.0-Master (f867b65)
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsFileDownloader Class Reference

QgsFileDownloader is a utility class for downloading files. More...

#include <qgsfiledownloader.h>

Inheritance diagram for QgsFileDownloader:
Inheritance graph
[legend]

Public Slots

void onDownloadCanceled ()
 Called when a download is canceled by the user this slot aborts the download and deletes the object. More...
 

Signals

void downloadCanceled ()
 Emitted when the download was canceled by the user. More...
 
void downloadCompleted ()
 Emitted when the download has completed successfully. More...
 
void downloadError (QStringList errorMessages)
 Emitted when an error makes the download fail. More...
 
void downloadExited ()
 Emitted always when the downloader exits. More...
 
void downloadProgress (qint64 bytesReceived, qint64 bytesTotal)
 Emitted when data are ready to be processed. More...
 

Public Member Functions

 QgsFileDownloader (const QUrl &url, const QString &outputFileName, bool guiNotificationsEnabled=true, QString authcfg=QString())
 QgsFileDownloader. More...
 

Protected Member Functions

 ~QgsFileDownloader ()
 

Detailed Description

QgsFileDownloader is a utility class for downloading files.

To use this class, it is necessary to pass the URL and an output file name as arguments to the constructor, the download will start immediately. The download is asynchronous and depending on the guiNotificationsEnabled parameter accepted by the constructor (default = true) the class will show a progress dialog and report all errors in a QMessageBox::warning dialog. If the guiNotificationsEnabled parameter is set to false, the class can still be used through the signals and slots mechanism. The object will destroy itself when the request completes, errors or is canceled. An optional authentication configuration can be specified.

Since
QGIS 2.18.1

Definition at line 44 of file qgsfiledownloader.h.

Constructor & Destructor Documentation

◆ QgsFileDownloader()

QgsFileDownloader::QgsFileDownloader ( const QUrl &  url,
const QString &  outputFileName,
bool  guiNotificationsEnabled = true,
QString  authcfg = QString() 
)

QgsFileDownloader.

Parameters
urlthe download url
outputFileNamefile name where the downloaded content will be stored
guiNotificationsEnabledif false, the downloader will not display any progress bar or error message
authcfgoptionally apply this authentication configuration

Definition at line 29 of file qgsfiledownloader.cpp.

◆ ~QgsFileDownloader()

QgsFileDownloader::~QgsFileDownloader ( )
protected

Definition at line 44 of file qgsfiledownloader.cpp.

Member Function Documentation

◆ downloadCanceled

void QgsFileDownloader::downloadCanceled ( )
signal

Emitted when the download was canceled by the user.

◆ downloadCompleted

void QgsFileDownloader::downloadCompleted ( )
signal

Emitted when the download has completed successfully.

◆ downloadError

void QgsFileDownloader::downloadError ( QStringList  errorMessages)
signal

Emitted when an error makes the download fail.

◆ downloadExited

void QgsFileDownloader::downloadExited ( )
signal

Emitted always when the downloader exits.

◆ downloadProgress

void QgsFileDownloader::downloadProgress ( qint64  bytesReceived,
qint64  bytesTotal 
)
signal

Emitted when data are ready to be processed.

◆ onDownloadCanceled

void QgsFileDownloader::onDownloadCanceled ( )
slot

Called when a download is canceled by the user this slot aborts the download and deletes the object.

Never call this slot directly: this is meant to be managed by the signal-slot system.

Definition at line 100 of file qgsfiledownloader.cpp.


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