summaryrefslogtreecommitdiffstats
path: root/src/DownloadManager.cpp
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-04 21:05:12 +0100
committerJonathan Bauer2011-03-04 21:05:12 +0100
commit9e5705b50b1187807e753888aebdbbb11b362bcb (patch)
tree33b803d07841411718cca8686b16216de8bd092b /src/DownloadManager.cpp
parentAdded javascript functionality for download manager.. (diff)
downloadfbgui-9e5705b50b1187807e753888aebdbbb11b362bcb.tar.gz
fbgui-9e5705b50b1187807e753888aebdbbb11b362bcb.tar.xz
fbgui-9e5705b50b1187807e753888aebdbbb11b362bcb.zip
Progress bar for downloads (using jQuery) fixed
Diffstat (limited to 'src/DownloadManager.cpp')
-rw-r--r--src/DownloadManager.cpp9
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()