diff options
Diffstat (limited to 'src/DownloadManager.cpp')
| -rw-r--r-- | src/DownloadManager.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index b637994..b61b171 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -58,7 +58,7 @@ void DownloadManager::startNextDownload() } // Start the request for this URL. QNetworkRequest request(url); - currentDownload = (*qnam).get(request); + currentDownload = qnam->get(request); QObject::connect(currentDownload, SIGNAL(readyRead()), this, SLOT(downloadReady())); QObject::connect(currentDownload, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64))); @@ -80,6 +80,10 @@ void DownloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal) { qDebug() << "Download progress of " << currentDownload->url().toString() << ": " << bytesIn << "/" << bytesTotal; + + qint64 tmp = ((bytesIn * 100) / bytesTotal); + emit updateProgress((int)tmp); + qDebug() << "progress in is: " << tmp << "(" << (int)tmp << ")"; } // ---------------------------------------------------------------------------------------- // This slot listens to the finished() which is emmited @@ -100,6 +104,8 @@ void DownloadManager::downloadFinished() currentDownload->deleteLater(); // Initialise next download. dip = false; + ++downloaded; + // qDebug() << "DM downloaded " << downloaded << "files"; startNextDownload(); } // ---------------------------------------------------------------------------------------- @@ -110,6 +116,7 @@ DownloadManager::DownloadManager(const QUrl& baseUrl) this->qnam = new QNetworkAccessManager(); this->baseUrl = baseUrl; dip = false; + downloaded = 0; } // Destructor. DownloadManager::~DownloadManager() |
