18
18
#include "downloadmanager.h"
21
#include <QTemporaryFile>
22
#include <QTextStream>
24
24
DownloadManager::DownloadManager()
28
bool DownloadManager::downloadToFile(const QUrl &url)
28
void DownloadManager::setHashCalculation(HashUtils::HashType /*type*/)
32
bool DownloadManager::downloadToProcess(const QUrl &url, QProcess *process)
30
34
m_lastDownloadedUrl = url;
31
QMetaObject::invokeMethod(this, "downloadFinished", Qt::QueuedConnection, Q_ARG(bool, true));
35
QTemporaryFile *DownloadManager::file()
37
QTemporaryFile *f = new QTemporaryFile();
40
36
const QString fileContentToReturn = m_filesContentToReturn.front();
41
37
if (m_filesContentToReturn.count() > 1) {
42
38
m_filesContentToReturn.pop_front();
45
QFile f2(fileContentToReturn);
46
f2.open(QIODevice::ReadOnly);
47
f->write(f2.readAll());
41
QFile f(fileContentToReturn);
42
f.open(QIODevice::ReadOnly);
43
process->write(f.readAll());
44
process->closeWriteChannel();
47
QMetaObject::invokeMethod(this, "downloadFinished", Qt::QueuedConnection, Q_ARG(bool, true), Q_ARG(quint64, 1234));
51
QByteArray DownloadManager::hash() const
53
56
#include "downloadmanager.moc"