From acdd731bf92d6b3fb3b7c41c2954a6e07828651a Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Tue, 1 Feb 2011 18:19:00 +0100 Subject: fix vtable error --- src/DownloadManager.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/DownloadManager.cpp (limited to 'src/DownloadManager.cpp') diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp new file mode 100644 index 0000000..73d979e --- /dev/null +++ b/src/DownloadManager.cpp @@ -0,0 +1,42 @@ +#include "DownloadManager.h" + +void DownloadManager::downloadFile(QString& filename) +{ + this->filename = filename; + this->reply = this->qnam->get(this->request); + qiod = reply; + QObject::connect(this->reply, SIGNAL(finished()), this, SLOT(saveData())); +} + +void DownloadManager::saveData() +{ + QFile outfile(this->filename); + if (!outfile.open(QIODevice::WriteOnly)) + { + qDebug() << "Couldnt open file! exiting..."; + exit(1); + } + outfile.write(this->reply->readAll()); + outfile.close(); + +} + +void DownloadManager::setUrl(QUrl& qurl) +{ + this->baseUrl = qurl; +} + +void DownloadManager::print() +{ + qDebug() << "The download manager is still working"; +} + +DownloadManager::DownloadManager() +{ + this->qnam = new QNetworkAccessManager(); + this->request.setUrl(baseUrl); +} + +DownloadManager::~DownloadManager() +{ +} -- cgit v1.2.3-55-g7522