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