#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() { }