mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-22 17:26:21 +03:00
Expand the scope of "Proxy hostname lookup" option
This commit is contained in:
parent
6ac14d0c57
commit
96da685e5d
11 changed files with 57 additions and 61 deletions
|
@ -403,6 +403,10 @@ namespace
|
|||
}
|
||||
|
||||
settingsStorage->removeValue(u"Network/Proxy/OnlyForTorrents"_qs);
|
||||
|
||||
const auto proxyHostnameLookup = settingsStorage->loadValue<bool>(u"BitTorrent/Session/ProxyHostnameLookup"_qs);
|
||||
settingsStorage->storeValue(u"Network/Proxy/HostnameLookupEnabled"_qs, proxyHostnameLookup);
|
||||
settingsStorage->removeValue(u"BitTorrent/Session/ProxyHostnameLookup"_qs);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -262,8 +262,6 @@ namespace BitTorrent
|
|||
virtual void setMaxActiveCheckingTorrents(int val) = 0;
|
||||
virtual bool isProxyPeerConnectionsEnabled() const = 0;
|
||||
virtual void setProxyPeerConnectionsEnabled(bool enabled) = 0;
|
||||
virtual bool isProxyHostnameLookupEnabled() const = 0;
|
||||
virtual void setProxyHostnameLookupEnabled(bool enabled) = 0;
|
||||
virtual ChokingAlgorithm chokingAlgorithm() const = 0;
|
||||
virtual void setChokingAlgorithm(ChokingAlgorithm mode) = 0;
|
||||
virtual SeedChokingAlgorithm seedChokingAlgorithm() const = 0;
|
||||
|
|
|
@ -495,7 +495,6 @@ SessionImpl::SessionImpl(QObject *parent)
|
|||
, m_encryption(BITTORRENT_SESSION_KEY(u"Encryption"_qs), 0)
|
||||
, m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveCheckingTorrents"_qs), 1)
|
||||
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY(u"ProxyPeerConnections"_qs), false)
|
||||
, m_isProxyHostnameLookupEnabled(BITTORRENT_SESSION_KEY(u"ProxyHostnameLookup"_qs), true)
|
||||
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY(u"ChokingAlgorithm"_qs), ChokingAlgorithm::FixedSlots
|
||||
, clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased))
|
||||
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY(u"SeedChokingAlgorithm"_qs), SeedChokingAlgorithm::FastestUpload
|
||||
|
@ -1669,7 +1668,7 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
|||
}
|
||||
|
||||
settingsPack.set_bool(lt::settings_pack::proxy_peer_connections, isProxyPeerConnectionsEnabled());
|
||||
settingsPack.set_bool(lt::settings_pack::proxy_hostnames, isProxyHostnameLookupEnabled());
|
||||
settingsPack.set_bool(lt::settings_pack::proxy_hostnames, proxyConfig.hostnameLookupEnabled);
|
||||
}
|
||||
|
||||
settingsPack.set_bool(lt::settings_pack::announce_to_all_trackers, announceToAllTrackers());
|
||||
|
@ -3545,20 +3544,6 @@ void SessionImpl::setProxyPeerConnectionsEnabled(const bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
bool SessionImpl::isProxyHostnameLookupEnabled() const
|
||||
{
|
||||
return m_isProxyHostnameLookupEnabled;
|
||||
}
|
||||
|
||||
void SessionImpl::setProxyHostnameLookupEnabled(const bool enabled)
|
||||
{
|
||||
if (enabled != isProxyHostnameLookupEnabled())
|
||||
{
|
||||
m_isProxyHostnameLookupEnabled = enabled;
|
||||
configureDeferred();
|
||||
}
|
||||
}
|
||||
|
||||
ChokingAlgorithm SessionImpl::chokingAlgorithm() const
|
||||
{
|
||||
return m_chokingAlgorithm;
|
||||
|
|
|
@ -239,8 +239,6 @@ namespace BitTorrent
|
|||
void setMaxActiveCheckingTorrents(int val) override;
|
||||
bool isProxyPeerConnectionsEnabled() const override;
|
||||
void setProxyPeerConnectionsEnabled(bool enabled) override;
|
||||
bool isProxyHostnameLookupEnabled() const override;
|
||||
void setProxyHostnameLookupEnabled(bool enabled) override;
|
||||
ChokingAlgorithm chokingAlgorithm() const override;
|
||||
void setChokingAlgorithm(ChokingAlgorithm mode) override;
|
||||
SeedChokingAlgorithm seedChokingAlgorithm() const override;
|
||||
|
@ -655,7 +653,6 @@ namespace BitTorrent
|
|||
CachedSettingValue<int> m_encryption;
|
||||
CachedSettingValue<int> m_maxActiveCheckingTorrents;
|
||||
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
|
||||
CachedSettingValue<bool> m_isProxyHostnameLookupEnabled;
|
||||
CachedSettingValue<ChokingAlgorithm> m_chokingAlgorithm;
|
||||
CachedSettingValue<SeedChokingAlgorithm> m_seedChokingAlgorithm;
|
||||
CachedSettingValue<QStringList> m_storedTags;
|
||||
|
|
|
@ -250,6 +250,11 @@ void Net::DownloadManager::applyProxySettings()
|
|||
m_proxy.setUser(proxyConfig.username);
|
||||
m_proxy.setPassword(proxyConfig.password);
|
||||
}
|
||||
|
||||
if (proxyConfig.hostnameLookupEnabled)
|
||||
m_proxy.setCapabilities(m_proxy.capabilities() | QNetworkProxy::HostNameLookupCapability);
|
||||
else
|
||||
m_proxy.setCapabilities(m_proxy.capabilities() & ~QNetworkProxy::HostNameLookupCapability);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ bool Net::operator==(const ProxyConfiguration &left, const ProxyConfiguration &r
|
|||
&& (left.port == right.port)
|
||||
&& (left.authEnabled == right.authEnabled)
|
||||
&& (left.username == right.username)
|
||||
&& (left.password == right.password);
|
||||
&& (left.password == right.password)
|
||||
&& (left.hostnameLookupEnabled == right.hostnameLookupEnabled);
|
||||
}
|
||||
|
||||
bool Net::operator!=(const ProxyConfiguration &left, const ProxyConfiguration &right)
|
||||
|
@ -57,6 +58,7 @@ ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
|
|||
, m_storeProxyAuthEnabled {SETTINGS_KEY(u"AuthEnabled"_qs)}
|
||||
, m_storeProxyUsername {SETTINGS_KEY(u"Username"_qs)}
|
||||
, m_storeProxyPassword {SETTINGS_KEY(u"Password"_qs)}
|
||||
, m_storeProxyHostnameLookupEnabled {SETTINGS_KEY(u"HostnameLookupEnabled"_qs)}
|
||||
{
|
||||
m_config.type = m_storeProxyType.get(ProxyType::HTTP);
|
||||
if ((m_config.type < ProxyType::HTTP) || (m_config.type > ProxyType::SOCKS4))
|
||||
|
@ -66,6 +68,7 @@ ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
|
|||
m_config.authEnabled = m_storeProxyAuthEnabled;
|
||||
m_config.username = m_storeProxyUsername;
|
||||
m_config.password = m_storeProxyPassword;
|
||||
m_config.hostnameLookupEnabled = m_storeProxyHostnameLookupEnabled.get(true);
|
||||
}
|
||||
|
||||
void ProxyConfigurationManager::initInstance()
|
||||
|
@ -101,6 +104,7 @@ void ProxyConfigurationManager::setProxyConfiguration(const ProxyConfiguration &
|
|||
m_storeProxyAuthEnabled = config.authEnabled;
|
||||
m_storeProxyUsername = config.username;
|
||||
m_storeProxyPassword = config.password;
|
||||
m_storeProxyHostnameLookupEnabled = config.hostnameLookupEnabled;
|
||||
|
||||
emit proxyConfigurationChanged();
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace Net
|
|||
bool authEnabled = false;
|
||||
QString username;
|
||||
QString password;
|
||||
bool hostnameLookupEnabled = true;
|
||||
};
|
||||
bool operator==(const ProxyConfiguration &left, const ProxyConfiguration &right);
|
||||
bool operator!=(const ProxyConfiguration &left, const ProxyConfiguration &right);
|
||||
|
@ -85,5 +86,6 @@ namespace Net
|
|||
SettingValue<bool> m_storeProxyAuthEnabled;
|
||||
SettingValue<QString> m_storeProxyUsername;
|
||||
SettingValue<QString> m_storeProxyPassword;
|
||||
SettingValue<bool> m_storeProxyHostnameLookupEnabled;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -782,10 +782,10 @@ void OptionsDialog::loadConnectionTabOptions()
|
|||
m_ui->checkProxyAuth->setChecked(proxyConf.authEnabled);
|
||||
m_ui->textProxyUsername->setText(proxyConf.username);
|
||||
m_ui->textProxyPassword->setText(proxyConf.password);
|
||||
m_ui->checkProxyHostnameLookup->setChecked(proxyConf.hostnameLookupEnabled);
|
||||
|
||||
m_ui->checkProxyBitTorrent->setChecked(Preferences::instance()->useProxyForBT());
|
||||
m_ui->checkProxyPeerConnections->setChecked(session->isProxyPeerConnectionsEnabled());
|
||||
m_ui->checkProxyHostnameLookup->setChecked(session->isProxyHostnameLookupEnabled());
|
||||
m_ui->checkProxyRSS->setChecked(Preferences::instance()->useProxyForRSS());
|
||||
m_ui->checkProxyMisc->setChecked(Preferences::instance()->useProxyForGeneralPurposes());
|
||||
|
||||
|
@ -856,6 +856,7 @@ void OptionsDialog::saveConnectionTabOptions() const
|
|||
proxyConf.authEnabled = m_ui->checkProxyAuth->isChecked();
|
||||
proxyConf.username = getProxyUsername();
|
||||
proxyConf.password = getProxyPassword();
|
||||
proxyConf.hostnameLookupEnabled = m_ui->checkProxyHostnameLookup->isChecked();
|
||||
proxyConfigManager->setProxyConfiguration(proxyConf);
|
||||
|
||||
Preferences::instance()->setUseProxyForBT(m_ui->checkProxyBitTorrent->isChecked());
|
||||
|
@ -863,7 +864,6 @@ void OptionsDialog::saveConnectionTabOptions() const
|
|||
Preferences::instance()->setUseProxyForGeneralPurposes(m_ui->checkProxyMisc->isChecked());
|
||||
|
||||
session->setProxyPeerConnectionsEnabled(m_ui->checkProxyPeerConnections->isChecked());
|
||||
session->setProxyHostnameLookupEnabled(m_ui->checkProxyHostnameLookup->isChecked());
|
||||
|
||||
// IPFilter
|
||||
session->setIPFilteringEnabled(isIPFilteringEnabled());
|
||||
|
@ -1507,7 +1507,7 @@ void OptionsDialog::adjustProxyOptions()
|
|||
// SOCKS5 or HTTP
|
||||
m_ui->labelProxyTypeIncompatible->setVisible(false);
|
||||
|
||||
m_ui->checkProxyHostnameLookup->setEnabled(m_ui->checkProxyBitTorrent->isChecked());
|
||||
m_ui->checkProxyHostnameLookup->setEnabled(true);
|
||||
m_ui->checkProxyRSS->setEnabled(true);
|
||||
m_ui->checkProxyMisc->setEnabled(true);
|
||||
}
|
||||
|
|
|
@ -1835,17 +1835,27 @@ readme[0-9].txt: filter 'readme1.txt', 'readme2.txt' but not 'readme10.txt'.</st
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelProxyTypeIncompatible">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Some options are incompatible with the chosen proxy type!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<widget class="QLabel" name="labelProxyTypeIncompatible">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Some options are incompatible with the chosen proxy type!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkProxyHostnameLookup">
|
||||
<property name="toolTip">
|
||||
<string>If checked, hostname lookups are done via the proxy</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use proxy for hostname lookups</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="checkProxyAuth">
|
||||
<property name="enabled">
|
||||
|
@ -1921,16 +1931,6 @@ readme[0-9].txt: filter 'readme1.txt', 'readme2.txt' but not 'readme10.txt'.</st
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkProxyHostnameLookup">
|
||||
<property name="toolTip">
|
||||
<string>If checked, hostname lookups are done via the proxy</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use proxy for hostname lookups</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -3716,12 +3716,12 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
|
|||
<tabstop>comboProxyType</tabstop>
|
||||
<tabstop>textProxyIP</tabstop>
|
||||
<tabstop>spinProxyPort</tabstop>
|
||||
<tabstop>checkProxyHostnameLookup</tabstop>
|
||||
<tabstop>checkProxyAuth</tabstop>
|
||||
<tabstop>textProxyUsername</tabstop>
|
||||
<tabstop>textProxyPassword</tabstop>
|
||||
<tabstop>checkProxyBitTorrent</tabstop>
|
||||
<tabstop>checkProxyPeerConnections</tabstop>
|
||||
<tabstop>checkProxyHostnameLookup</tabstop>
|
||||
<tabstop>checkProxyRSS</tabstop>
|
||||
<tabstop>checkProxyMisc</tabstop>
|
||||
<tabstop>checkIPFilter</tabstop>
|
||||
|
|
|
@ -200,10 +200,10 @@ void AppController::preferencesAction()
|
|||
data[u"proxy_auth_enabled"_qs] = proxyConf.authEnabled;
|
||||
data[u"proxy_username"_qs] = proxyConf.username;
|
||||
data[u"proxy_password"_qs] = proxyConf.password;
|
||||
data[u"proxy_hostname_lookup"_qs] = proxyConf.hostnameLookupEnabled;
|
||||
|
||||
data[u"proxy_bittorrent"_qs] = pref->useProxyForBT();
|
||||
data[u"proxy_peer_connections"_qs] = session->isProxyPeerConnectionsEnabled();
|
||||
data[u"proxy_hostname_lookup"_qs] = session->isProxyHostnameLookupEnabled();
|
||||
data[u"proxy_rss"_qs] = pref->useProxyForRSS();
|
||||
data[u"proxy_misc"_qs] = pref->useProxyForGeneralPurposes();
|
||||
|
||||
|
@ -623,14 +623,14 @@ void AppController::setPreferencesAction()
|
|||
proxyConf.username = it.value().toString();
|
||||
if (hasKey(u"proxy_password"_qs))
|
||||
proxyConf.password = it.value().toString();
|
||||
if (hasKey(u"proxy_hostname_lookup"_qs))
|
||||
proxyConf.hostnameLookupEnabled = it.value().toBool();
|
||||
proxyManager->setProxyConfiguration(proxyConf);
|
||||
|
||||
if (hasKey(u"proxy_bittorrent"_qs))
|
||||
pref->setUseProxyForBT(it.value().toBool());
|
||||
if (hasKey(u"proxy_peer_connections"_qs))
|
||||
session->setProxyPeerConnectionsEnabled(it.value().toBool());
|
||||
if (hasKey(u"proxy_hostname_lookup"_qs))
|
||||
session->setProxyHostnameLookupEnabled(it.value().toBool());
|
||||
if (hasKey(u"proxy_rss"_qs))
|
||||
pref->setUseProxyForRSS(it.value().toBool());
|
||||
if (hasKey(u"proxy_misc"_qs))
|
||||
|
|
|
@ -370,6 +370,11 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="proxyHostnameLookupCheckbox" title="QBT_TR(If checked, hostname lookups are done via the proxy.)QBT_TR[CONTEXT=OptionsDialog]" />
|
||||
<label for="proxyHostnameLookupCheckbox">QBT_TR(Use proxy for hostname lookup)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
|
||||
<fieldset class="settings">
|
||||
<legend>
|
||||
<input type="checkbox" id="peer_proxy_auth_checkbox" onclick="qBittorrent.Preferences.updatePeerProxyAuthSettings();" />
|
||||
|
@ -407,10 +412,6 @@
|
|||
<input type="checkbox" id="use_peer_proxy_checkbox" />
|
||||
<label for="use_peer_proxy_checkbox">QBT_TR(Use proxy for peer connections)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="proxyHostnameLookupCheckbox" title="QBT_TR(If checked, hostname lookups are done via the proxy.)QBT_TR[CONTEXT=OptionsDialog]" />
|
||||
<label for="proxyHostnameLookupCheckbox">QBT_TR(Use proxy for hostname lookup)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="proxy_rss_checkbox" />
|
||||
|
@ -1591,7 +1592,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
|
||||
$('peer_proxy_auth_checkbox').setProperty('disabled', isProxySocks4);
|
||||
$('use_peer_proxy_checkbox').setProperty('disabled', !$('proxy_bittorrent_checkbox').getProperty('checked'));
|
||||
$('proxyHostnameLookupCheckbox').setProperty('disabled', isProxySocks4 || !$('proxy_bittorrent_checkbox').getProperty('checked'));
|
||||
$('proxyHostnameLookupCheckbox').setProperty('disabled', isProxySocks4);
|
||||
$('proxy_rss_checkbox').setProperty('disabled', isProxySocks4);
|
||||
$('proxy_misc_checkbox').setProperty('disabled', isProxySocks4);
|
||||
|
||||
|
@ -1952,14 +1953,14 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
$('peer_proxy_type_select').setProperty('value', pref.proxy_type);
|
||||
$('peer_proxy_host_text').setProperty('value', pref.proxy_ip);
|
||||
$('peer_proxy_port_value').setProperty('value', pref.proxy_port);
|
||||
$('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections);
|
||||
$('proxyHostnameLookupCheckbox').setProperty('checked', pref.proxy_hostname_lookup);
|
||||
$('proxy_bittorrent_checkbox').setProperty('checked', pref.proxy_bittorrent);
|
||||
$('proxy_rss_checkbox').setProperty('checked', pref.proxy_rss);
|
||||
$('proxy_misc_checkbox').setProperty('checked', pref.proxy_misc);
|
||||
$('peer_proxy_auth_checkbox').setProperty('checked', pref.proxy_auth_enabled);
|
||||
$('peer_proxy_username_text').setProperty('value', pref.proxy_username);
|
||||
$('peer_proxy_password_text').setProperty('value', pref.proxy_password);
|
||||
$('proxyHostnameLookupCheckbox').setProperty('checked', pref.proxy_hostname_lookup);
|
||||
$('proxy_bittorrent_checkbox').setProperty('checked', pref.proxy_bittorrent);
|
||||
$('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections);
|
||||
$('proxy_rss_checkbox').setProperty('checked', pref.proxy_rss);
|
||||
$('proxy_misc_checkbox').setProperty('checked', pref.proxy_misc);
|
||||
updatePeerProxySettings();
|
||||
|
||||
// IP Filtering
|
||||
|
@ -2283,9 +2284,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
settings.set('proxy_auth_enabled', $('peer_proxy_auth_checkbox').getProperty('checked'));
|
||||
settings.set('proxy_username', $('peer_proxy_username_text').getProperty('value'));
|
||||
settings.set('proxy_password', $('peer_proxy_password_text').getProperty('value'));
|
||||
settings.set('proxy_hostname_lookup', $('proxyHostnameLookupCheckbox').getProperty('checked'));
|
||||
settings.set('proxy_bittorrent', $('proxy_bittorrent_checkbox').getProperty('checked'));
|
||||
settings.set('proxy_peer_connections', $('use_peer_proxy_checkbox').getProperty('checked'));
|
||||
settings.set('proxy_hostname_lookup', $('proxyHostnameLookupCheckbox').getProperty('checked'));
|
||||
settings.set('proxy_rss', $('proxy_rss_checkbox').getProperty('checked'));
|
||||
settings.set('proxy_misc', $('proxy_misc_checkbox').getProperty('checked'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue