mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Option to disable connections not supported by proxies. Closes #1894.
This commit is contained in:
parent
cd99f0ea43
commit
0b8fad69fa
6 changed files with 55 additions and 1 deletions
|
@ -31,7 +31,6 @@
|
||||||
#ifndef MISC_H
|
#ifndef MISC_H
|
||||||
#define MISC_H
|
#define MISC_H
|
||||||
|
|
||||||
#include <libtorrent/version.hpp>
|
|
||||||
#include <libtorrent/torrent_info.hpp>
|
#include <libtorrent/torrent_info.hpp>
|
||||||
#include <libtorrent/torrent_handle.hpp>
|
#include <libtorrent/torrent_handle.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
|
@ -1372,6 +1372,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkForceProxy">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable connections not supported by proxies</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="checkProxyAuth">
|
<widget class="QGroupBox" name="checkProxyAuth">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -2030,6 +2040,9 @@
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkAnonymousMode">
|
<widget class="QCheckBox" name="checkAnonymousMode">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Enable when using a proxy or a VPN connection</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable anonymous mode</string>
|
<string>Enable anonymous mode</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -215,6 +215,9 @@ options_imp::options_imp(QWidget *parent):
|
||||||
connect(textProxyIP, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(textProxyIP, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
connect(spinProxyPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(spinProxyPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkProxyPeerConnecs, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
connect(checkProxyPeerConnecs, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
connect(checkForceProxy, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||||
|
#endif
|
||||||
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(textProxyUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(textProxyUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
|
@ -252,6 +255,11 @@ options_imp::options_imp(QWidget *parent):
|
||||||
scrollArea_advanced->setLayout(adv_layout);
|
scrollArea_advanced->setLayout(adv_layout);
|
||||||
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
|
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
|
||||||
|
|
||||||
|
//Hide incompatible options
|
||||||
|
#if LIBTORRENT_VERSION_NUM < 10000
|
||||||
|
checkForceProxy->setVisible(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Adapt size
|
// Adapt size
|
||||||
show();
|
show();
|
||||||
loadWindowState();
|
loadWindowState();
|
||||||
|
@ -418,6 +426,9 @@ void options_imp::saveOptions() {
|
||||||
pref->setProxyIp(getProxyIp());
|
pref->setProxyIp(getProxyIp());
|
||||||
pref->setProxyPort(getProxyPort());
|
pref->setProxyPort(getProxyPort());
|
||||||
pref->setProxyPeerConnections(checkProxyPeerConnecs->isChecked());
|
pref->setProxyPeerConnections(checkProxyPeerConnecs->isChecked());
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
pref->setForceProxy(checkForceProxy->isChecked());
|
||||||
|
#endif
|
||||||
pref->setProxyAuthEnabled(isProxyAuthEnabled());
|
pref->setProxyAuthEnabled(isProxyAuthEnabled());
|
||||||
pref->setProxyUsername(getProxyUsername());
|
pref->setProxyUsername(getProxyUsername());
|
||||||
pref->setProxyPassword(getProxyPassword());
|
pref->setProxyPassword(getProxyPassword());
|
||||||
|
@ -643,6 +654,9 @@ void options_imp::loadOptions() {
|
||||||
textProxyIP->setText(pref->getProxyIp());
|
textProxyIP->setText(pref->getProxyIp());
|
||||||
spinProxyPort->setValue(pref->getProxyPort());
|
spinProxyPort->setValue(pref->getProxyPort());
|
||||||
checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
|
checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
checkForceProxy->setChecked(pref->getForceProxy());
|
||||||
|
#endif
|
||||||
checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
|
checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
|
||||||
textProxyUsername->setText(pref->getProxyUsername());
|
textProxyUsername->setText(pref->getProxyUsername());
|
||||||
textProxyPassword->setText(pref->getProxyPassword());
|
textProxyPassword->setText(pref->getProxyPassword());
|
||||||
|
@ -930,6 +944,9 @@ void options_imp::enableProxy(int index) {
|
||||||
lblProxyPort->setEnabled(true);
|
lblProxyPort->setEnabled(true);
|
||||||
spinProxyPort->setEnabled(true);
|
spinProxyPort->setEnabled(true);
|
||||||
checkProxyPeerConnecs->setEnabled(true);
|
checkProxyPeerConnecs->setEnabled(true);
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
checkForceProxy->setEnabled(true);
|
||||||
|
#endif
|
||||||
if (index > 1) {
|
if (index > 1) {
|
||||||
checkProxyAuth->setEnabled(true);
|
checkProxyAuth->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -943,6 +960,9 @@ void options_imp::enableProxy(int index) {
|
||||||
lblProxyPort->setEnabled(false);
|
lblProxyPort->setEnabled(false);
|
||||||
spinProxyPort->setEnabled(false);
|
spinProxyPort->setEnabled(false);
|
||||||
checkProxyPeerConnecs->setEnabled(false);
|
checkProxyPeerConnecs->setEnabled(false);
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
checkForceProxy->setEnabled(false);
|
||||||
|
#endif
|
||||||
checkProxyAuth->setEnabled(false);
|
checkProxyAuth->setEnabled(false);
|
||||||
checkProxyAuth->setChecked(false);
|
checkProxyAuth->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -698,6 +698,16 @@ void Preferences::setProxyPeerConnections(bool enabled) {
|
||||||
setValue("Preferences/Connection/ProxyPeerConnections", enabled);
|
setValue("Preferences/Connection/ProxyPeerConnections", enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
bool Preferences::getForceProxy() const {
|
||||||
|
return value("Preferences/Connection/ProxyForce", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Preferences::setForceProxy(bool enabled) {
|
||||||
|
setValue("Preferences/Connection/ProxyForce", enabled);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Bittorrent options
|
// Bittorrent options
|
||||||
int Preferences::getMaxConnecs() const {
|
int Preferences::getMaxConnecs() const {
|
||||||
return value("Preferences/Bittorrent/MaxConnecs", 500).toInt();
|
return value("Preferences/Bittorrent/MaxConnecs", 500).toInt();
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
|
#include <libtorrent/version.hpp>
|
||||||
|
|
||||||
#define QBT_REALM "Web UI Access"
|
#define QBT_REALM "Web UI Access"
|
||||||
enum scheduler_days { EVERY_DAY, WEEK_DAYS, WEEK_ENDS, MON, TUE, WED, THU, FRI, SAT, SUN };
|
enum scheduler_days { EVERY_DAY, WEEK_DAYS, WEEK_ENDS, MON, TUE, WED, THU, FRI, SAT, SUN };
|
||||||
enum maxRatioAction {PAUSE_ACTION, REMOVE_ACTION};
|
enum maxRatioAction {PAUSE_ACTION, REMOVE_ACTION};
|
||||||
|
@ -203,6 +205,10 @@ public:
|
||||||
void setProxyType(int type);
|
void setProxyType(int type);
|
||||||
bool proxyPeerConnections() const;
|
bool proxyPeerConnections() const;
|
||||||
void setProxyPeerConnections(bool enabled);
|
void setProxyPeerConnections(bool enabled);
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
bool getForceProxy() const;
|
||||||
|
void setForceProxy(bool enabled);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Bittorrent options
|
// Bittorrent options
|
||||||
int getMaxConnecs() const;
|
int getMaxConnecs() const;
|
||||||
|
|
|
@ -482,6 +482,12 @@ void QBtSession::configureSession() {
|
||||||
else
|
else
|
||||||
sessionSettings.mixed_mode_algorithm = session_settings::peer_proportional;
|
sessionSettings.mixed_mode_algorithm = session_settings::peer_proportional;
|
||||||
sessionSettings.connection_speed = 20; //default is 10
|
sessionSettings.connection_speed = 20; //default is 10
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
if (pref->isProxyEnabled())
|
||||||
|
sessionSettings.force_proxy = pref->getForceProxy();
|
||||||
|
else
|
||||||
|
sessionSettings.force_proxy = false;
|
||||||
|
#endif
|
||||||
qDebug() << "Settings SessionSettings";
|
qDebug() << "Settings SessionSettings";
|
||||||
setSessionSettings(sessionSettings);
|
setSessionSettings(sessionSettings);
|
||||||
// Bittorrent
|
// Bittorrent
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue