This commit is contained in:
Chocobo1 2021-10-10 00:14:18 +08:00
parent 3467358663
commit 7087565d92
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
7 changed files with 45 additions and 45 deletions

View file

@ -421,8 +421,8 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->checkLimitTransportOverhead, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkLimitLocalPeerRate, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
// Bittorrent tab
connect(m_ui->checkMaxConnecs, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxConnecsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxConnections, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxConnectionsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxUploads, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxUploadsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxConnec, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
@ -446,7 +446,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
connect(m_ui->textProxyIP, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinProxyPort, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->checkProxyPeerConnecs, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkProxyPeerConnections, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->isProxyOnlyForTorrents, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkProxyAuth, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->textProxyUsername, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
@ -796,12 +796,12 @@ void OptionsDialog::saveOptions()
proxyConfigManager->setProxyOnlyForTorrents(m_ui->isProxyOnlyForTorrents->isChecked());
proxyConfigManager->setProxyConfiguration(proxyConf);
session->setProxyPeerConnectionsEnabled(m_ui->checkProxyPeerConnecs->isChecked());
session->setProxyPeerConnectionsEnabled(m_ui->checkProxyPeerConnections->isChecked());
// End Connection preferences
// Bittorrent preferences
session->setMaxConnections(getMaxConnecs());
session->setMaxConnectionsPerTorrent(getMaxConnecsPerTorrent());
session->setMaxConnections(getMaxConnections());
session->setMaxConnectionsPerTorrent(getMaxConnectionsPerTorrent());
session->setMaxUploads(getMaxUploads());
session->setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
session->setDHTEnabled(isDHTEnabled());
@ -1076,28 +1076,28 @@ void OptionsDialog::loadOptions()
if (intValue > 0)
{
// enable
m_ui->checkMaxConnecs->setChecked(true);
m_ui->checkMaxConnections->setChecked(true);
m_ui->spinMaxConnec->setEnabled(true);
m_ui->spinMaxConnec->setValue(intValue);
}
else
{
// disable
m_ui->checkMaxConnecs->setChecked(false);
m_ui->checkMaxConnections->setChecked(false);
m_ui->spinMaxConnec->setEnabled(false);
}
intValue = session->maxConnectionsPerTorrent();
if (intValue > 0)
{
// enable
m_ui->checkMaxConnecsPerTorrent->setChecked(true);
m_ui->checkMaxConnectionsPerTorrent->setChecked(true);
m_ui->spinMaxConnecPerTorrent->setEnabled(true);
m_ui->spinMaxConnecPerTorrent->setValue(intValue);
}
else
{
// disable
m_ui->checkMaxConnecsPerTorrent->setChecked(false);
m_ui->checkMaxConnectionsPerTorrent->setChecked(false);
m_ui->spinMaxConnecPerTorrent->setEnabled(false);
}
intValue = session->maxUploads();
@ -1162,7 +1162,7 @@ void OptionsDialog::loadOptions()
m_ui->textProxyUsername->setText(proxyConf.username);
m_ui->textProxyPassword->setText(proxyConf.password);
m_ui->checkProxyPeerConnecs->setChecked(session->isProxyPeerConnectionsEnabled());
m_ui->checkProxyPeerConnections->setChecked(session->isProxyPeerConnectionsEnabled());
m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyOnlyForTorrents());
enableProxy(m_ui->comboProxyType->currentIndex());
@ -1382,17 +1382,17 @@ int OptionsDialog::getMaxSeedingMinutes() const
}
// Return max connections number
int OptionsDialog::getMaxConnecs() const
int OptionsDialog::getMaxConnections() const
{
if (!m_ui->checkMaxConnecs->isChecked())
if (!m_ui->checkMaxConnections->isChecked())
return -1;
return m_ui->spinMaxConnec->value();
}
int OptionsDialog::getMaxConnecsPerTorrent() const
int OptionsDialog::getMaxConnectionsPerTorrent() const
{
if (!m_ui->checkMaxConnecsPerTorrent->isChecked())
if (!m_ui->checkMaxConnectionsPerTorrent->isChecked())
return -1;
return m_ui->spinMaxConnecPerTorrent->value();
@ -1498,7 +1498,7 @@ void OptionsDialog::enableProxy(const int index)
m_ui->textProxyIP->setEnabled(true);
m_ui->lblProxyPort->setEnabled(true);
m_ui->spinProxyPort->setEnabled(true);
m_ui->checkProxyPeerConnecs->setEnabled(true);
m_ui->checkProxyPeerConnections->setEnabled(true);
if (index >= 2)
{ // SOCKS5 or HTTP
m_ui->checkProxyAuth->setEnabled(true);
@ -1518,7 +1518,7 @@ void OptionsDialog::enableProxy(const int index)
m_ui->textProxyIP->setEnabled(false);
m_ui->lblProxyPort->setEnabled(false);
m_ui->spinProxyPort->setEnabled(false);
m_ui->checkProxyPeerConnecs->setEnabled(false);
m_ui->checkProxyPeerConnections->setEnabled(false);
m_ui->isProxyOnlyForTorrents->setEnabled(false);
m_ui->checkProxyAuth->setEnabled(false);
}