mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Merge 187cd8f4a9
into feacfb0627
This commit is contained in:
commit
7080ec7640
6 changed files with 38 additions and 1 deletions
|
@ -379,6 +379,8 @@ namespace BitTorrent
|
||||||
virtual void setUploadRateForSlowTorrents(int rateInKibiBytes) = 0;
|
virtual void setUploadRateForSlowTorrents(int rateInKibiBytes) = 0;
|
||||||
virtual int slowTorrentsInactivityTimer() const = 0;
|
virtual int slowTorrentsInactivityTimer() const = 0;
|
||||||
virtual void setSlowTorrentsInactivityTimer(int timeInSeconds) = 0;
|
virtual void setSlowTorrentsInactivityTimer(int timeInSeconds) = 0;
|
||||||
|
virtual QString NATPMPGateway() const = 0;
|
||||||
|
virtual void setNATPMPGateway(const QString& gateway) = 0;
|
||||||
virtual int outgoingPortsMin() const = 0;
|
virtual int outgoingPortsMin() const = 0;
|
||||||
virtual void setOutgoingPortsMin(int min) = 0;
|
virtual void setOutgoingPortsMin(int min) = 0;
|
||||||
virtual int outgoingPortsMax() const = 0;
|
virtual int outgoingPortsMax() const = 0;
|
||||||
|
|
|
@ -483,6 +483,7 @@ SessionImpl::SessionImpl(QObject *parent)
|
||||||
, m_slowTorrentsInactivityTimer(BITTORRENT_SESSION_KEY(u"SlowTorrentsInactivityTimer"_s), 60)
|
, m_slowTorrentsInactivityTimer(BITTORRENT_SESSION_KEY(u"SlowTorrentsInactivityTimer"_s), 60)
|
||||||
, m_outgoingPortsMin(BITTORRENT_SESSION_KEY(u"OutgoingPortsMin"_s), 0)
|
, m_outgoingPortsMin(BITTORRENT_SESSION_KEY(u"OutgoingPortsMin"_s), 0)
|
||||||
, m_outgoingPortsMax(BITTORRENT_SESSION_KEY(u"OutgoingPortsMax"_s), 0)
|
, m_outgoingPortsMax(BITTORRENT_SESSION_KEY(u"OutgoingPortsMax"_s), 0)
|
||||||
|
, m_NATPMPGateway(BITTORRENT_SESSION_KEY(u"NATPMPGateway"_s))
|
||||||
, m_UPnPLeaseDuration(BITTORRENT_SESSION_KEY(u"UPnPLeaseDuration"_s), 0)
|
, m_UPnPLeaseDuration(BITTORRENT_SESSION_KEY(u"UPnPLeaseDuration"_s), 0)
|
||||||
, m_peerToS(BITTORRENT_SESSION_KEY(u"PeerToS"_s), 0x04)
|
, m_peerToS(BITTORRENT_SESSION_KEY(u"PeerToS"_s), 0x04)
|
||||||
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY(u"IgnoreLimitsOnLAN"_s), false)
|
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY(u"IgnoreLimitsOnLAN"_s), false)
|
||||||
|
@ -2054,6 +2055,8 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
||||||
// Outgoing ports
|
// Outgoing ports
|
||||||
settingsPack.set_int(lt::settings_pack::outgoing_port, outgoingPortsMin());
|
settingsPack.set_int(lt::settings_pack::outgoing_port, outgoingPortsMin());
|
||||||
settingsPack.set_int(lt::settings_pack::num_outgoing_ports, (outgoingPortsMax() - outgoingPortsMin()));
|
settingsPack.set_int(lt::settings_pack::num_outgoing_ports, (outgoingPortsMax() - outgoingPortsMin()));
|
||||||
|
// NAT-PMP gateway
|
||||||
|
settingsPack.set_str(lt::settings_pack::nat_pmp_gateway, NATPMPGateway().toStdString());
|
||||||
// UPnP lease duration
|
// UPnP lease duration
|
||||||
settingsPack.set_int(lt::settings_pack::upnp_lease_duration, UPnPLeaseDuration());
|
settingsPack.set_int(lt::settings_pack::upnp_lease_duration, UPnPLeaseDuration());
|
||||||
// Type of service
|
// Type of service
|
||||||
|
@ -4868,6 +4871,18 @@ void SessionImpl::setOutgoingPortsMax(const int max)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SessionImpl::NATPMPGateway() const {
|
||||||
|
return m_NATPMPGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SessionImpl::setNATPMPGateway(const QString& gateway) {
|
||||||
|
if (gateway != m_NATPMPGateway)
|
||||||
|
{
|
||||||
|
m_NATPMPGateway = gateway;
|
||||||
|
configureDeferred();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int SessionImpl::UPnPLeaseDuration() const
|
int SessionImpl::UPnPLeaseDuration() const
|
||||||
{
|
{
|
||||||
return m_UPnPLeaseDuration;
|
return m_UPnPLeaseDuration;
|
||||||
|
|
|
@ -357,6 +357,8 @@ namespace BitTorrent
|
||||||
void setOutgoingPortsMin(int min) override;
|
void setOutgoingPortsMin(int min) override;
|
||||||
int outgoingPortsMax() const override;
|
int outgoingPortsMax() const override;
|
||||||
void setOutgoingPortsMax(int max) override;
|
void setOutgoingPortsMax(int max) override;
|
||||||
|
QString NATPMPGateway() const override;
|
||||||
|
void setNATPMPGateway(const QString &gateway) override;
|
||||||
int UPnPLeaseDuration() const override;
|
int UPnPLeaseDuration() const override;
|
||||||
void setUPnPLeaseDuration(int duration) override;
|
void setUPnPLeaseDuration(int duration) override;
|
||||||
int peerToS() const override;
|
int peerToS() const override;
|
||||||
|
@ -688,6 +690,7 @@ namespace BitTorrent
|
||||||
CachedSettingValue<int> m_slowTorrentsInactivityTimer;
|
CachedSettingValue<int> m_slowTorrentsInactivityTimer;
|
||||||
CachedSettingValue<int> m_outgoingPortsMin;
|
CachedSettingValue<int> m_outgoingPortsMin;
|
||||||
CachedSettingValue<int> m_outgoingPortsMax;
|
CachedSettingValue<int> m_outgoingPortsMax;
|
||||||
|
CachedSettingValue<QString> m_NATPMPGateway;
|
||||||
CachedSettingValue<int> m_UPnPLeaseDuration;
|
CachedSettingValue<int> m_UPnPLeaseDuration;
|
||||||
CachedSettingValue<int> m_peerToS;
|
CachedSettingValue<int> m_peerToS;
|
||||||
CachedSettingValue<bool> m_ignoreLimitsOnLAN;
|
CachedSettingValue<bool> m_ignoreLimitsOnLAN;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
#include "base/global.h"
|
#include "base/global.h"
|
||||||
|
@ -148,6 +149,7 @@ namespace
|
||||||
SOCKET_BACKLOG_SIZE,
|
SOCKET_BACKLOG_SIZE,
|
||||||
OUTGOING_PORT_MIN,
|
OUTGOING_PORT_MIN,
|
||||||
OUTGOING_PORT_MAX,
|
OUTGOING_PORT_MAX,
|
||||||
|
NATPMP_GATEWAY,
|
||||||
UPNP_LEASE_DURATION,
|
UPNP_LEASE_DURATION,
|
||||||
PEER_TOS,
|
PEER_TOS,
|
||||||
UTP_MIX_MODE,
|
UTP_MIX_MODE,
|
||||||
|
@ -273,6 +275,8 @@ void AdvancedSettings::saveAdvancedSettings() const
|
||||||
// Outgoing ports
|
// Outgoing ports
|
||||||
session->setOutgoingPortsMin(m_spinBoxOutgoingPortsMin.value());
|
session->setOutgoingPortsMin(m_spinBoxOutgoingPortsMin.value());
|
||||||
session->setOutgoingPortsMax(m_spinBoxOutgoingPortsMax.value());
|
session->setOutgoingPortsMax(m_spinBoxOutgoingPortsMax.value());
|
||||||
|
// NAT-PMP gateway
|
||||||
|
session->setNATPMPGateway(m_lineEditNATPMPGateway.text());
|
||||||
// UPnP lease duration
|
// UPnP lease duration
|
||||||
session->setUPnPLeaseDuration(m_spinBoxUPnPLeaseDuration.value());
|
session->setUPnPLeaseDuration(m_spinBoxUPnPLeaseDuration.value());
|
||||||
// Type of service
|
// Type of service
|
||||||
|
@ -714,6 +718,11 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||||
addRow(OUTGOING_PORT_MAX, (tr("Outgoing ports (Max) [0: disabled]")
|
addRow(OUTGOING_PORT_MAX, (tr("Outgoing ports (Max) [0: disabled]")
|
||||||
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#outgoing_port", u"(?)"))
|
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#outgoing_port", u"(?)"))
|
||||||
, &m_spinBoxOutgoingPortsMax);
|
, &m_spinBoxOutgoingPortsMax);
|
||||||
|
// NAT-PMP gateway
|
||||||
|
m_lineEditNATPMPGateway.setText(session->NATPMPGateway());
|
||||||
|
addRow(NATPMP_GATEWAY, (tr("Optional NAT-PMP gateway")
|
||||||
|
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#natpmp-gateway", u"(?)"))
|
||||||
|
, &m_lineEditNATPMPGateway);
|
||||||
// UPnP lease duration
|
// UPnP lease duration
|
||||||
m_spinBoxUPnPLeaseDuration.setMinimum(0);
|
m_spinBoxUPnPLeaseDuration.setMinimum(0);
|
||||||
m_spinBoxUPnPLeaseDuration.setMaximum(std::numeric_limits<int>::max());
|
m_spinBoxUPnPLeaseDuration.setMaximum(std::numeric_limits<int>::max());
|
||||||
|
|
|
@ -83,7 +83,7 @@ private:
|
||||||
m_checkBoxStartSessionPaused;
|
m_checkBoxStartSessionPaused;
|
||||||
QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxDiskIOReadMode, m_comboBoxDiskIOWriteMode, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm,
|
QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxDiskIOReadMode, m_comboBoxDiskIOWriteMode, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm,
|
||||||
m_comboBoxSeedChokingAlgorithm, m_comboBoxResumeDataStorage, m_comboBoxTorrentContentRemoveOption;
|
m_comboBoxSeedChokingAlgorithm, m_comboBoxResumeDataStorage, m_comboBoxTorrentContentRemoveOption;
|
||||||
QLineEdit m_lineEditAppInstanceName, m_pythonExecutablePath, m_lineEditAnnounceIP, m_lineEditDHTBootstrapNodes;
|
QLineEdit m_lineEditAppInstanceName, m_pythonExecutablePath, m_lineEditAnnounceIP, m_lineEditDHTBootstrapNodes, m_lineEditNATPMPGateway;
|
||||||
|
|
||||||
#ifndef QBT_USES_LIBTORRENT2
|
#ifndef QBT_USES_LIBTORRENT2
|
||||||
QSpinBox m_spinBoxCache, m_spinBoxCacheTTL;
|
QSpinBox m_spinBoxCache, m_spinBoxCacheTTL;
|
||||||
|
|
|
@ -456,6 +456,8 @@ void AppController::preferencesAction()
|
||||||
// Outgoing ports
|
// Outgoing ports
|
||||||
data[u"outgoing_ports_min"_s] = session->outgoingPortsMin();
|
data[u"outgoing_ports_min"_s] = session->outgoingPortsMin();
|
||||||
data[u"outgoing_ports_max"_s] = session->outgoingPortsMax();
|
data[u"outgoing_ports_max"_s] = session->outgoingPortsMax();
|
||||||
|
// NAT-PMP gateway
|
||||||
|
data[u"natpmp_gateway"_s] = session->NATPMPGateway();
|
||||||
// UPnP lease duration
|
// UPnP lease duration
|
||||||
data[u"upnp_lease_duration"_s] = session->UPnPLeaseDuration();
|
data[u"upnp_lease_duration"_s] = session->UPnPLeaseDuration();
|
||||||
// Type of service
|
// Type of service
|
||||||
|
@ -1109,6 +1111,12 @@ void AppController::setPreferencesAction()
|
||||||
session->setOutgoingPortsMin(it.value().toInt());
|
session->setOutgoingPortsMin(it.value().toInt());
|
||||||
if (hasKey(u"outgoing_ports_max"_s))
|
if (hasKey(u"outgoing_ports_max"_s))
|
||||||
session->setOutgoingPortsMax(it.value().toInt());
|
session->setOutgoingPortsMax(it.value().toInt());
|
||||||
|
// NAT-PMP gateway
|
||||||
|
if (hasKey(u"natpmp_gateway"_s))
|
||||||
|
{
|
||||||
|
const QHostAddress gatewayAddr {it.value().toString().trimmed()};
|
||||||
|
session->setNATPMPGateway(gatewayAddr.isNull() ? QString() : gatewayAddr.toString());
|
||||||
|
}
|
||||||
// UPnP lease duration
|
// UPnP lease duration
|
||||||
if (hasKey(u"upnp_lease_duration"_s))
|
if (hasKey(u"upnp_lease_duration"_s))
|
||||||
session->setUPnPLeaseDuration(it.value().toInt());
|
session->setUPnPLeaseDuration(it.value().toInt());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue