mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
Use DownloadHandler behind the scenes
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrentinfo.h"
|
||||
#include "base/global.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/settingsstorage.h"
|
||||
@@ -237,9 +236,9 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
|
||||
|
||||
if (Net::DownloadManager::hasSupportedScheme(source)) {
|
||||
// Launch downloader
|
||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(source).limit(10485760 /* 10MB */));
|
||||
connect(handler, &Net::DownloadHandler::finished, dlg, &AddNewTorrentDialog::handleDownloadFinished);
|
||||
Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(source).limit(10485760 /* 10MB */)
|
||||
, dlg, &AddNewTorrentDialog::handleDownloadFinished);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
@@ -2018,9 +2017,9 @@ void MainWindow::installPython()
|
||||
const QString installerURL = ((QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
|
||||
? "https://www.python.org/ftp/python/3.6.6/python-3.6.6.exe"
|
||||
: "https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi");
|
||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(installerURL).saveToFile(true));
|
||||
connect(handler, &Net::DownloadHandler::finished, this, &MainWindow::pythonDownloadFinished);
|
||||
Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(installerURL).saveToFile(true)
|
||||
, this, &MainWindow::pythonDownloadFinished);
|
||||
}
|
||||
|
||||
void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <QSysInfo>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/utils/fs.h"
|
||||
|
||||
@@ -56,9 +55,9 @@ void ProgramUpdater::checkForUpdates()
|
||||
{
|
||||
// Don't change this User-Agent. In case our updater goes haywire,
|
||||
// the filehost can identify it and contact us.
|
||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(RSS_URL).userAgent("qBittorrent/" QBT_VERSION_2 " ProgramUpdater (www.qbittorrent.org)"));
|
||||
connect(handler, &Net::DownloadHandler::finished, this, &ProgramUpdater::rssDownloadFinished);
|
||||
Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(RSS_URL).userAgent("qBittorrent/" QBT_VERSION_2 " ProgramUpdater (www.qbittorrent.org)")
|
||||
, this, &ProgramUpdater::rssDownloadFinished);
|
||||
}
|
||||
|
||||
void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "base/global.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
@@ -71,8 +70,8 @@ QStringList TrackersAdditionDialog::newTrackers() const
|
||||
void TrackersAdditionDialog::on_uTorrentListButton_clicked()
|
||||
{
|
||||
m_ui->uTorrentListButton->setEnabled(false);
|
||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->download(m_ui->lineEditListURL->text());
|
||||
connect(handler, &Net::DownloadHandler::finished, this, &TrackersAdditionDialog::torrentListDownloadFinished);
|
||||
Net::DownloadManager::instance()->download(m_ui->lineEditListURL->text()
|
||||
, this, &TrackersAdditionDialog::torrentListDownloadFinished);
|
||||
// Just to show that it takes times
|
||||
setCursor(Qt::WaitCursor);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <QTableView>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
@@ -291,9 +290,9 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName)
|
||||
else {
|
||||
// Icon is missing, we must download it
|
||||
using namespace Net;
|
||||
DownloadHandler *handler = DownloadManager::instance()->download(
|
||||
DownloadRequest(plugin->url + "/favicon.ico").saveToFile(true));
|
||||
connect(handler, &DownloadHandler::finished, this, &PluginSelectDialog::iconDownloadFinished);
|
||||
DownloadManager::instance()->download(
|
||||
DownloadRequest(plugin->url + "/favicon.ico").saveToFile(true)
|
||||
, this, &PluginSelectDialog::iconDownloadFinished);
|
||||
}
|
||||
item->setText(PLUGIN_VERSION, plugin->version);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/torrentfilter.h"
|
||||
@@ -406,9 +405,9 @@ void TrackerFiltersList::trackerWarning(const QString &hash, const QString &trac
|
||||
void TrackerFiltersList::downloadFavicon(const QString &url)
|
||||
{
|
||||
if (!m_downloadTrackerFavicon) return;
|
||||
Net::DownloadHandler *h = Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(url).saveToFile(true));
|
||||
connect(h, &Net::DownloadHandler::finished, this, &TrackerFiltersList::handleFavicoDownloadFinished);
|
||||
Net::DownloadManager::instance()->download(
|
||||
Net::DownloadRequest(url).saveToFile(true)
|
||||
, this, &TrackerFiltersList::handleFavicoDownloadFinished);
|
||||
}
|
||||
|
||||
void TrackerFiltersList::handleFavicoDownloadFinished(const Net::DownloadResult &result)
|
||||
|
||||
Reference in New Issue
Block a user