mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 09:55:55 +00:00
Revise checkbox label for "Use any available ports" functionality
Also reorder the checkboxes a bit.
This commit is contained in:
parent
a3fd6633c4
commit
09e558ae0b
@ -407,7 +407,7 @@ Session::Session(QObject *parent)
|
|||||||
, m_isBandwidthSchedulerEnabled(BITTORRENT_SESSION_KEY("BandwidthSchedulerEnabled"), false)
|
, m_isBandwidthSchedulerEnabled(BITTORRENT_SESSION_KEY("BandwidthSchedulerEnabled"), false)
|
||||||
, m_saveResumeDataInterval(BITTORRENT_SESSION_KEY("SaveResumeDataInterval"), 60)
|
, m_saveResumeDataInterval(BITTORRENT_SESSION_KEY("SaveResumeDataInterval"), 60)
|
||||||
, m_port(BITTORRENT_SESSION_KEY("Port"), -1)
|
, m_port(BITTORRENT_SESSION_KEY("Port"), -1)
|
||||||
, m_useRandomPort(BITTORRENT_SESSION_KEY("UseRandomPort"), false)
|
, m_useAnyAvailablePort(BITTORRENT_SESSION_KEY("UseRandomPort"), false)
|
||||||
, m_networkInterface(BITTORRENT_SESSION_KEY("Interface"))
|
, m_networkInterface(BITTORRENT_SESSION_KEY("Interface"))
|
||||||
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
|
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
|
||||||
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
|
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
|
||||||
@ -1421,7 +1421,7 @@ void Session::configureNetworkInterfaces(lt::settings_pack &settingsPack)
|
|||||||
if (m_listenInterfaceConfigured)
|
if (m_listenInterfaceConfigured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int port = useRandomPort() ? 0 : this->port();
|
const int port = useAnyAvailablePort() ? 0 : this->port();
|
||||||
if (port > 0) // user specified port
|
if (port > 0) // user specified port
|
||||||
settingsPack.set_int(lt::settings_pack::max_retry_port_bind, 0);
|
settingsPack.set_int(lt::settings_pack::max_retry_port_bind, 0);
|
||||||
|
|
||||||
@ -2751,14 +2751,14 @@ void Session::setPort(const int port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::useRandomPort() const
|
bool Session::useAnyAvailablePort() const
|
||||||
{
|
{
|
||||||
return m_useRandomPort;
|
return m_useAnyAvailablePort;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::setUseRandomPort(const bool value)
|
void Session::setUseAnyAvailablePort(const bool value)
|
||||||
{
|
{
|
||||||
m_useRandomPort = value;
|
m_useAnyAvailablePort = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Session::networkInterface() const
|
QString Session::networkInterface() const
|
||||||
|
@ -306,8 +306,8 @@ namespace BitTorrent
|
|||||||
void setSaveResumeDataInterval(int value);
|
void setSaveResumeDataInterval(int value);
|
||||||
int port() const;
|
int port() const;
|
||||||
void setPort(int port);
|
void setPort(int port);
|
||||||
bool useRandomPort() const;
|
bool useAnyAvailablePort() const;
|
||||||
void setUseRandomPort(bool value);
|
void setUseAnyAvailablePort(bool value);
|
||||||
QString networkInterface() const;
|
QString networkInterface() const;
|
||||||
void setNetworkInterface(const QString &iface);
|
void setNetworkInterface(const QString &iface);
|
||||||
QString networkInterfaceName() const;
|
QString networkInterfaceName() const;
|
||||||
@ -722,7 +722,7 @@ namespace BitTorrent
|
|||||||
CachedSettingValue<bool> m_isBandwidthSchedulerEnabled;
|
CachedSettingValue<bool> m_isBandwidthSchedulerEnabled;
|
||||||
CachedSettingValue<int> m_saveResumeDataInterval;
|
CachedSettingValue<int> m_saveResumeDataInterval;
|
||||||
CachedSettingValue<int> m_port;
|
CachedSettingValue<int> m_port;
|
||||||
CachedSettingValue<bool> m_useRandomPort;
|
CachedSettingValue<bool> m_useAnyAvailablePort;
|
||||||
CachedSettingValue<QString> m_networkInterface;
|
CachedSettingValue<QString> m_networkInterface;
|
||||||
CachedSettingValue<QString> m_networkInterfaceName;
|
CachedSettingValue<QString> m_networkInterfaceName;
|
||||||
CachedSettingValue<QString> m_networkInterfaceAddress;
|
CachedSettingValue<QString> m_networkInterfaceAddress;
|
||||||
|
@ -300,7 +300,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
void (QSpinBox::*qSpinBoxValueChanged)(int) = &QSpinBox::valueChanged;
|
void (QSpinBox::*qSpinBoxValueChanged)(int) = &QSpinBox::valueChanged;
|
||||||
|
|
||||||
connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableProxy);
|
connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableProxy);
|
||||||
connect(m_ui->checkRandomPort, &QAbstractButton::toggled, m_ui->spinPort, &ThisType::setDisabled);
|
connect(m_ui->useAnyPort, &QAbstractButton::toggled, m_ui->spinPort, &ThisType::setDisabled);
|
||||||
|
|
||||||
// Apply button is activated when a value is changed
|
// Apply button is activated when a value is changed
|
||||||
// Behavior tab
|
// Behavior tab
|
||||||
@ -408,7 +408,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
// Connection tab
|
// Connection tab
|
||||||
connect(m_ui->comboProtocol, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->comboProtocol, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->spinPort, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->spinPort, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkRandomPort, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->useAnyPort, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkUPnP, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkUPnP, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->spinUploadLimit, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->spinUploadLimit, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->spinDownloadLimit, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->spinDownloadLimit, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
||||||
@ -770,7 +770,7 @@ void OptionsDialog::saveOptions()
|
|||||||
// Connection preferences
|
// Connection preferences
|
||||||
session->setBTProtocol(static_cast<BitTorrent::BTProtocol>(m_ui->comboProtocol->currentIndex()));
|
session->setBTProtocol(static_cast<BitTorrent::BTProtocol>(m_ui->comboProtocol->currentIndex()));
|
||||||
session->setPort(getPort());
|
session->setPort(getPort());
|
||||||
session->setUseRandomPort(m_ui->checkRandomPort->isChecked());
|
session->setUseAnyAvailablePort(m_ui->useAnyPort->isChecked());
|
||||||
Net::PortForwarder::instance()->setEnabled(isUPnPEnabled());
|
Net::PortForwarder::instance()->setEnabled(isUPnPEnabled());
|
||||||
session->setGlobalDownloadSpeedLimit(m_ui->spinDownloadLimit->value() * 1024);
|
session->setGlobalDownloadSpeedLimit(m_ui->spinDownloadLimit->value() * 1024);
|
||||||
session->setGlobalUploadSpeedLimit(m_ui->spinUploadLimit->value() * 1024);
|
session->setGlobalUploadSpeedLimit(m_ui->spinUploadLimit->value() * 1024);
|
||||||
@ -1068,9 +1068,9 @@ void OptionsDialog::loadOptions()
|
|||||||
// Connection preferences
|
// Connection preferences
|
||||||
m_ui->comboProtocol->setCurrentIndex(static_cast<int>(session->btProtocol()));
|
m_ui->comboProtocol->setCurrentIndex(static_cast<int>(session->btProtocol()));
|
||||||
m_ui->checkUPnP->setChecked(Net::PortForwarder::instance()->isEnabled());
|
m_ui->checkUPnP->setChecked(Net::PortForwarder::instance()->isEnabled());
|
||||||
m_ui->checkRandomPort->setChecked(session->useRandomPort());
|
m_ui->useAnyPort->setChecked(session->useAnyAvailablePort());
|
||||||
m_ui->spinPort->setValue(session->port());
|
m_ui->spinPort->setValue(session->port());
|
||||||
m_ui->spinPort->setDisabled(m_ui->checkRandomPort->isChecked());
|
m_ui->spinPort->setDisabled(m_ui->useAnyPort->isChecked());
|
||||||
|
|
||||||
intValue = session->maxConnections();
|
intValue = session->maxConnections();
|
||||||
if (intValue > 0)
|
if (intValue > 0)
|
||||||
|
@ -1490,6 +1490,13 @@ Manual: Various torrent properties (e.g. save path) must be assigned manually</s
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="useAnyPort">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use any available port</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkUPnP">
|
<widget class="QCheckBox" name="checkUPnP">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -1500,13 +1507,6 @@ Manual: Various torrent properties (e.g. save path) must be assigned manually</s
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkRandomPort">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use different port on each startup</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -3281,7 +3281,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupEnableReverseProxySupport">
|
<widget class="QGroupBox" name="groupEnableReverseProxySupport">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Enable reverse proxy support</string>
|
<string>Enable reverse proxy support</string>
|
||||||
@ -3469,6 +3469,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
|
|||||||
<tabstop>customThemeFilePath</tabstop>
|
<tabstop>customThemeFilePath</tabstop>
|
||||||
<tabstop>checkStartPaused</tabstop>
|
<tabstop>checkStartPaused</tabstop>
|
||||||
<tabstop>spinPort</tabstop>
|
<tabstop>spinPort</tabstop>
|
||||||
|
<tabstop>useAnyPort</tabstop>
|
||||||
<tabstop>checkUPnP</tabstop>
|
<tabstop>checkUPnP</tabstop>
|
||||||
<tabstop>textWebUiUsername</tabstop>
|
<tabstop>textWebUiUsername</tabstop>
|
||||||
<tabstop>checkWebUi</tabstop>
|
<tabstop>checkWebUi</tabstop>
|
||||||
@ -3520,7 +3521,6 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
|
|||||||
<tabstop>lineEditAutoRun</tabstop>
|
<tabstop>lineEditAutoRun</tabstop>
|
||||||
<tabstop>scrollArea_3</tabstop>
|
<tabstop>scrollArea_3</tabstop>
|
||||||
<tabstop>randomButton</tabstop>
|
<tabstop>randomButton</tabstop>
|
||||||
<tabstop>checkRandomPort</tabstop>
|
|
||||||
<tabstop>checkMaxConnecs</tabstop>
|
<tabstop>checkMaxConnecs</tabstop>
|
||||||
<tabstop>spinMaxConnec</tabstop>
|
<tabstop>spinMaxConnec</tabstop>
|
||||||
<tabstop>checkMaxConnecsPerTorrent</tabstop>
|
<tabstop>checkMaxConnecsPerTorrent</tabstop>
|
||||||
|
@ -154,7 +154,7 @@ void AppController::preferencesAction()
|
|||||||
// Listening Port
|
// Listening Port
|
||||||
data["listen_port"] = session->port();
|
data["listen_port"] = session->port();
|
||||||
data["upnp"] = Net::PortForwarder::instance()->isEnabled();
|
data["upnp"] = Net::PortForwarder::instance()->isEnabled();
|
||||||
data["random_port"] = session->useRandomPort();
|
data["random_port"] = session->useAnyAvailablePort();
|
||||||
// Connections Limits
|
// Connections Limits
|
||||||
data["max_connec"] = session->maxConnections();
|
data["max_connec"] = session->maxConnections();
|
||||||
data["max_connec_per_torrent"] = session->maxConnectionsPerTorrent();
|
data["max_connec_per_torrent"] = session->maxConnectionsPerTorrent();
|
||||||
@ -487,7 +487,7 @@ void AppController::setPreferencesAction()
|
|||||||
if (hasKey("upnp"))
|
if (hasKey("upnp"))
|
||||||
Net::PortForwarder::instance()->setEnabled(it.value().toBool());
|
Net::PortForwarder::instance()->setEnabled(it.value().toBool());
|
||||||
if (hasKey("random_port"))
|
if (hasKey("random_port"))
|
||||||
session->setUseRandomPort(it.value().toBool());
|
session->setUseAnyAvailablePort(it.value().toBool());
|
||||||
// Connections Limits
|
// Connections Limits
|
||||||
if (hasKey("max_connec"))
|
if (hasKey("max_connec"))
|
||||||
session->setMaxConnections(it.value().toInt());
|
session->setMaxConnections(it.value().toInt());
|
||||||
|
@ -235,12 +235,12 @@
|
|||||||
<button style="margin-left: 1em;" onclick="qBittorrent.Preferences.generateRandomPort();">QBT_TR(Random)QBT_TR[CONTEXT=OptionsDialog]</button>
|
<button style="margin-left: 1em;" onclick="qBittorrent.Preferences.generateRandomPort();">QBT_TR(Random)QBT_TR[CONTEXT=OptionsDialog]</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="formRow">
|
<div class="formRow">
|
||||||
<input type="checkbox" id="upnp_checkbox" />
|
<input type="checkbox" id="useAnyPortCheckbox" onclick="qBittorrent.Preferences.updatePortValueEnabled();" />
|
||||||
<label for="upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP port forwarding from my router)QBT_TR[CONTEXT=OptionsDialog]</label>
|
<label for="useAnyPortCheckbox">QBT_TR(Use any available port)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="formRow">
|
<div class="formRow">
|
||||||
<input type="checkbox" id="random_port_checkbox" onclick="qBittorrent.Preferences.updatePortValueEnabled();" />
|
<input type="checkbox" id="upnp_checkbox" />
|
||||||
<label for="random_port_checkbox">QBT_TR(Use different port on each startup)QBT_TR[CONTEXT=OptionsDialog]</label>
|
<label for="upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP port forwarding from my router)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
@ -1405,7 +1405,7 @@
|
|||||||
|
|
||||||
// Connection tab
|
// Connection tab
|
||||||
const updatePortValueEnabled = function() {
|
const updatePortValueEnabled = function() {
|
||||||
const checked = $('random_port_checkbox').getProperty('checked');
|
const checked = $('useAnyPortCheckbox').getProperty('checked');
|
||||||
$('port_value').setProperty('disabled', checked);
|
$('port_value').setProperty('disabled', checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1708,7 +1708,7 @@
|
|||||||
// Listening Port
|
// Listening Port
|
||||||
$('port_value').setProperty('value', pref.listen_port.toInt());
|
$('port_value').setProperty('value', pref.listen_port.toInt());
|
||||||
$('upnp_checkbox').setProperty('checked', pref.upnp);
|
$('upnp_checkbox').setProperty('checked', pref.upnp);
|
||||||
$('random_port_checkbox').setProperty('checked', pref.random_port);
|
$('useAnyPortCheckbox').setProperty('checked', pref.random_port);
|
||||||
updatePortValueEnabled();
|
updatePortValueEnabled();
|
||||||
|
|
||||||
// Connections Limits
|
// Connections Limits
|
||||||
@ -2024,7 +2024,7 @@
|
|||||||
}
|
}
|
||||||
settings.set('listen_port', listen_port);
|
settings.set('listen_port', listen_port);
|
||||||
settings.set('upnp', $('upnp_checkbox').getProperty('checked'));
|
settings.set('upnp', $('upnp_checkbox').getProperty('checked'));
|
||||||
settings.set('random_port', $('random_port_checkbox').getProperty('checked'));
|
settings.set('random_port', $('useAnyPortCheckbox').getProperty('checked'));
|
||||||
|
|
||||||
// Connections Limits
|
// Connections Limits
|
||||||
let max_connec = -1;
|
let max_connec = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user