void Dowloader
::startRequest(const QUrl &url
) {
QNetworkRequest request(url);
reply = manager.get(request);
QHash<QNetworkReply
*,
QFile*>
::iterator i
= downloads
->insert
( reply,
file);
downloads->insert(reply, file);
signalMapper->setMapping(i.key(), i.value());
connect(i.key(), SIGNAL(readyRead()), signalMapper, SLOT(map()));
connect(i.key(), SIGNAL(finished()), signalMapper, SLOT(map()));
connect(signalMapper,
SIGNAL(mapped
(QObject*)),
this,
SLOT(httpReadyRead
(QObject*)));
connect(signalMapper,
SIGNAL(mapped
(QObject*)),
this,
SLOT(httpFinished
(QObject*)));
}
void Dowloader::startRequest(const QUrl &url)
{
QNetworkRequest request(url);
reply = manager.get(request);
QHash<QNetworkReply*, QFile*>::iterator i = downloads->insert( reply, file);
downloads->insert(reply, file);
signalMapper->setMapping(i.key(), i.value());
connect(i.key(), SIGNAL(readyRead()), signalMapper, SLOT(map()));
connect(i.key(), SIGNAL(finished()), signalMapper, SLOT(map()));
connect(signalMapper, SIGNAL(mapped(QObject*)), this, SLOT(httpReadyRead(QObject*)));
connect(signalMapper, SIGNAL(mapped(QObject*)), this, SLOT(httpFinished(QObject*)));
}
To copy to clipboard, switch view to plain text mode
Bookmarks