Skip to content

Commit

Permalink
Added note and removed debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 9, 2016
1 parent bdc2e24 commit 8b231ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 2 additions & 0 deletions python/gui/qgsfiledownloader.sip
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* 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.
*
* @note added in QGIS 2.18.1
*/
class QgsFileDownloader : public QObject
{
Expand Down
9 changes: 0 additions & 9 deletions src/gui/qgsfiledownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ QgsFileDownloader::~QgsFileDownloader()
{
mProgressDialog->deleteLater();
}
qDebug() << "QgsFileDownloader instance deleted!" << this;
}


void QgsFileDownloader::startDownload()
{
qDebug() << "QgsFileDownloader instance started!" << this << mUrl;
QgsNetworkAccessManager* nam = QgsNetworkAccessManager::instance();

QNetworkRequest request( mUrl );
Expand Down Expand Up @@ -142,15 +140,13 @@ void QgsFileDownloader::onReadyRead()

void QgsFileDownloader::onFinished()
{
qDebug() << "QgsFileDownloader instance finished!" << this;
// when canceled
if ( ! mErrors.isEmpty() || mDownloadCanceled )
{
mFile.close();
mFile.remove();
if ( mGuiNotificationsEnabled )
mProgressDialog->hide();
qDebug() << "Deleting on error";
}
else
{
Expand All @@ -170,7 +166,6 @@ void QgsFileDownloader::onFinished()
else if ( !redirectionTarget.isNull() )
{
QUrl newUrl = mUrl.resolved( redirectionTarget.toUrl() );
qDebug( ) << QString( "Redirecting to: %1" ).arg( newUrl.toString( ) );
mUrl = newUrl;
mReply->deleteLater();
mFile.open( QIODevice::WriteOnly );
Expand All @@ -180,24 +175,20 @@ void QgsFileDownloader::onFinished()
return;
}
// All done
qDebug( ) << "Download completed successfully";
emit downloadCompleted();
}
qDebug( ) << "Download exited" << this;
emit downloadExited();
this->deleteLater();
}

void QgsFileDownloader::onNetworkError( QNetworkReply::NetworkError err )
{
Q_ASSERT( mReply );
qDebug( ) << QString( "Network error %1: %2" ).arg( err ).arg( mReply->errorString() );
error( QString( "Network error %1: %2" ).arg( err ).arg( mReply->errorString() ) );
}

void QgsFileDownloader::onDownloadProgress( qint64 bytesReceived, qint64 bytesTotal )
{
//qDebug() << QString("Downloading %1 of %2!").arg(bytesReceived).arg(bytesTotal);
if ( mDownloadCanceled )
{
return;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsfiledownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
* 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.
*
* @note added in QGIS 2.18.1
*/
class GUI_EXPORT QgsFileDownloader : public QObject
{
Expand Down

0 comments on commit 8b231ec

Please sign in to comment.