Allow to specify proxy option per request

This commit is contained in:
Vladimir Golovnev (Glassez)
2023-01-29 11:49:42 +03:00
parent 8993d87b32
commit 4745a40f0b
15 changed files with 208 additions and 181 deletions

View File

@@ -32,6 +32,7 @@
#include <algorithm>
#include <QAction>
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QFileDialog>
@@ -479,8 +480,8 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
{
// Launch downloader
Net::DownloadManager::instance()->download(
Net::DownloadRequest(source).limit(MAX_TORRENT_SIZE)
, dlg, &AddNewTorrentDialog::handleDownloadFinished);
Net::DownloadRequest(source).limit(MAX_TORRENT_SIZE)
, true, dlg, &AddNewTorrentDialog::handleDownloadFinished);
return;
}

View File

@@ -1948,8 +1948,8 @@ void MainWindow::installPython()
const auto installerURL = u"https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"_qs;
#endif
Net::DownloadManager::instance()->download(
Net::DownloadRequest(installerURL).saveToFile(true)
, this, &MainWindow::pythonDownloadFinished);
Net::DownloadRequest(installerURL).saveToFile(true)
, true, this, &MainWindow::pythonDownloadFinished);
}
void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)

View File

@@ -76,8 +76,8 @@ void ProgramUpdater::checkForUpdates() const
// Don't change this User-Agent. In case our updater goes haywire,
// the filehost can identify it and contact us.
Net::DownloadManager::instance()->download(
Net::DownloadRequest(RSS_URL).userAgent(QStringLiteral("qBittorrent/" QBT_VERSION_2 " ProgramUpdater (www.qbittorrent.org)"))
, this, &ProgramUpdater::rssDownloadFinished);
Net::DownloadRequest(RSS_URL).userAgent(QStringLiteral("qBittorrent/" QBT_VERSION_2 " ProgramUpdater (www.qbittorrent.org)"))
, true, this, &ProgramUpdater::rssDownloadFinished);
}
QString ProgramUpdater::getNewVersion() const

View File

@@ -87,7 +87,7 @@ void TrackersAdditionDialog::onDownloadButtonClicked()
m_ui->downloadButton->setEnabled(false);
setCursor(Qt::WaitCursor);
Net::DownloadManager::instance()->download(url, this, &TrackersAdditionDialog::onTorrentListDownloadFinished);
Net::DownloadManager::instance()->download(url, true, this, &TrackersAdditionDialog::onTorrentListDownloadFinished);
}
void TrackersAdditionDialog::onTorrentListDownloadFinished(const Net::DownloadResult &result)

View File

@@ -311,8 +311,8 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName)
// Icon is missing, we must download it
using namespace Net;
DownloadManager::instance()->download(
DownloadRequest(plugin->url + u"/favicon.ico").saveToFile(true)
, this, &PluginSelectDialog::iconDownloadFinished);
DownloadRequest(plugin->url + u"/favicon.ico").saveToFile(true)
, true, this, &PluginSelectDialog::iconDownloadFinished);
}
item->setText(PLUGIN_VERSION, plugin->version.toString());
}

View File

@@ -658,8 +658,8 @@ void TrackerFiltersList::downloadFavicon(const QString &url)
{
if (!m_downloadTrackerFavicon) return;
Net::DownloadManager::instance()->download(
Net::DownloadRequest(url).saveToFile(true)
, this, &TrackerFiltersList::handleFavicoDownloadFinished);
Net::DownloadRequest(url).saveToFile(true), true
, this, &TrackerFiltersList::handleFavicoDownloadFinished);
}
void TrackerFiltersList::handleFavicoDownloadFinished(const Net::DownloadResult &result)