Skip to content

Commit

Permalink
Rename method, docs and api breaks documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 18, 2017
1 parent 30da28a commit 406425d
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 108 deletions.
9 changes: 9 additions & 0 deletions doc/api_break.dox
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,15 @@ QgsFieldProxyModel {#qgis_api_break_3_0_QgsFieldProxyModel}
- In QgsFieldProxyModel::Filter, All has been renamed to AllTypes


QgsFileDownloader {#qgis_api_break_3_0_QgsFileDownloader}
-----------------

- In 2.x QgsFileDownloader was a gui library class. In 3.0 its functionality has been split into
two new classes - a core QgsFileDownloader class, which handles just the file download functionality
and contains no GUI progress bar dialog, and a separate QgsFileDownloaderDialog class which
incorporates a QgsFileDownloader together with a user-visible progress bar dialog


QgsGeometry {#qgis_api_break_3_0_QgsGeometry}
-----------

Expand Down
20 changes: 12 additions & 8 deletions python/core/qgsfiledownloader.sip
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class QgsFileDownloader : QObject
The object will destroy itself when the request completes, errors or is canceled.
An optional authentication configuration can be specified.

.. versionadded:: 2.18.1
.. note::

This class was part of the GUI library from QGIS 2.18.1 until QGIS 3.0
.. versionadded:: 3.0
%End

%TypeHeaderCode
Expand Down Expand Up @@ -51,10 +54,13 @@ Emitted when the download has completed successfully
%Docstring
Emitted always when the downloader exits
%End

void downloadCanceled();
%Docstring
Emitted when the download was canceled by the user
Emitted when the download was canceled by the user.
.. seealso:: cancelDownload()
%End

void downloadError( QStringList errorMessages );
%Docstring
Emitted when an error makes the download fail
Expand All @@ -66,13 +72,11 @@ Emitted when data are ready to be processed

public slots:

void onDownloadCanceled();
void cancelDownload();
%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.
Call to abort the download and delete this object after the cancelation
has been processed.
.. seealso:: downloadCanceled()
%End

void startDownload();
Expand Down
88 changes: 0 additions & 88 deletions python/gui/qgsfiledownloader.sip

This file was deleted.

4 changes: 4 additions & 0 deletions python/gui/qgsfiledownloaderdialog.sip
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class QgsFileDownloaderDialog : QProgressDialog
while showing progress via a progress dialog and supporting
cancelation.

.. note::

Until QGIS 3.0 this functionality was available via QgsFileDownloader.

.. versionadded:: 3.0
%End

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsfiledownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void QgsFileDownloader::startDownload()
#endif
}

void QgsFileDownloader::onDownloadCanceled()
void QgsFileDownloader::cancelDownload()
{
mDownloadCanceled = true;
emit downloadCanceled();
Expand Down
20 changes: 12 additions & 8 deletions src/core/qgsfiledownloader.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
* 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
* \note This class was part of the GUI library from QGIS 2.18.1 until QGIS 3.0
* \since QGIS 3.0
*/
class CORE_EXPORT QgsFileDownloader : public QObject
{
Expand All @@ -61,8 +62,13 @@ class CORE_EXPORT QgsFileDownloader : public QObject
void downloadCompleted();
//! Emitted always when the downloader exits
void downloadExited();
//! Emitted when the download was canceled by the user

/**
* Emitted when the download was canceled by the user.
* \see cancelDownload()
*/
void downloadCanceled();

//! Emitted when an error makes the download fail
void downloadError( QStringList errorMessages );
//! Emitted when data are ready to be processed
Expand All @@ -71,13 +77,11 @@ class CORE_EXPORT QgsFileDownloader : public QObject
public slots:

/**
* 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.
* Call to abort the download and delete this object after the cancelation
* has been processed.
* \see downloadCanceled()
*/
void onDownloadCanceled();
void cancelDownload();

//! Called to start the download
void startDownload();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsfiledownloaderdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QgsFileDownloaderDialog::QgsFileDownloaderDialog( const QUrl &url, const QString
setLabelText( tr( "Downloading %1." ).arg( outputFileName ) );
show();

connect( this, &QProgressDialog::canceled, mDownloader, &QgsFileDownloader::onDownloadCanceled );
connect( this, &QProgressDialog::canceled, mDownloader, &QgsFileDownloader::cancelDownload );
connect( mDownloader, &QgsFileDownloader::downloadError, this, &QgsFileDownloaderDialog::onError );
connect( mDownloader, &QgsFileDownloader::downloadProgress, this, &QgsFileDownloaderDialog::onDownloadProgress );
connect( mDownloader, &QgsFileDownloader::downloadExited, this, &QgsFileDownloaderDialog::deleteLater );
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsfiledownloaderdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class QgsFileDownloader;
* while showing progress via a progress dialog and supporting
* cancelation.
*
* \note Until QGIS 3.0 this functionality was available via QgsFileDownloader.
*
* \since QGIS 3.0
*/
class GUI_EXPORT QgsFileDownloaderDialog : public QProgressDialog
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gui/testqgsfiledownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void TestQgsFileDownloader::makeCall( QUrl url, QString fileName, bool cancel )
connect( mFileDownloader, &QgsFileDownloader::downloadExited, &loop, &QEventLoop::quit );

if ( cancel )
QTimer::singleShot( 1000, mFileDownloader, &QgsFileDownloader::onDownloadCanceled );
QTimer::singleShot( 1000, mFileDownloader, &QgsFileDownloader::cancelDownload );

loop.exec();

Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsfiledownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _make_download(self, url, destination, cancel=False):
downloader.downloadExited.connect(loop.quit)

if cancel:
downloader.downloadProgress.connect(downloader.onDownloadCanceled)
downloader.downloadProgress.connect(downloader.cancelDownload)

loop.exec_()

Expand Down

0 comments on commit 406425d

Please sign in to comment.