Use DownloadHandler behind the scenes

This commit is contained in:
Vladimir Golovnev (Glassez) 2019-03-03 12:43:42 +03:00
parent 6cb15706f5
commit 746916a963
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
17 changed files with 325 additions and 409 deletions

View file

@ -33,7 +33,6 @@
#include <QUrlQuery>
#include "base/logger.h"
#include "base/net/downloadhandler.h"
#include "base/net/downloadmanager.h"
using namespace Net;
@ -74,9 +73,9 @@ void DNSUpdater::checkPublicIP()
{
Q_ASSERT(m_state == OK);
DownloadHandler *handler = DownloadManager::instance()->download(
DownloadRequest("http://checkip.dyndns.org").userAgent("qBittorrent/" QBT_VERSION_2));
connect(handler, &DownloadHandler::finished, this, &DNSUpdater::ipRequestFinished);
DownloadManager::instance()->download(
DownloadRequest("http://checkip.dyndns.org").userAgent("qBittorrent/" QBT_VERSION_2)
, this, &DNSUpdater::ipRequestFinished);
m_lastIPCheckTime = QDateTime::currentDateTime();
}
@ -116,9 +115,9 @@ void DNSUpdater::updateDNSService()
qDebug() << Q_FUNC_INFO;
m_lastIPCheckTime = QDateTime::currentDateTime();
DownloadHandler *handler = DownloadManager::instance()->download(
DownloadRequest(getUpdateUrl()).userAgent("qBittorrent/" QBT_VERSION_2));
connect(handler, &DownloadHandler::finished, this, &DNSUpdater::ipUpdateFinished);
DownloadManager::instance()->download(
DownloadRequest(getUpdateUrl()).userAgent("qBittorrent/" QBT_VERSION_2)
, this, &DNSUpdater::ipUpdateFinished);
}
QString DNSUpdater::getUpdateUrl() const