mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Use spinbox special value to represent "Use any available port"
WebAPI functionality is preserved (deprecated) for now and should be removed in the future.
This commit is contained in:
parent
09e558ae0b
commit
49aab492e0
9 changed files with 39 additions and 54 deletions
|
@ -407,7 +407,6 @@ Session::Session(QObject *parent)
|
|||
, m_isBandwidthSchedulerEnabled(BITTORRENT_SESSION_KEY("BandwidthSchedulerEnabled"), false)
|
||||
, m_saveResumeDataInterval(BITTORRENT_SESSION_KEY("SaveResumeDataInterval"), 60)
|
||||
, m_port(BITTORRENT_SESSION_KEY("Port"), -1)
|
||||
, m_useAnyAvailablePort(BITTORRENT_SESSION_KEY("UseRandomPort"), false)
|
||||
, m_networkInterface(BITTORRENT_SESSION_KEY("Interface"))
|
||||
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
|
||||
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
|
||||
|
@ -1421,13 +1420,12 @@ void Session::configureNetworkInterfaces(lt::settings_pack &settingsPack)
|
|||
if (m_listenInterfaceConfigured)
|
||||
return;
|
||||
|
||||
const int port = useAnyAvailablePort() ? 0 : this->port();
|
||||
if (port > 0) // user specified port
|
||||
if (port() > 0) // user has specified port number
|
||||
settingsPack.set_int(lt::settings_pack::max_retry_port_bind, 0);
|
||||
|
||||
QStringList endpoints;
|
||||
QStringList outgoingInterfaces;
|
||||
const QString portString = ':' + QString::number(port);
|
||||
const QString portString = ':' + QString::number(port());
|
||||
|
||||
for (const QString &ip : asConst(getListeningIPs()))
|
||||
{
|
||||
|
@ -2751,16 +2749,6 @@ void Session::setPort(const int port)
|
|||
}
|
||||
}
|
||||
|
||||
bool Session::useAnyAvailablePort() const
|
||||
{
|
||||
return m_useAnyAvailablePort;
|
||||
}
|
||||
|
||||
void Session::setUseAnyAvailablePort(const bool value)
|
||||
{
|
||||
m_useAnyAvailablePort = value;
|
||||
}
|
||||
|
||||
QString Session::networkInterface() const
|
||||
{
|
||||
return m_networkInterface;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue