summaryrefslogtreecommitdiffstats
path: root/src/DownloadManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/DownloadManager.cpp')
-rw-r--r--src/DownloadManager.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp
index 9f59010..ec723a9 100644
--- a/src/DownloadManager.cpp
+++ b/src/DownloadManager.cpp
@@ -96,6 +96,7 @@ void DownloadManager::startNextDownload()
return;
}
dip = true;
+ currentProgress = 0;
QObject::connect(currentDownload, SIGNAL(readyRead()), this, SLOT(downloadReady()));
QObject::connect(currentDownload, SIGNAL(downloadProgress(qint64, qint64)),
this, SLOT(downloadProgress(qint64, qint64)));
@@ -111,15 +112,20 @@ void DownloadManager::downloadReady()
outfile.write(currentDownload->readAll());
}
// ----------------------------------------------------------------------------------------
-// This slot listens to the downloadProgress(..)
-// which provides information on the download progress of the file.
+// This triggers sends the update progress back to the site.
void DownloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal)
{
if (debug) qDebug() << "Download progress of " << currentDownload->url().toString()
<< ": " << bytesIn << "/" << bytesTotal;
- qint64 tmp = ((bytesIn * 100) / bytesTotal);
- emit updateProgress(currentDownload->url().toString(), (int)tmp);
+
+ int tmp = ((bytesIn * 100) / bytesTotal);
+ if (tmp > currentProgress){
+ currentProgress = tmp;
+ emit updateProgress(currentDownload->url().toString(), tmp);
+ }
+ // Progress difference < 1%
+ return;
}
// ----------------------------------------------------------------------------------------
// This slot listens to the finished() which is emmited