Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split QgsFileDownloader into separate core/gui classes
So that the guts of this class can be used from non-gui code
- Loading branch information
1 parent
a406739
commit 587072c
Showing
13 changed files
with
311 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsfiledownloader.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsFileDownloader : QObject | ||
{ | ||
%Docstring | ||
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. | ||
|
||
The object will destroy itself when the request completes, errors or is canceled. | ||
An optional authentication configuration can be specified. | ||
|
||
.. versionadded:: 2.18.1 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsfiledownloader.h" | ||
%End | ||
public: | ||
|
||
QgsFileDownloader( const QUrl &url, const QString &outputFileName, const QString &authcfg = QString(), bool delayStart = false ); | ||
%Docstring | ||
QgsFileDownloader | ||
\param url the download url | ||
\param outputFileName file name where the downloaded content will be stored | ||
\param authcfg optionally apply this authentication configuration | ||
\param delayStart if true, the download will not be commenced immediately and must | ||
be triggered by a later call to startDownload(). This can be useful if connections need | ||
to be made to the downloader and there's a chance the download will emit | ||
signals before these connections have been made. | ||
%End | ||
|
||
signals: | ||
void downloadCompleted(); | ||
%Docstring | ||
Emitted when the download has completed successfully | ||
%End | ||
void downloadExited(); | ||
%Docstring | ||
Emitted always when the downloader exits | ||
%End | ||
void downloadCanceled(); | ||
%Docstring | ||
Emitted when the download was canceled by the user | ||
%End | ||
void downloadError( QStringList errorMessages ); | ||
%Docstring | ||
Emitted when an error makes the download fail | ||
%End | ||
void downloadProgress( qint64 bytesReceived, qint64 bytesTotal ); | ||
%Docstring | ||
Emitted when data are ready to be processed | ||
%End | ||
|
||
public slots: | ||
|
||
void onDownloadCanceled(); | ||
%Docstring | ||
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. | ||
%End | ||
|
||
void startDownload(); | ||
%Docstring | ||
Called to start the download | ||
%End | ||
|
||
protected: | ||
~QgsFileDownloader(); | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsfiledownloader.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsfiledownloaderdialog.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsFileDownloaderDialog : QProgressDialog | ||
{ | ||
%Docstring | ||
QgsFileDownloaderDialog is a QProgressDialog subclass which | ||
handles file downloads and user feedback. | ||
|
||
Internally, it uses QgsFileDownloader to handle the download, | ||
while showing progress via a progress dialog and supporting | ||
cancelation. | ||
|
||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsfiledownloaderdialog.h" | ||
%End | ||
public: | ||
|
||
QgsFileDownloaderDialog( const QUrl &url, const QString &outputFileName, const QString &authcfg = QString() ); | ||
%Docstring | ||
QgsFileDownloader | ||
\param url the download url | ||
\param outputFileName file name where the downloaded content will be stored | ||
\param authcfg optionally apply this authentication configuration | ||
%End | ||
|
||
signals: | ||
void downloadCompleted(); | ||
%Docstring | ||
Emitted when the download has completed successfully | ||
%End | ||
void downloadExited(); | ||
%Docstring | ||
Emitted always when the downloader exits | ||
%End | ||
void downloadCanceled(); | ||
%Docstring | ||
Emitted when the download was canceled by the user | ||
%End | ||
void downloadError( QStringList errorMessages ); | ||
%Docstring | ||
Emitted when an error makes the download fail | ||
%End | ||
void downloadProgress( qint64 bytesReceived, qint64 bytesTotal ); | ||
%Docstring | ||
Emitted when data are ready to be processed | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsfiledownloaderdialog.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.