mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Merge pull request #16584 from Chocobo1/pr_16548
Allow setting the number of maximum active checking torrents
This commit is contained in:
commit
5a417c6a29
@ -450,6 +450,7 @@ Session::Session(QObject *parent)
|
|||||||
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
|
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
|
||||||
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
|
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
|
||||||
, m_encryption(BITTORRENT_SESSION_KEY("Encryption"), 0)
|
, m_encryption(BITTORRENT_SESSION_KEY("Encryption"), 0)
|
||||||
|
, m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY("MaxActiveCheckingTorrents"), 1)
|
||||||
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY("ProxyPeerConnections"), false)
|
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY("ProxyPeerConnections"), false)
|
||||||
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), ChokingAlgorithm::FixedSlots
|
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), ChokingAlgorithm::FixedSlots
|
||||||
, clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased))
|
, clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased))
|
||||||
@ -1287,6 +1288,8 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
|
|||||||
settingsPack.set_int(lt::settings_pack::in_enc_policy, lt::settings_pack::pe_disabled);
|
settingsPack.set_int(lt::settings_pack::in_enc_policy, lt::settings_pack::pe_disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settingsPack.set_int(lt::settings_pack::active_checking, maxActiveCheckingTorrents());
|
||||||
|
|
||||||
// proxy
|
// proxy
|
||||||
const auto proxyManager = Net::ProxyConfigurationManager::instance();
|
const auto proxyManager = Net::ProxyConfigurationManager::instance();
|
||||||
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
|
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
|
||||||
@ -2985,6 +2988,20 @@ void Session::setEncryption(const int state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Session::maxActiveCheckingTorrents() const
|
||||||
|
{
|
||||||
|
return m_maxActiveCheckingTorrents;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Session::setMaxActiveCheckingTorrents(const int val)
|
||||||
|
{
|
||||||
|
if (val == m_maxActiveCheckingTorrents)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_maxActiveCheckingTorrents = val;
|
||||||
|
configureDeferred();
|
||||||
|
}
|
||||||
|
|
||||||
bool Session::isProxyPeerConnectionsEnabled() const
|
bool Session::isProxyPeerConnectionsEnabled() const
|
||||||
{
|
{
|
||||||
return m_isProxyPeerConnectionsEnabled;
|
return m_isProxyPeerConnectionsEnabled;
|
||||||
|
@ -326,6 +326,8 @@ namespace BitTorrent
|
|||||||
void setNetworkInterfaceAddress(const QString &address);
|
void setNetworkInterfaceAddress(const QString &address);
|
||||||
int encryption() const;
|
int encryption() const;
|
||||||
void setEncryption(int state);
|
void setEncryption(int state);
|
||||||
|
int maxActiveCheckingTorrents() const;
|
||||||
|
void setMaxActiveCheckingTorrents(int val);
|
||||||
bool isProxyPeerConnectionsEnabled() const;
|
bool isProxyPeerConnectionsEnabled() const;
|
||||||
void setProxyPeerConnectionsEnabled(bool enabled);
|
void setProxyPeerConnectionsEnabled(bool enabled);
|
||||||
ChokingAlgorithm chokingAlgorithm() const;
|
ChokingAlgorithm chokingAlgorithm() const;
|
||||||
@ -750,6 +752,7 @@ namespace BitTorrent
|
|||||||
CachedSettingValue<QString> m_networkInterfaceName;
|
CachedSettingValue<QString> m_networkInterfaceName;
|
||||||
CachedSettingValue<QString> m_networkInterfaceAddress;
|
CachedSettingValue<QString> m_networkInterfaceAddress;
|
||||||
CachedSettingValue<int> m_encryption;
|
CachedSettingValue<int> m_encryption;
|
||||||
|
CachedSettingValue<int> m_maxActiveCheckingTorrents;
|
||||||
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
|
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
|
||||||
CachedSettingValue<ChokingAlgorithm> m_chokingAlgorithm;
|
CachedSettingValue<ChokingAlgorithm> m_chokingAlgorithm;
|
||||||
CachedSettingValue<SeedChokingAlgorithm> m_seedChokingAlgorithm;
|
CachedSettingValue<SeedChokingAlgorithm> m_seedChokingAlgorithm;
|
||||||
|
@ -1925,7 +1925,7 @@ void TorrentImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert
|
|||||||
|
|
||||||
void TorrentImpl::handlePerformanceAlert(const lt::performance_alert *p) const
|
void TorrentImpl::handlePerformanceAlert(const lt::performance_alert *p) const
|
||||||
{
|
{
|
||||||
LogMsg((tr("Performance alert: %1. More info: %2").arg(QString::fromStdString(p->message())), u"https://libtorrent.org/reference-Alerts.html#enum-performance-warning-t"_qs)
|
LogMsg((tr("Performance alert: %1. More info: %2").arg(QString::fromStdString(p->message()), u"https://libtorrent.org/reference-Alerts.html#enum-performance-warning-t"_qs))
|
||||||
, Log::INFO);
|
, Log::INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +434,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
connect(m_ui->spinMaxUploadsPerTorrent, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->spinMaxUploadsPerTorrent, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkDHT, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkDHT, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkAnonymousMode, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkAnonymousMode, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
|
connect(m_ui->spinBoxMaxActiveCheckingTorrents, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkPeX, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkPeX, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkLSD, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkLSD, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->comboEncryption, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->comboEncryption, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
||||||
@ -816,6 +817,7 @@ void OptionsDialog::saveOptions()
|
|||||||
session->setLSDEnabled(isLSDEnabled());
|
session->setLSDEnabled(isLSDEnabled());
|
||||||
session->setEncryption(getEncryptionSetting());
|
session->setEncryption(getEncryptionSetting());
|
||||||
session->setAnonymousModeEnabled(m_ui->checkAnonymousMode->isChecked());
|
session->setAnonymousModeEnabled(m_ui->checkAnonymousMode->isChecked());
|
||||||
|
session->setMaxActiveCheckingTorrents(m_ui->spinBoxMaxActiveCheckingTorrents->value());
|
||||||
session->setAddTrackersEnabled(m_ui->checkEnableAddTrackers->isChecked());
|
session->setAddTrackersEnabled(m_ui->checkEnableAddTrackers->isChecked());
|
||||||
session->setAdditionalTrackers(m_ui->textTrackers->toPlainText());
|
session->setAdditionalTrackers(m_ui->textTrackers->toPlainText());
|
||||||
session->setGlobalMaxRatio(getMaxRatio());
|
session->setGlobalMaxRatio(getMaxRatio());
|
||||||
@ -1208,6 +1210,7 @@ void OptionsDialog::loadOptions()
|
|||||||
m_ui->checkLSD->setChecked(session->isLSDEnabled());
|
m_ui->checkLSD->setChecked(session->isLSDEnabled());
|
||||||
m_ui->comboEncryption->setCurrentIndex(session->encryption());
|
m_ui->comboEncryption->setCurrentIndex(session->encryption());
|
||||||
m_ui->checkAnonymousMode->setChecked(session->isAnonymousModeEnabled());
|
m_ui->checkAnonymousMode->setChecked(session->isAnonymousModeEnabled());
|
||||||
|
m_ui->spinBoxMaxActiveCheckingTorrents->setValue(session->maxActiveCheckingTorrents());
|
||||||
m_ui->checkEnableAddTrackers->setChecked(session->isAddTrackersEnabled());
|
m_ui->checkEnableAddTrackers->setChecked(session->isAddTrackersEnabled());
|
||||||
m_ui->textTrackers->setPlainText(session->additionalTrackers());
|
m_ui->textTrackers->setPlainText(session->additionalTrackers());
|
||||||
|
|
||||||
|
@ -2377,6 +2377,43 @@ Disable encryption: Only connect to peers without protocol encryption</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelMaxActiveCheckingTorrents">
|
||||||
|
<property name="text">
|
||||||
|
<string>Maximum active checking torrents:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBoxMaxActiveCheckingTorrents">
|
||||||
|
<property name="specialValueText">
|
||||||
|
<string notr="true">∞</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>2147483647</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_21">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="checkEnableQueueing">
|
<widget class="QGroupBox" name="checkEnableQueueing">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -210,6 +210,8 @@ void AppController::preferencesAction()
|
|||||||
data["lsd"] = session->isLSDEnabled();
|
data["lsd"] = session->isLSDEnabled();
|
||||||
data["encryption"] = session->encryption();
|
data["encryption"] = session->encryption();
|
||||||
data["anonymous_mode"] = session->isAnonymousModeEnabled();
|
data["anonymous_mode"] = session->isAnonymousModeEnabled();
|
||||||
|
// Max active checking torrents
|
||||||
|
data["max_active_checking_torrents"] = session->maxActiveCheckingTorrents();
|
||||||
// Torrent Queueing
|
// Torrent Queueing
|
||||||
data["queueing_enabled"] = session->isQueueingSystemEnabled();
|
data["queueing_enabled"] = session->isQueueingSystemEnabled();
|
||||||
data["max_active_downloads"] = session->maxActiveDownloads();
|
data["max_active_downloads"] = session->maxActiveDownloads();
|
||||||
@ -584,6 +586,9 @@ void AppController::setPreferencesAction()
|
|||||||
session->setEncryption(it.value().toInt());
|
session->setEncryption(it.value().toInt());
|
||||||
if (hasKey("anonymous_mode"))
|
if (hasKey("anonymous_mode"))
|
||||||
session->setAnonymousModeEnabled(it.value().toBool());
|
session->setAnonymousModeEnabled(it.value().toBool());
|
||||||
|
// Max active checking torrents
|
||||||
|
if (hasKey("max_active_checking_torrents"))
|
||||||
|
session->setMaxActiveCheckingTorrents(it.value().toInt());
|
||||||
// Torrent Queueing
|
// Torrent Queueing
|
||||||
if (hasKey("queueing_enabled"))
|
if (hasKey("queueing_enabled"))
|
||||||
session->setQueueingSystemEnabled(it.value().toBool());
|
session->setQueueingSystemEnabled(it.value().toBool());
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "base/utils/net.h"
|
#include "base/utils/net.h"
|
||||||
#include "base/utils/version.h"
|
#include "base/utils/version.h"
|
||||||
|
|
||||||
inline const Utils::Version<int, 3, 2> API_VERSION {2, 8, 8};
|
inline const Utils::Version<int, 3, 2> API_VERSION {2, 8, 9};
|
||||||
|
|
||||||
class APIController;
|
class APIController;
|
||||||
class WebApplication;
|
class WebApplication;
|
||||||
|
@ -472,6 +472,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<div class="formRow">
|
||||||
|
<label for="maxActiveCheckingTorrents">QBT_TR(Max active checking torrents:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||||
|
<input type="number" id="maxActiveCheckingTorrents" style="width: 4em;" min="-1" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<fieldset class="settings">
|
<fieldset class="settings">
|
||||||
<legend>
|
<legend>
|
||||||
<input type="checkbox" id="queueing_checkbox" onclick="qBittorrent.Preferences.updateQueueingSystem();" />
|
<input type="checkbox" id="queueing_checkbox" onclick="qBittorrent.Preferences.updateQueueingSystem();" />
|
||||||
@ -1835,6 +1840,8 @@
|
|||||||
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
|
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
|
||||||
$('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode);
|
$('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode);
|
||||||
|
|
||||||
|
$('maxActiveCheckingTorrents').setProperty('value', pref.max_active_checking_torrents);
|
||||||
|
|
||||||
// Torrent Queueing
|
// Torrent Queueing
|
||||||
$('queueing_checkbox').setProperty('checked', pref.queueing_enabled);
|
$('queueing_checkbox').setProperty('checked', pref.queueing_enabled);
|
||||||
$('max_active_dl_value').setProperty('value', pref.max_active_downloads.toInt());
|
$('max_active_dl_value').setProperty('value', pref.max_active_downloads.toInt());
|
||||||
@ -2184,6 +2191,8 @@
|
|||||||
settings.set('encryption', $('encryption_select').getSelected()[0].getProperty('value'));
|
settings.set('encryption', $('encryption_select').getSelected()[0].getProperty('value'));
|
||||||
settings.set('anonymous_mode', $('anonymous_mode_checkbox').getProperty('checked'));
|
settings.set('anonymous_mode', $('anonymous_mode_checkbox').getProperty('checked'));
|
||||||
|
|
||||||
|
settings.set('max_active_checking_torrents', $('maxActiveCheckingTorrents').getProperty('value'));
|
||||||
|
|
||||||
// Torrent Queueing
|
// Torrent Queueing
|
||||||
settings.set('queueing_enabled', $('queueing_checkbox').getProperty('checked'));
|
settings.set('queueing_enabled', $('queueing_checkbox').getProperty('checked'));
|
||||||
if ($('queueing_checkbox').getProperty('checked')) {
|
if ($('queueing_checkbox').getProperty('checked')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user