From 1fe27ccc2e6dd5a4f17ac28aefaf0332c821aef5 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 22 Feb 2011 13:21:52 +0100 Subject: Code cleanup; few optimizations; download debug messages... --- src/DownloadManager.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/DownloadManager.cpp') diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index b508723..436518f 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -5,8 +5,8 @@ void DownloadManager::downloadFile(QString& filename) QUrl u = this->baseUrl.resolved(filename); this->request.setUrl(u); this->filename = filename; + qDebug() << "Downloading file: " << u.toString(); this->reply = this->qnam->get(this->request); - this->qiod = reply; QObject::connect(this->reply, SIGNAL(finished()), this, SLOT(saveData())); } @@ -18,14 +18,9 @@ void DownloadManager::saveData() qDebug() << "Couldnt open file! exiting..."; exit(1); } - outfile.write(this->qiod->readAll()); + outfile.write(this->reply->readAll()); outfile.close(); - -} - -void DownloadManager::setUrl(QUrl& qurl) -{ - this->baseUrl = qurl; + qDebug() << "Download done."; } void DownloadManager::print() @@ -33,9 +28,10 @@ void DownloadManager::print() qDebug() << "The download manager is still working"; } -DownloadManager::DownloadManager() +DownloadManager::DownloadManager(const QUrl& baseUrl) { this->qnam = new QNetworkAccessManager(); + this->baseUrl = baseUrl; } DownloadManager::~DownloadManager() -- cgit v1.2.3-55-g7522