mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
Merge pull request #5342 from glassez/session
Optimize BitTorrent::Session settings applying
This commit is contained in:
commit
124eddc68c
29 changed files with 2563 additions and 1998 deletions
|
@ -51,6 +51,8 @@
|
|||
#include "app/application.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/net/dnsupdater.h"
|
||||
#include "base/net/portforwarder.h"
|
||||
#include "base/net/proxyconfigurationmanager.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/scanfoldersmodel.h"
|
||||
#include "base/torrentfileguard.h"
|
||||
|
@ -507,8 +509,8 @@ void OptionsDialog::saveOptions()
|
|||
session->setDisableAutoTMMWhenDefaultSavePathChanged(m_ui->comboCategoryDefaultPathChanged->currentIndex() == 1);
|
||||
session->setTempPathEnabled(m_ui->checkTempFolder->isChecked());
|
||||
session->setTempPath(Utils::Fs::expandPathAbs(m_ui->textTempPath->text()));
|
||||
pref->useIncompleteFilesExtension(m_ui->checkAppendqB->isChecked());
|
||||
pref->preAllocateAllFiles(preAllocateAllFiles());
|
||||
session->setAppendExtensionEnabled(m_ui->checkAppendqB->isChecked());
|
||||
session->setPreallocationEnabled(preAllocateAllFiles());
|
||||
AddNewTorrentDialog::setEnabled(useAdditionDialog());
|
||||
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
|
||||
session->setAddTorrentPaused(addTorrentsInPause());
|
||||
|
@ -517,8 +519,8 @@ void OptionsDialog::saveOptions()
|
|||
ScanFoldersModel::instance()->makePersistent();
|
||||
removedScanDirs.clear();
|
||||
addedScanDirs.clear();
|
||||
pref->setTorrentExportDir(getTorrentExportDir());
|
||||
pref->setFinishedTorrentExportDir(getFinishedTorrentExportDir());
|
||||
session->setTorrentExportDirectory(getTorrentExportDir());
|
||||
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
|
||||
pref->setMailNotificationEnabled(m_ui->groupMailNotification->isChecked());
|
||||
pref->setMailNotificationEmail(m_ui->dest_email_txt->text());
|
||||
pref->setMailNotificationSMTP(m_ui->smtp_server_txt->text());
|
||||
|
@ -536,61 +538,66 @@ void OptionsDialog::saveOptions()
|
|||
// End Downloads preferences
|
||||
|
||||
// Connection preferences
|
||||
pref->setSessionPort(getPort());
|
||||
pref->setRandomPort(m_ui->checkRandomPort->isChecked());
|
||||
pref->setUPnPEnabled(isUPnPEnabled());
|
||||
session->setPort(getPort());
|
||||
session->setUseRandomPort(m_ui->checkRandomPort->isChecked());
|
||||
Net::PortForwarder::instance()->setEnabled(isUPnPEnabled());
|
||||
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits();
|
||||
pref->setGlobalDownloadLimit(down_up_limit.first);
|
||||
pref->setGlobalUploadLimit(down_up_limit.second);
|
||||
pref->setuTPEnabled(m_ui->checkuTP->isChecked());
|
||||
pref->setuTPRateLimited(m_ui->checkLimituTPConnections->isChecked());
|
||||
pref->includeOverheadInLimits(m_ui->checkLimitTransportOverhead->isChecked());
|
||||
pref->setIgnoreLimitsOnLAN(!m_ui->checkLimitLocalPeerRate->isChecked());
|
||||
session->setGlobalDownloadSpeedLimit(down_up_limit.first);
|
||||
session->setGlobalUploadSpeedLimit(down_up_limit.second);
|
||||
session->setUTPEnabled(m_ui->checkuTP->isChecked());
|
||||
session->setUTPRateLimited(m_ui->checkLimituTPConnections->isChecked());
|
||||
session->setIncludeOverheadInLimits(m_ui->checkLimitTransportOverhead->isChecked());
|
||||
session->setIgnoreLimitsOnLAN(!m_ui->checkLimitLocalPeerRate->isChecked());
|
||||
const QPair<int, int> alt_down_up_limit = getAltGlobalBandwidthLimits();
|
||||
pref->setAltGlobalDownloadLimit(alt_down_up_limit.first);
|
||||
pref->setAltGlobalUploadLimit(alt_down_up_limit.second);
|
||||
pref->setSchedulerEnabled(m_ui->check_schedule->isChecked());
|
||||
session->setAltGlobalDownloadSpeedLimit(alt_down_up_limit.first);
|
||||
session->setAltGlobalUploadSpeedLimit(alt_down_up_limit.second);
|
||||
session->setBandwidthSchedulerEnabled(m_ui->check_schedule->isChecked());
|
||||
pref->setSchedulerStartTime(m_ui->schedule_from->time());
|
||||
pref->setSchedulerEndTime(m_ui->schedule_to->time());
|
||||
pref->setSchedulerDays((scheduler_days)m_ui->schedule_days->currentIndex());
|
||||
pref->setProxyType(getProxyType());
|
||||
pref->setProxyIp(getProxyIp());
|
||||
pref->setProxyPort(getProxyPort());
|
||||
pref->setProxyPeerConnections(m_ui->checkProxyPeerConnecs->isChecked());
|
||||
pref->setForceProxy(m_ui->checkForceProxy->isChecked());
|
||||
pref->setProxyOnlyForTorrents(m_ui->isProxyOnlyForTorrents->isChecked());
|
||||
pref->setProxyAuthEnabled(isProxyAuthEnabled());
|
||||
pref->setProxyUsername(getProxyUsername());
|
||||
pref->setProxyPassword(getProxyPassword());
|
||||
|
||||
auto proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
||||
Net::ProxyConfiguration proxyConf;
|
||||
proxyConf.type = getProxyType();
|
||||
proxyConf.ip = getProxyIp();
|
||||
proxyConf.port = getProxyPort();
|
||||
proxyConf.username = getProxyUsername();
|
||||
proxyConf.password = getProxyPassword();
|
||||
proxyConfigManager->setProxyDisabled(m_ui->isProxyOnlyForTorrents->isChecked());
|
||||
proxyConfigManager->setProxyConfiguration(proxyConf);
|
||||
|
||||
session->setProxyPeerConnectionsEnabled(m_ui->checkProxyPeerConnecs->isChecked());
|
||||
session->setForceProxyEnabled(m_ui->checkForceProxy->isChecked());
|
||||
// End Connection preferences
|
||||
|
||||
// Bittorrent preferences
|
||||
pref->setMaxConnecs(getMaxConnecs());
|
||||
pref->setMaxConnecsPerTorrent(getMaxConnecsPerTorrent());
|
||||
pref->setMaxUploads(getMaxUploads());
|
||||
pref->setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
|
||||
pref->setDHTEnabled(isDHTEnabled());
|
||||
pref->setPeXEnabled(m_ui->checkPeX->isChecked());
|
||||
pref->setLSDEnabled(isLSDEnabled());
|
||||
pref->setEncryptionSetting(getEncryptionSetting());
|
||||
pref->enableAnonymousMode(m_ui->checkAnonymousMode->isChecked());
|
||||
pref->setAddTrackersEnabled(m_ui->checkEnableAddTrackers->isChecked());
|
||||
pref->setTrackersList(m_ui->textTrackers->toPlainText());
|
||||
pref->setGlobalMaxRatio(getMaxRatio());
|
||||
session->setMaxConnections(getMaxConnecs());
|
||||
session->setMaxConnectionsPerTorrent(getMaxConnecsPerTorrent());
|
||||
session->setMaxUploads(getMaxUploads());
|
||||
session->setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
|
||||
session->setDHTEnabled(isDHTEnabled());
|
||||
session->setPeXEnabled(m_ui->checkPeX->isChecked());
|
||||
session->setLSDEnabled(isLSDEnabled());
|
||||
session->setEncryption(getEncryptionSetting());
|
||||
session->setAnonymousModeEnabled(m_ui->checkAnonymousMode->isChecked());
|
||||
session->setAddTrackersEnabled(m_ui->checkEnableAddTrackers->isChecked());
|
||||
session->setAdditionalTrackers(m_ui->textTrackers->toPlainText());
|
||||
session->setGlobalMaxRatio(getMaxRatio());
|
||||
session->setMaxRatioAction(static_cast<MaxRatioAction>(m_ui->comboRatioLimitAct->currentIndex()));
|
||||
// End Bittorrent preferences
|
||||
|
||||
// Misc preferences
|
||||
// * IPFilter
|
||||
pref->setFilteringEnabled(isFilteringEnabled());
|
||||
pref->setFilteringTrackerEnabled(m_ui->checkIpFilterTrackers->isChecked());
|
||||
pref->setFilter(m_ui->textFilterPath->text());
|
||||
session->setFilteringEnabled(isFilteringEnabled());
|
||||
session->setTrackerFilteringEnabled(m_ui->checkIpFilterTrackers->isChecked());
|
||||
session->setIPFilterFile(m_ui->textFilterPath->text());
|
||||
// End IPFilter preferences
|
||||
// Queueing system
|
||||
pref->setQueueingSystemEnabled(isQueueingSystemEnabled());
|
||||
pref->setMaxActiveDownloads(m_ui->spinMaxActiveDownloads->value());
|
||||
pref->setMaxActiveUploads(m_ui->spinMaxActiveUploads->value());
|
||||
pref->setMaxActiveTorrents(m_ui->spinMaxActiveTorrents->value());
|
||||
pref->setIgnoreSlowTorrentsForQueueing(m_ui->checkIgnoreSlowTorrentsForQueueing->isChecked());
|
||||
session->setQueueingSystemEnabled(isQueueingSystemEnabled());
|
||||
session->setMaxActiveDownloads(m_ui->spinMaxActiveDownloads->value());
|
||||
session->setMaxActiveUploads(m_ui->spinMaxActiveUploads->value());
|
||||
session->setMaxActiveTorrents(m_ui->spinMaxActiveTorrents->value());
|
||||
session->setIgnoreSlowTorrentsForQueueing(m_ui->checkIgnoreSlowTorrentsForQueueing->isChecked());
|
||||
// End Queueing system preferences
|
||||
// Web UI
|
||||
pref->setWebUiEnabled(isWebUiEnabled());
|
||||
|
@ -626,29 +633,28 @@ bool OptionsDialog::isFilteringEnabled() const
|
|||
return m_ui->checkIPFilter->isChecked();
|
||||
}
|
||||
|
||||
int OptionsDialog::getProxyType() const
|
||||
Net::ProxyType OptionsDialog::getProxyType() const
|
||||
{
|
||||
switch (m_ui->comboProxyType->currentIndex()) {
|
||||
case 1:
|
||||
return Proxy::SOCKS4;
|
||||
return Net::ProxyType::SOCKS4;
|
||||
break;
|
||||
case 2:
|
||||
if (isProxyAuthEnabled())
|
||||
return Proxy::SOCKS5_PW;
|
||||
return Proxy::SOCKS5;
|
||||
return Net::ProxyType::SOCKS5_PW;
|
||||
return Net::ProxyType::SOCKS5;
|
||||
case 3:
|
||||
if (isProxyAuthEnabled())
|
||||
return Proxy::HTTP_PW;
|
||||
return Proxy::HTTP;
|
||||
return Net::ProxyType::HTTP_PW;
|
||||
return Net::ProxyType::HTTP;
|
||||
default:
|
||||
return -1;
|
||||
return Net::ProxyType::None;
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::loadOptions()
|
||||
{
|
||||
int intValue;
|
||||
qreal floatValue;
|
||||
QString strValue;
|
||||
bool fileLogBackup = true;
|
||||
bool fileLogDelete = true;
|
||||
|
@ -723,10 +729,10 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->textTempPath->setEnabled(m_ui->checkTempFolder->isChecked());
|
||||
m_ui->browseTempDirButton->setEnabled(m_ui->checkTempFolder->isChecked());
|
||||
m_ui->textTempPath->setText(Utils::Fs::toNativePath(session->tempPath()));
|
||||
m_ui->checkAppendqB->setChecked(pref->useIncompleteFilesExtension());
|
||||
m_ui->checkPreallocateAll->setChecked(pref->preAllocateAllFiles());
|
||||
m_ui->checkAppendqB->setChecked(session->isAppendExtensionEnabled());
|
||||
m_ui->checkPreallocateAll->setChecked(session->isPreallocationEnabled());
|
||||
|
||||
strValue = Utils::Fs::toNativePath(pref->getTorrentExportDir());
|
||||
strValue = Utils::Fs::toNativePath(session->torrentExportDirectory());
|
||||
if (strValue.isEmpty()) {
|
||||
// Disable
|
||||
m_ui->checkExportDir->setChecked(false);
|
||||
|
@ -741,7 +747,7 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->textExportDir->setText(strValue);
|
||||
}
|
||||
|
||||
strValue = Utils::Fs::toNativePath(pref->getFinishedTorrentExportDir());
|
||||
strValue = Utils::Fs::toNativePath(session->finishedTorrentExportDirectory());
|
||||
if (strValue.isEmpty()) {
|
||||
// Disable
|
||||
m_ui->checkExportDirFin->setChecked(false);
|
||||
|
@ -777,12 +783,12 @@ void OptionsDialog::loadOptions()
|
|||
// End Downloads preferences
|
||||
|
||||
// Connection preferences
|
||||
m_ui->checkUPnP->setChecked(pref->isUPnPEnabled());
|
||||
m_ui->checkRandomPort->setChecked(pref->useRandomPort());
|
||||
m_ui->spinPort->setValue(pref->getSessionPort());
|
||||
m_ui->checkUPnP->setChecked(Net::PortForwarder::instance()->isEnabled());
|
||||
m_ui->checkRandomPort->setChecked(session->useRandomPort());
|
||||
m_ui->spinPort->setValue(session->port());
|
||||
m_ui->spinPort->setDisabled(m_ui->checkRandomPort->isChecked());
|
||||
|
||||
intValue = pref->getMaxConnecs();
|
||||
intValue = session->maxConnections();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
m_ui->checkMaxConnecs->setChecked(true);
|
||||
|
@ -794,7 +800,7 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->checkMaxConnecs->setChecked(false);
|
||||
m_ui->spinMaxConnec->setEnabled(false);
|
||||
}
|
||||
intValue = pref->getMaxConnecsPerTorrent();
|
||||
intValue = session->maxConnectionsPerTorrent();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
m_ui->checkMaxConnecsPerTorrent->setChecked(true);
|
||||
|
@ -806,7 +812,7 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->checkMaxConnecsPerTorrent->setChecked(false);
|
||||
m_ui->spinMaxConnecPerTorrent->setEnabled(false);
|
||||
}
|
||||
intValue = pref->getMaxUploads();
|
||||
intValue = session->maxUploads();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
m_ui->checkMaxUploads->setChecked(true);
|
||||
|
@ -818,7 +824,7 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->checkMaxUploads->setChecked(false);
|
||||
m_ui->spinMaxUploads->setEnabled(false);
|
||||
}
|
||||
intValue = pref->getMaxUploadsPerTorrent();
|
||||
intValue = session->maxUploadsPerTorrent();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
m_ui->checkMaxUploadsPerTorrent->setChecked(true);
|
||||
|
@ -831,39 +837,45 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->spinMaxUploadsPerTorrent->setEnabled(false);
|
||||
}
|
||||
|
||||
intValue = pref->getProxyType();
|
||||
switch (intValue) {
|
||||
case Proxy::SOCKS4:
|
||||
auto proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
||||
Net::ProxyConfiguration proxyConf = proxyConfigManager->proxyConfiguration();
|
||||
using Net::ProxyType;
|
||||
bool useProxyAuth = false;
|
||||
switch (proxyConf.type) {
|
||||
case ProxyType::SOCKS4:
|
||||
m_ui->comboProxyType->setCurrentIndex(1);
|
||||
break;
|
||||
case Proxy::SOCKS5:
|
||||
case Proxy::SOCKS5_PW:
|
||||
case ProxyType::SOCKS5_PW:
|
||||
useProxyAuth = true;
|
||||
case ProxyType::SOCKS5:
|
||||
m_ui->comboProxyType->setCurrentIndex(2);
|
||||
break;
|
||||
case Proxy::HTTP:
|
||||
case Proxy::HTTP_PW:
|
||||
case ProxyType::HTTP_PW:
|
||||
useProxyAuth = true;
|
||||
case ProxyType::HTTP:
|
||||
m_ui->comboProxyType->setCurrentIndex(3);
|
||||
break;
|
||||
default:
|
||||
m_ui->comboProxyType->setCurrentIndex(0);
|
||||
}
|
||||
enableProxy(m_ui->comboProxyType->currentIndex());
|
||||
m_ui->textProxyIP->setText(pref->getProxyIp());
|
||||
m_ui->spinProxyPort->setValue(pref->getProxyPort());
|
||||
m_ui->checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
|
||||
m_ui->checkForceProxy->setChecked(pref->getForceProxy());
|
||||
m_ui->isProxyOnlyForTorrents->setChecked(pref->isProxyOnlyForTorrents());
|
||||
m_ui->checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
|
||||
m_ui->textProxyUsername->setText(pref->getProxyUsername());
|
||||
m_ui->textProxyPassword->setText(pref->getProxyPassword());
|
||||
enableProxy(m_ui->comboProxyType->currentIndex() > 0);
|
||||
m_ui->textProxyIP->setText(proxyConf.ip);
|
||||
m_ui->spinProxyPort->setValue(proxyConf.port);
|
||||
m_ui->checkProxyAuth->setChecked(useProxyAuth);
|
||||
m_ui->textProxyUsername->setText(proxyConf.username);
|
||||
m_ui->textProxyPassword->setText(proxyConf.password);
|
||||
|
||||
m_ui->checkIPFilter->setChecked(pref->isFilteringEnabled());
|
||||
m_ui->checkIpFilterTrackers->setChecked(pref->isFilteringTrackerEnabled());
|
||||
m_ui->textFilterPath->setText(Utils::Fs::toNativePath(pref->getFilter()));
|
||||
m_ui->checkProxyPeerConnecs->setChecked(session->isProxyPeerConnectionsEnabled());
|
||||
m_ui->checkForceProxy->setChecked(session->isForceProxyEnabled());
|
||||
m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyDisabled());
|
||||
|
||||
m_ui->checkIPFilter->setChecked(session->isFilteringEnabled());
|
||||
m_ui->checkIpFilterTrackers->setChecked(session->isTrackerFilteringEnabled());
|
||||
m_ui->textFilterPath->setText(Utils::Fs::toNativePath(session->IPFilterFile()));
|
||||
// End Connection preferences
|
||||
|
||||
// Speed preferences
|
||||
intValue = pref->getGlobalDownloadLimit();
|
||||
intValue = session->globalDownloadSpeedLimit();
|
||||
if (intValue > 0) {
|
||||
// Enabled
|
||||
m_ui->checkDownloadLimit->setChecked(true);
|
||||
|
@ -875,8 +887,8 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->checkDownloadLimit->setChecked(false);
|
||||
m_ui->spinDownloadLimit->setEnabled(false);
|
||||
}
|
||||
intValue = pref->getGlobalUploadLimit();
|
||||
if (intValue != -1) {
|
||||
intValue = session->globalUploadSpeedLimit();
|
||||
if (intValue > 0) {
|
||||
// Enabled
|
||||
m_ui->checkUploadLimit->setChecked(true);
|
||||
m_ui->spinUploadLimit->setEnabled(true);
|
||||
|
@ -888,7 +900,7 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->spinUploadLimit->setEnabled(false);
|
||||
}
|
||||
|
||||
intValue = pref->getAltGlobalDownloadLimit();
|
||||
intValue = session->altGlobalDownloadSpeedLimit();
|
||||
if (intValue > 0) {
|
||||
// Enabled
|
||||
m_ui->checkDownloadLimitAlt->setChecked(true);
|
||||
|
@ -900,8 +912,8 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->checkDownloadLimitAlt->setChecked(false);
|
||||
m_ui->spinDownloadLimitAlt->setEnabled(false);
|
||||
}
|
||||
intValue = pref->getAltGlobalUploadLimit();
|
||||
if (intValue != -1) {
|
||||
intValue = session->altGlobalUploadSpeedLimit();
|
||||
if (intValue > 0) {
|
||||
// Enabled
|
||||
m_ui->checkUploadLimitAlt->setChecked(true);
|
||||
m_ui->spinUploadLimitAlt->setEnabled(true);
|
||||
|
@ -913,40 +925,39 @@ void OptionsDialog::loadOptions()
|
|||
m_ui->spinUploadLimitAlt->setEnabled(false);
|
||||
}
|
||||
|
||||
m_ui->checkuTP->setChecked(pref->isuTPEnabled());
|
||||
m_ui->checkuTP->setChecked(session->isUTPEnabled());
|
||||
m_ui->checkLimituTPConnections->setEnabled(m_ui->checkuTP->isChecked());
|
||||
m_ui->checkLimituTPConnections->setChecked(pref->isuTPRateLimited());
|
||||
m_ui->checkLimitTransportOverhead->setChecked(pref->includeOverheadInLimits());
|
||||
m_ui->checkLimitLocalPeerRate->setChecked(!pref->getIgnoreLimitsOnLAN());
|
||||
m_ui->checkLimituTPConnections->setChecked(session->isUTPRateLimited());
|
||||
m_ui->checkLimitTransportOverhead->setChecked(session->includeOverheadInLimits());
|
||||
m_ui->checkLimitLocalPeerRate->setChecked(!session->ignoreLimitsOnLAN());
|
||||
|
||||
m_ui->check_schedule->setChecked(pref->isSchedulerEnabled());
|
||||
m_ui->check_schedule->setChecked(session->isBandwidthSchedulerEnabled());
|
||||
m_ui->schedule_from->setTime(pref->getSchedulerStartTime());
|
||||
m_ui->schedule_to->setTime(pref->getSchedulerEndTime());
|
||||
m_ui->schedule_days->setCurrentIndex((int)pref->getSchedulerDays());
|
||||
// End Speed preferences
|
||||
|
||||
// Bittorrent preferences
|
||||
m_ui->checkDHT->setChecked(pref->isDHTEnabled());
|
||||
m_ui->checkPeX->setChecked(pref->isPeXEnabled());
|
||||
m_ui->checkLSD->setChecked(pref->isLSDEnabled());
|
||||
m_ui->comboEncryption->setCurrentIndex(pref->getEncryptionSetting());
|
||||
m_ui->checkAnonymousMode->setChecked(pref->isAnonymousModeEnabled());
|
||||
m_ui->checkEnableAddTrackers->setChecked(pref->isAddTrackersEnabled());
|
||||
m_ui->textTrackers->setPlainText(pref->getTrackersList());
|
||||
m_ui->checkDHT->setChecked(session->isDHTEnabled());
|
||||
m_ui->checkPeX->setChecked(session->isPeXEnabled());
|
||||
m_ui->checkLSD->setChecked(session->isLSDEnabled());
|
||||
m_ui->comboEncryption->setCurrentIndex(session->encryption());
|
||||
m_ui->checkAnonymousMode->setChecked(session->isAnonymousModeEnabled());
|
||||
m_ui->checkEnableAddTrackers->setChecked(session->isAddTrackersEnabled());
|
||||
m_ui->textTrackers->setPlainText(session->additionalTrackers());
|
||||
|
||||
m_ui->checkEnableQueueing->setChecked(pref->isQueueingSystemEnabled());
|
||||
m_ui->spinMaxActiveDownloads->setValue(pref->getMaxActiveDownloads());
|
||||
m_ui->spinMaxActiveUploads->setValue(pref->getMaxActiveUploads());
|
||||
m_ui->spinMaxActiveTorrents->setValue(pref->getMaxActiveTorrents());
|
||||
m_ui->checkIgnoreSlowTorrentsForQueueing->setChecked(pref->ignoreSlowTorrentsForQueueing());
|
||||
m_ui->checkEnableQueueing->setChecked(session->isQueueingSystemEnabled());
|
||||
m_ui->spinMaxActiveDownloads->setValue(session->maxActiveDownloads());
|
||||
m_ui->spinMaxActiveUploads->setValue(session->maxActiveUploads());
|
||||
m_ui->spinMaxActiveTorrents->setValue(session->maxActiveTorrents());
|
||||
m_ui->checkIgnoreSlowTorrentsForQueueing->setChecked(session->ignoreSlowTorrentsForQueueing());
|
||||
|
||||
floatValue = pref->getGlobalMaxRatio();
|
||||
if (floatValue >= 0.) {
|
||||
if (session->globalMaxRatio() >= 0.) {
|
||||
// Enable
|
||||
m_ui->checkMaxRatio->setChecked(true);
|
||||
m_ui->spinMaxRatio->setEnabled(true);
|
||||
m_ui->comboRatioLimitAct->setEnabled(true);
|
||||
m_ui->spinMaxRatio->setValue(floatValue);
|
||||
m_ui->spinMaxRatio->setValue(session->globalMaxRatio());
|
||||
}
|
||||
else {
|
||||
// Disable
|
||||
|
@ -1522,13 +1533,12 @@ void OptionsDialog::on_IpFilterRefreshBtn_clicked()
|
|||
if (m_refreshingIpFilter) return;
|
||||
m_refreshingIpFilter = true;
|
||||
// Updating program preferences
|
||||
Preferences* const pref = Preferences::instance();
|
||||
pref->setFilteringEnabled(true);
|
||||
pref->setFilter(getFilter());
|
||||
// Force refresh
|
||||
connect(BitTorrent::Session::instance(), SIGNAL(ipFilterParsed(bool, int)), SLOT(handleIPFilterParsed(bool, int)));
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
session->setFilteringEnabled(true);
|
||||
session->setIPFilterFile(""); // forcing Session reload filter file
|
||||
session->setIPFilterFile(getFilter());
|
||||
connect(session, SIGNAL(IPFilterParsed(bool, int)), SLOT(handleIPFilterParsed(bool, int)));
|
||||
setCursor(QCursor(Qt::WaitCursor));
|
||||
BitTorrent::Session::instance()->enableIPFilter(getFilter(), true);
|
||||
}
|
||||
|
||||
void OptionsDialog::handleIPFilterParsed(bool error, int ruleCount)
|
||||
|
@ -1539,7 +1549,7 @@ void OptionsDialog::handleIPFilterParsed(bool error, int ruleCount)
|
|||
else
|
||||
QMessageBox::information(this, tr("Successfully refreshed"), tr("Successfully parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount));
|
||||
m_refreshingIpFilter = false;
|
||||
disconnect(BitTorrent::Session::instance(), SIGNAL(ipFilterParsed(bool, int)), this, SLOT(handleIPFilterParsed(bool, int)));
|
||||
disconnect(BitTorrent::Session::instance(), SIGNAL(IPFilterParsed(bool, int)), this, SLOT(handleIPFilterParsed(bool, int)));
|
||||
}
|
||||
|
||||
QString OptionsDialog::languageToLocalizedString(const QLocale &locale)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue