Skip to content
Permalink
Browse files

Added note and removed debug output

  • Loading branch information
elpaso committed Nov 9, 2016
1 parent bdc2e24 commit 8b231ec7e32b4ef2d0e04a047b211692dc58b7f3
Showing with 4 additions and 9 deletions.
  1. +2 −0 python/gui/qgsfiledownloader.sip
  2. +0 −9 src/gui/qgsfiledownloader.cpp
  3. +2 −0 src/gui/qgsfiledownloader.h
@@ -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
{
@@ -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 );
@@ -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
{
@@ -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 );
@@ -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;
@@ -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
{

0 comments on commit 8b231ec

Please sign in to comment.
You can’t perform that action at this time.