Rename alt* variables to seed*

This commit is contained in:
lstrsrt 2025-08-05 22:20:29 +02:00
commit 2e711bff9f
7 changed files with 30 additions and 30 deletions

View file

@ -406,8 +406,8 @@ namespace BitTorrent
virtual void setMaxConnections(int max) = 0;
virtual int maxConnectionsPerTorrent() const = 0;
virtual void setMaxConnectionsPerTorrent(int max) = 0;
virtual int maxAltConnectionsPerTorrent() const = 0;
virtual void setMaxAltConnectionsPerTorrent(int max) = 0;
virtual int maxSeedConnectionsPerTorrent() const = 0;
virtual void setMaxSeedConnectionsPerTorrent(int max) = 0;
virtual int maxUploads() const = 0;
virtual void setMaxUploads(int max) = 0;
virtual int maxUploadsPerTorrent() const = 0;

View file

@ -495,7 +495,7 @@ SessionImpl::SessionImpl(QObject *parent)
, m_maxConnections(BITTORRENT_SESSION_KEY(u"MaxConnections"_s), 500, lowerLimited(0, -1))
, m_maxUploads(BITTORRENT_SESSION_KEY(u"MaxUploads"_s), 20, lowerLimited(0, -1))
, m_maxConnectionsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxConnectionsPerTorrent"_s), 100, lowerLimited(0, -1))
, m_maxAltConnectionsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxAltConnectionsPerTorrent"_s), 40, lowerLimited(0, -1))
, m_maxSeedConnectionsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxSeedConnectionsPerTorrent"_s), 40, lowerLimited(0, -1))
, m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxUploadsPerTorrent"_s), 4, lowerLimited(0, -1))
, m_btProtocol(BITTORRENT_SESSION_KEY(u"BTProtocol"_s), BTProtocol::Both
, clampValue(BTProtocol::Both, BTProtocol::UTP))
@ -4356,9 +4356,9 @@ int SessionImpl::maxConnectionsPerTorrent() const
return m_maxConnectionsPerTorrent;
}
int SessionImpl::maxAltConnectionsPerTorrent() const
int SessionImpl::maxSeedConnectionsPerTorrent() const
{
return m_maxAltConnectionsPerTorrent;
return m_maxSeedConnectionsPerTorrent;
}
void SessionImpl::setMaxConnectionsPerTorrent(int max)
@ -4372,7 +4372,7 @@ void SessionImpl::setMaxConnectionsPerTorrent(int max)
{
try
{
if (m_maxAltConnectionsPerTorrent == -1 || !torrent->isUploading())
if (m_maxSeedConnectionsPerTorrent == -1 || !torrent->isUploading())
{
torrent->nativeHandle().set_max_connections(max);
}
@ -4382,12 +4382,12 @@ void SessionImpl::setMaxConnectionsPerTorrent(int max)
}
}
void SessionImpl::setMaxAltConnectionsPerTorrent(int max)
void SessionImpl::setMaxSeedConnectionsPerTorrent(int max)
{
max = (max > 0) ? max : -1;
if (max != maxAltConnectionsPerTorrent())
if (max != maxSeedConnectionsPerTorrent())
{
m_maxAltConnectionsPerTorrent = max;
m_maxSeedConnectionsPerTorrent = max;
for (const TorrentImpl *torrent : asConst(m_torrents))
{

View file

@ -380,8 +380,8 @@ namespace BitTorrent
void setMaxConnections(int max) override;
int maxConnectionsPerTorrent() const override;
void setMaxConnectionsPerTorrent(int max) override;
int maxAltConnectionsPerTorrent() const override;
void setMaxAltConnectionsPerTorrent(int max) override;
int maxSeedConnectionsPerTorrent() const override;
void setMaxSeedConnectionsPerTorrent(int max) override;
int maxUploads() const override;
void setMaxUploads(int max) override;
int maxUploadsPerTorrent() const override;
@ -701,7 +701,7 @@ namespace BitTorrent
CachedSettingValue<int> m_maxConnections;
CachedSettingValue<int> m_maxUploads;
CachedSettingValue<int> m_maxConnectionsPerTorrent;
CachedSettingValue<int> m_maxAltConnectionsPerTorrent;
CachedSettingValue<int> m_maxSeedConnectionsPerTorrent;
CachedSettingValue<int> m_maxUploadsPerTorrent;
CachedSettingValue<BTProtocol> m_btProtocol;
CachedSettingValue<bool> m_isUTPRateLimited;

View file

@ -2605,9 +2605,9 @@ void TorrentImpl::updateProgress()
void TorrentImpl::updateMaxConnections()
{
const int maxConnections = m_session->maxConnectionsPerTorrent();
const int maxAltConnections = m_session->maxAltConnectionsPerTorrent();
const bool useAltLimit = (maxAltConnections != -1) && isUploading();
const int max = useAltLimit ? maxAltConnections : maxConnections;
const int maxSeedConnections = m_session->maxSeedConnectionsPerTorrent();
const bool useAltLimit = (maxSeedConnections != -1) && isUploading();
const int max = useAltLimit ? maxSeedConnections : maxConnections;
if (nativeHandle().max_connections() == max)
return;

View file

@ -860,18 +860,18 @@ void OptionsDialog::loadConnectionTabOptions()
m_ui->checkMaxConnectionsPerTorrent->setChecked(false);
m_ui->spinMaxConnecPerTorrent->setEnabled(false);
}
intValue = session->maxAltConnectionsPerTorrent();
intValue = session->maxSeedConnectionsPerTorrent();
if (intValue > 0)
{
// enable
m_ui->checkMaxAltConnectionsPerTorrent->setChecked(true);
m_ui->spinMaxAltConnecPerTorrent->setValue(intValue);
m_ui->checkMaxSeedConnectionsPerTorrent->setChecked(true);
m_ui->spinMaxSeedConnecPerTorrent->setValue(intValue);
}
else
{
// disable
m_ui->checkMaxAltConnectionsPerTorrent->setChecked(false);
m_ui->spinMaxAltConnecPerTorrent->setEnabled(false);
m_ui->checkMaxSeedConnectionsPerTorrent->setChecked(false);
m_ui->spinMaxSeedConnecPerTorrent->setEnabled(false);
}
intValue = session->maxUploads();
if (intValue > 0)
@ -951,15 +951,15 @@ void OptionsDialog::loadConnectionTabOptions()
connect(m_ui->checkMaxConnections, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxConnectionsPerTorrent, &QAbstractButton::toggled, m_ui->spinMaxConnecPerTorrent, &QWidget::setEnabled);
connect(m_ui->checkMaxConnectionsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxAltConnectionsPerTorrent, &QAbstractButton::toggled, m_ui->spinMaxAltConnecPerTorrent, &QWidget::setEnabled);
connect(m_ui->checkMaxAltConnectionsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxSeedConnectionsPerTorrent, &QAbstractButton::toggled, m_ui->spinMaxSeedConnecPerTorrent, &QWidget::setEnabled);
connect(m_ui->checkMaxSeedConnectionsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxUploads, &QAbstractButton::toggled, m_ui->spinMaxUploads, &QWidget::setEnabled);
connect(m_ui->checkMaxUploads, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxUploadsPerTorrent, &QAbstractButton::toggled, m_ui->spinMaxUploadsPerTorrent, &QWidget::setEnabled);
connect(m_ui->checkMaxUploadsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxConnec, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxConnecPerTorrent, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxAltConnecPerTorrent, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxSeedConnecPerTorrent, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxUploads, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxUploadsPerTorrent, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
@ -1003,7 +1003,7 @@ void OptionsDialog::saveConnectionTabOptions() const
session->setMaxConnections(getMaxConnections());
session->setMaxConnectionsPerTorrent(getMaxConnectionsPerTorrent());
session->setMaxAltConnectionsPerTorrent(getMaxAltConnectionsPerTorrent());
session->setMaxSeedConnectionsPerTorrent(getMaxSeedConnectionsPerTorrent());
session->setMaxUploads(getMaxUploads());
session->setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
@ -1631,12 +1631,12 @@ int OptionsDialog::getMaxConnectionsPerTorrent() const
return m_ui->spinMaxConnecPerTorrent->value();
}
int OptionsDialog::getMaxAltConnectionsPerTorrent() const
int OptionsDialog::getMaxSeedConnectionsPerTorrent() const
{
if (!m_ui->checkMaxAltConnectionsPerTorrent->isChecked())
if (!m_ui->checkMaxSeedConnectionsPerTorrent->isChecked())
return -1;
return m_ui->spinMaxAltConnecPerTorrent->value();
return m_ui->spinMaxSeedConnecPerTorrent->value();
}
int OptionsDialog::getMaxUploads() const

View file

@ -166,7 +166,7 @@ private:
// Bittorrent options
int getMaxConnections() const;
int getMaxConnectionsPerTorrent() const;
int getMaxAltConnectionsPerTorrent() const;
int getMaxSeedConnectionsPerTorrent() const;
int getMaxUploads() const;
int getMaxUploadsPerTorrent() const;
bool isDHTEnabled() const;

View file

@ -1933,7 +1933,7 @@ readme[0-9].txt: filter 'readme1.txt', 'readme2.txt' but not 'readme10.txt'.</st
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkMaxAltConnectionsPerTorrent">
<widget class="QCheckBox" name="checkMaxSeedConnectionsPerTorrent">
<property name="text">
<string>Maximum number of connections per seeding torrent:</string>
</property>
@ -1943,7 +1943,7 @@ readme[0-9].txt: filter 'readme1.txt', 'readme2.txt' but not 'readme10.txt'.</st
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinMaxAltConnecPerTorrent">
<widget class="QSpinBox" name="spinMaxSeedConnecPerTorrent">
<property name="minimum">
<number>2</number>
</property>