Rename class variables

This commit is contained in:
Chocobo1 2019-07-23 14:34:57 +08:00
parent ccec50e18e
commit 9d88dd2604
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
2 changed files with 197 additions and 197 deletions

View file

@ -137,11 +137,11 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
setSelectionMode(QAbstractItemView::NoSelection);
setEditTriggers(QAbstractItemView::NoEditTriggers);
// Signals
connect(&spinBoxCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
connect(&m_spinBoxCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateCacheSpinSuffix);
connect(&comboBoxInterface, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
connect(&m_comboBoxInterface, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
, this, &AdvancedSettings::updateInterfaceAddressCombo);
connect(&spinBoxSaveResumeDataInterval, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
connect(&m_spinBoxSaveResumeDataInterval, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateSaveResumeDataIntervalSuffix);
// Load settings
loadAdvancedSettings();
@ -155,129 +155,129 @@ void AdvancedSettings::saveAdvancedSettings()
BitTorrent::Session *const session = BitTorrent::Session::instance();
// Async IO threads
session->setAsyncIOThreads(spinBoxAsyncIOThreads.value());
session->setAsyncIOThreads(m_spinBoxAsyncIOThreads.value());
// File pool size
session->setFilePoolSize(spinBoxFilePoolSize.value());
session->setFilePoolSize(m_spinBoxFilePoolSize.value());
// Checking Memory Usage
session->setCheckingMemUsage(spinBoxCheckingMemUsage.value());
session->setCheckingMemUsage(m_spinBoxCheckingMemUsage.value());
// Disk write cache
session->setDiskCacheSize(spinBoxCache.value());
session->setDiskCacheTTL(spinBoxCacheTTL.value());
session->setDiskCacheSize(m_spinBoxCache.value());
session->setDiskCacheTTL(m_spinBoxCacheTTL.value());
// Enable OS cache
session->setUseOSCache(checkBoxOsCache.isChecked());
session->setUseOSCache(m_checkBoxOsCache.isChecked());
// Coalesce reads & writes
session->setCoalesceReadWriteEnabled(checkBoxCoalesceRW.isChecked());
session->setCoalesceReadWriteEnabled(m_checkBoxCoalesceRW.isChecked());
// Suggest mode
session->setSuggestMode(checkBoxSuggestMode.isChecked());
session->setSuggestMode(m_checkBoxSuggestMode.isChecked());
// Send buffer watermark
session->setSendBufferWatermark(spinBoxSendBufferWatermark.value());
session->setSendBufferLowWatermark(spinBoxSendBufferLowWatermark.value());
session->setSendBufferWatermarkFactor(spinBoxSendBufferWatermarkFactor.value());
session->setSendBufferWatermark(m_spinBoxSendBufferWatermark.value());
session->setSendBufferLowWatermark(m_spinBoxSendBufferLowWatermark.value());
session->setSendBufferWatermarkFactor(m_spinBoxSendBufferWatermarkFactor.value());
// Socket listen backlog size
session->setSocketBacklogSize(spinBoxSocketBacklogSize.value());
session->setSocketBacklogSize(m_spinBoxSocketBacklogSize.value());
// Save resume data interval
session->setSaveResumeDataInterval(spinBoxSaveResumeDataInterval.value());
session->setSaveResumeDataInterval(m_spinBoxSaveResumeDataInterval.value());
// Outgoing ports
session->setOutgoingPortsMin(spinBoxOutgoingPortsMin.value());
session->setOutgoingPortsMax(spinBoxOutgoingPortsMax.value());
session->setOutgoingPortsMin(m_spinBoxOutgoingPortsMin.value());
session->setOutgoingPortsMax(m_spinBoxOutgoingPortsMax.value());
// uTP-TCP mixed mode
session->setUtpMixedMode(static_cast<BitTorrent::MixedModeAlgorithm>(comboBoxUtpMixedMode.currentIndex()));
session->setUtpMixedMode(static_cast<BitTorrent::MixedModeAlgorithm>(m_comboBoxUtpMixedMode.currentIndex()));
// multiple connections per IP
session->setMultiConnectionsPerIpEnabled(checkBoxMultiConnectionsPerIp.isChecked());
session->setMultiConnectionsPerIpEnabled(m_checkBoxMultiConnectionsPerIp.isChecked());
// Recheck torrents on completion
pref->recheckTorrentsOnCompletion(checkBoxRecheckCompleted.isChecked());
pref->recheckTorrentsOnCompletion(m_checkBoxRecheckCompleted.isChecked());
// Transfer list refresh interval
session->setRefreshInterval(spinBoxListRefresh.value());
session->setRefreshInterval(m_spinBoxListRefresh.value());
// Peer resolution
pref->resolvePeerCountries(checkBoxResolveCountries.isChecked());
pref->resolvePeerHostNames(checkBoxResolveHosts.isChecked());
pref->resolvePeerCountries(m_checkBoxResolveCountries.isChecked());
pref->resolvePeerHostNames(m_checkBoxResolveHosts.isChecked());
// Super seeding
session->setSuperSeedingEnabled(checkBoxSuperSeeding.isChecked());
session->setSuperSeedingEnabled(m_checkBoxSuperSeeding.isChecked());
// Network interface
if (comboBoxInterface.currentIndex() == 0) {
if (m_comboBoxInterface.currentIndex() == 0) {
// All interfaces (default)
session->setNetworkInterface(QString());
session->setNetworkInterfaceName(QString());
}
else {
session->setNetworkInterface(comboBoxInterface.itemData(comboBoxInterface.currentIndex()).toString());
session->setNetworkInterfaceName(comboBoxInterface.currentText());
session->setNetworkInterface(m_comboBoxInterface.itemData(m_comboBoxInterface.currentIndex()).toString());
session->setNetworkInterfaceName(m_comboBoxInterface.currentText());
}
// Interface address
if (comboBoxInterfaceAddress.currentIndex() == 0) {
if (m_comboBoxInterfaceAddress.currentIndex() == 0) {
// All addresses (default)
session->setNetworkInterfaceAddress({});
}
else {
QHostAddress ifaceAddr(comboBoxInterfaceAddress.currentText().trimmed());
QHostAddress ifaceAddr(m_comboBoxInterfaceAddress.currentText().trimmed());
ifaceAddr.isNull() ? session->setNetworkInterfaceAddress({}) : session->setNetworkInterfaceAddress(ifaceAddr.toString());
}
session->setIPv6Enabled(checkBoxListenIPv6.isChecked());
session->setIPv6Enabled(m_checkBoxListenIPv6.isChecked());
// Announce IP
QHostAddress addr(lineEditAnnounceIP.text().trimmed());
QHostAddress addr(m_lineEditAnnounceIP.text().trimmed());
session->setAnnounceIP(addr.isNull() ? "" : addr.toString());
// Program notification
MainWindow *const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
mainWindow->setNotificationsEnabled(checkBoxProgramNotifications.isChecked());
mainWindow->setTorrentAddedNotificationsEnabled(checkBoxTorrentAddedNotifications.isChecked());
mainWindow->setNotificationsEnabled(m_checkBoxProgramNotifications.isChecked());
mainWindow->setTorrentAddedNotificationsEnabled(m_checkBoxTorrentAddedNotifications.isChecked());
// Misc GUI properties
mainWindow->setDownloadTrackerFavicon(checkBoxTrackerFavicon.isChecked());
AddNewTorrentDialog::setSavePathHistoryLength(spinBoxSavePathHistoryLength.value());
pref->setSpeedWidgetEnabled(checkBoxSpeedWidgetEnabled.isChecked());
mainWindow->setDownloadTrackerFavicon(m_checkBoxTrackerFavicon.isChecked());
AddNewTorrentDialog::setSavePathHistoryLength(m_spinBoxSavePathHistoryLength.value());
pref->setSpeedWidgetEnabled(m_checkBoxSpeedWidgetEnabled.isChecked());
// Tracker
session->setTrackerEnabled(checkBoxTrackerStatus.isChecked());
pref->setTrackerPort(spinBoxTrackerPort.value());
session->setTrackerEnabled(m_checkBoxTrackerStatus.isChecked());
pref->setTrackerPort(m_spinBoxTrackerPort.value());
// Choking algorithm
session->setChokingAlgorithm(static_cast<BitTorrent::ChokingAlgorithm>(comboBoxChokingAlgorithm.currentIndex()));
session->setChokingAlgorithm(static_cast<BitTorrent::ChokingAlgorithm>(m_comboBoxChokingAlgorithm.currentIndex()));
// Seed choking algorithm
session->setSeedChokingAlgorithm(static_cast<BitTorrent::SeedChokingAlgorithm>(comboBoxSeedChokingAlgorithm.currentIndex()));
session->setSeedChokingAlgorithm(static_cast<BitTorrent::SeedChokingAlgorithm>(m_comboBoxSeedChokingAlgorithm.currentIndex()));
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
pref->setUpdateCheckEnabled(checkBoxUpdateCheck.isChecked());
pref->setUpdateCheckEnabled(m_checkBoxUpdateCheck.isChecked());
#endif
// Icon theme
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
pref->useSystemIconTheme(checkBoxUseIconTheme.isChecked());
pref->useSystemIconTheme(m_checkBoxUseIconTheme.isChecked());
#endif
pref->setConfirmTorrentRecheck(checkBoxConfirmTorrentRecheck.isChecked());
pref->setConfirmTorrentRecheck(m_checkBoxConfirmTorrentRecheck.isChecked());
pref->setConfirmRemoveAllTags(checkBoxConfirmRemoveAllTags.isChecked());
pref->setConfirmRemoveAllTags(m_checkBoxConfirmRemoveAllTags.isChecked());
session->setAnnounceToAllTrackers(checkBoxAnnounceAllTrackers.isChecked());
session->setAnnounceToAllTiers(checkBoxAnnounceAllTiers.isChecked());
session->setAnnounceToAllTrackers(m_checkBoxAnnounceAllTrackers.isChecked());
session->setAnnounceToAllTiers(m_checkBoxAnnounceAllTiers.isChecked());
}
void AdvancedSettings::updateCacheSpinSuffix(int value)
{
if (value == 0)
spinBoxCache.setSuffix(tr(" (disabled)"));
m_spinBoxCache.setSuffix(tr(" (disabled)"));
else if (value < 0)
spinBoxCache.setSuffix(tr(" (auto)"));
m_spinBoxCache.setSuffix(tr(" (auto)"));
else
spinBoxCache.setSuffix(tr(" MiB"));
m_spinBoxCache.setSuffix(tr(" MiB"));
}
void AdvancedSettings::updateSaveResumeDataIntervalSuffix(const int value)
{
if (value > 0)
spinBoxSaveResumeDataInterval.setSuffix(tr(" min", " minutes"));
m_spinBoxSaveResumeDataInterval.setSuffix(tr(" min", " minutes"));
else
spinBoxSaveResumeDataInterval.setSuffix(tr(" (disabled)"));
m_spinBoxSaveResumeDataInterval.setSuffix(tr(" (disabled)"));
}
void AdvancedSettings::updateInterfaceAddressCombo()
{
// Try to get the currently selected interface name
const QString ifaceName = comboBoxInterface.itemData(comboBoxInterface.currentIndex()).toString(); // Empty string for the first element
const QString ifaceName = m_comboBoxInterface.itemData(m_comboBoxInterface.currentIndex()).toString(); // Empty string for the first element
const QString currentAddress = BitTorrent::Session::instance()->networkInterfaceAddress();
// Clear all items and reinsert them, default to all
comboBoxInterfaceAddress.clear();
comboBoxInterfaceAddress.addItem(tr("All addresses"));
comboBoxInterfaceAddress.setCurrentIndex(0);
m_comboBoxInterfaceAddress.clear();
m_comboBoxInterfaceAddress.addItem(tr("All addresses"));
m_comboBoxInterfaceAddress.setCurrentIndex(0);
auto populateCombo = [this, &currentAddress](const QString &ip, const QAbstractSocket::NetworkLayerProtocol &protocol)
{
@ -285,10 +285,10 @@ void AdvancedSettings::updateInterfaceAddressCombo()
// Only take ipv4 for now?
if ((protocol != QAbstractSocket::IPv4Protocol) && (protocol != QAbstractSocket::IPv6Protocol))
return;
comboBoxInterfaceAddress.addItem(ip);
m_comboBoxInterfaceAddress.addItem(ip);
//Try to select the last added one
if (ip == currentAddress)
comboBoxInterfaceAddress.setCurrentIndex(comboBoxInterfaceAddress.count() - 1);
m_comboBoxInterfaceAddress.setCurrentIndex(m_comboBoxInterfaceAddress.count() - 1);
};
if (ifaceName.isEmpty()) {
@ -328,136 +328,136 @@ void AdvancedSettings::loadAdvancedSettings()
static_cast<QLabel *>(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
// Async IO threads
spinBoxAsyncIOThreads.setMinimum(1);
spinBoxAsyncIOThreads.setMaximum(1024);
spinBoxAsyncIOThreads.setValue(session->asyncIOThreads());
m_spinBoxAsyncIOThreads.setMinimum(1);
m_spinBoxAsyncIOThreads.setMaximum(1024);
m_spinBoxAsyncIOThreads.setValue(session->asyncIOThreads());
addRow(ASYNC_IO_THREADS, (tr("Asynchronous I/O threads") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#aio_threads", "(?)"))
, &spinBoxAsyncIOThreads);
, &m_spinBoxAsyncIOThreads);
// File pool size
spinBoxFilePoolSize.setMinimum(1);
spinBoxFilePoolSize.setMaximum(std::numeric_limits<int>::max());
spinBoxFilePoolSize.setValue(session->filePoolSize());
m_spinBoxFilePoolSize.setMinimum(1);
m_spinBoxFilePoolSize.setMaximum(std::numeric_limits<int>::max());
m_spinBoxFilePoolSize.setValue(session->filePoolSize());
addRow(FILE_POOL_SIZE, (tr("File pool size") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#file_pool_size", "(?)"))
, &spinBoxFilePoolSize);
, &m_spinBoxFilePoolSize);
// Checking Memory Usage
spinBoxCheckingMemUsage.setMinimum(1);
m_spinBoxCheckingMemUsage.setMinimum(1);
// When build as 32bit binary, set the maximum value lower to prevent crashes.
#ifdef QBT_APP_64BIT
spinBoxCheckingMemUsage.setMaximum(1024);
m_spinBoxCheckingMemUsage.setMaximum(1024);
#else
// Allocate at most 128MiB out of the remaining 512MiB (see the cache part below)
spinBoxCheckingMemUsage.setMaximum(128);
m_spinBoxCheckingMemUsage.setMaximum(128);
#endif
spinBoxCheckingMemUsage.setValue(session->checkingMemUsage());
spinBoxCheckingMemUsage.setSuffix(tr(" MiB"));
m_spinBoxCheckingMemUsage.setValue(session->checkingMemUsage());
m_spinBoxCheckingMemUsage.setSuffix(tr(" MiB"));
addRow(CHECKING_MEM_USAGE, (tr("Outstanding memory when checking torrents") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#checking_mem_usage", "(?)"))
, &spinBoxCheckingMemUsage);
, &m_spinBoxCheckingMemUsage);
// Disk write cache
spinBoxCache.setMinimum(-1);
m_spinBoxCache.setMinimum(-1);
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
#ifdef QBT_APP_64BIT
spinBoxCache.setMaximum(33554431); // 32768GiB
m_spinBoxCache.setMaximum(33554431); // 32768GiB
#else
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
spinBoxCache.setMaximum(1536);
m_spinBoxCache.setMaximum(1536);
#endif
spinBoxCache.setValue(session->diskCacheSize());
updateCacheSpinSuffix(spinBoxCache.value());
m_spinBoxCache.setValue(session->diskCacheSize());
updateCacheSpinSuffix(m_spinBoxCache.value());
addRow(DISK_CACHE, (tr("Disk cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_size", "(?)"))
, &spinBoxCache);
, &m_spinBoxCache);
// Disk cache expiry
spinBoxCacheTTL.setMinimum(1);
spinBoxCacheTTL.setMaximum(std::numeric_limits<int>::max());
spinBoxCacheTTL.setValue(session->diskCacheTTL());
spinBoxCacheTTL.setSuffix(tr(" s", " seconds"));
m_spinBoxCacheTTL.setMinimum(1);
m_spinBoxCacheTTL.setMaximum(std::numeric_limits<int>::max());
m_spinBoxCacheTTL.setValue(session->diskCacheTTL());
m_spinBoxCacheTTL.setSuffix(tr(" s", " seconds"));
addRow(DISK_CACHE_TTL, (tr("Disk cache expiry interval") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_expiry", "(?)"))
, &spinBoxCacheTTL);
, &m_spinBoxCacheTTL);
// Enable OS cache
checkBoxOsCache.setChecked(session->useOSCache());
m_checkBoxOsCache.setChecked(session->useOSCache());
addRow(OS_CACHE, (tr("Enable OS cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#disk_io_write_mode", "(?)"))
, &checkBoxOsCache);
, &m_checkBoxOsCache);
// Coalesce reads & writes
checkBoxCoalesceRW.setChecked(session->isCoalesceReadWriteEnabled());
m_checkBoxCoalesceRW.setChecked(session->isCoalesceReadWriteEnabled());
addRow(COALESCE_RW, (tr("Coalesce reads & writes") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#coalesce_reads", "(?)"))
, &checkBoxCoalesceRW);
, &m_checkBoxCoalesceRW);
// Suggest mode
checkBoxSuggestMode.setChecked(session->isSuggestModeEnabled());
m_checkBoxSuggestMode.setChecked(session->isSuggestModeEnabled());
addRow(SUGGEST_MODE, (tr("Send upload piece suggestions") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#suggest_mode", "(?)"))
, &checkBoxSuggestMode);
, &m_checkBoxSuggestMode);
// Send buffer watermark
spinBoxSendBufferWatermark.setMinimum(1);
spinBoxSendBufferWatermark.setMaximum(std::numeric_limits<int>::max());
spinBoxSendBufferWatermark.setSuffix(tr(" KiB"));
spinBoxSendBufferWatermark.setValue(session->sendBufferWatermark());
m_spinBoxSendBufferWatermark.setMinimum(1);
m_spinBoxSendBufferWatermark.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSendBufferWatermark.setSuffix(tr(" KiB"));
m_spinBoxSendBufferWatermark.setValue(session->sendBufferWatermark());
addRow(SEND_BUF_WATERMARK, (tr("Send buffer watermark") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark", "(?)"))
, &spinBoxSendBufferWatermark);
spinBoxSendBufferLowWatermark.setMinimum(1);
spinBoxSendBufferLowWatermark.setMaximum(std::numeric_limits<int>::max());
spinBoxSendBufferLowWatermark.setSuffix(tr(" KiB"));
spinBoxSendBufferLowWatermark.setValue(session->sendBufferLowWatermark());
, &m_spinBoxSendBufferWatermark);
m_spinBoxSendBufferLowWatermark.setMinimum(1);
m_spinBoxSendBufferLowWatermark.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSendBufferLowWatermark.setSuffix(tr(" KiB"));
m_spinBoxSendBufferLowWatermark.setValue(session->sendBufferLowWatermark());
addRow(SEND_BUF_LOW_WATERMARK, (tr("Send buffer low watermark") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_low_watermark", "(?)"))
, &spinBoxSendBufferLowWatermark);
spinBoxSendBufferWatermarkFactor.setMinimum(1);
spinBoxSendBufferWatermarkFactor.setMaximum(std::numeric_limits<int>::max());
spinBoxSendBufferWatermarkFactor.setSuffix(" %");
spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
, &m_spinBoxSendBufferLowWatermark);
m_spinBoxSendBufferWatermarkFactor.setMinimum(1);
m_spinBoxSendBufferWatermarkFactor.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSendBufferWatermarkFactor.setSuffix(" %");
m_spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor", "(?)"))
, &spinBoxSendBufferWatermarkFactor);
, &m_spinBoxSendBufferWatermarkFactor);
// Socket listen backlog size
spinBoxSocketBacklogSize.setMinimum(1);
spinBoxSocketBacklogSize.setMaximum(std::numeric_limits<int>::max());
spinBoxSocketBacklogSize.setValue(session->socketBacklogSize());
m_spinBoxSocketBacklogSize.setMinimum(1);
m_spinBoxSocketBacklogSize.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSocketBacklogSize.setValue(session->socketBacklogSize());
addRow(SOCKET_BACKLOG_SIZE, (tr("Socket backlog size") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#listen_queue_size", "(?)"))
, &spinBoxSocketBacklogSize);
, &m_spinBoxSocketBacklogSize);
// Save resume data interval
spinBoxSaveResumeDataInterval.setMinimum(0);
spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits<int>::max());
spinBoxSaveResumeDataInterval.setValue(session->saveResumeDataInterval());
updateSaveResumeDataIntervalSuffix(spinBoxSaveResumeDataInterval.value());
addRow(SAVE_RESUME_DATA_INTERVAL, tr("Save resume data interval", "How often the fastresume file is saved."), &spinBoxSaveResumeDataInterval);
m_spinBoxSaveResumeDataInterval.setMinimum(0);
m_spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSaveResumeDataInterval.setValue(session->saveResumeDataInterval());
updateSaveResumeDataIntervalSuffix(m_spinBoxSaveResumeDataInterval.value());
addRow(SAVE_RESUME_DATA_INTERVAL, tr("Save resume data interval", "How often the fastresume file is saved."), &m_spinBoxSaveResumeDataInterval);
// Outgoing port Min
spinBoxOutgoingPortsMin.setMinimum(0);
spinBoxOutgoingPortsMin.setMaximum(65535);
spinBoxOutgoingPortsMin.setValue(session->outgoingPortsMin());
addRow(OUTGOING_PORT_MIN, tr("Outgoing ports (Min) [0: Disabled]"), &spinBoxOutgoingPortsMin);
m_spinBoxOutgoingPortsMin.setMinimum(0);
m_spinBoxOutgoingPortsMin.setMaximum(65535);
m_spinBoxOutgoingPortsMin.setValue(session->outgoingPortsMin());
addRow(OUTGOING_PORT_MIN, tr("Outgoing ports (Min) [0: Disabled]"), &m_spinBoxOutgoingPortsMin);
// Outgoing port Min
spinBoxOutgoingPortsMax.setMinimum(0);
spinBoxOutgoingPortsMax.setMaximum(65535);
spinBoxOutgoingPortsMax.setValue(session->outgoingPortsMax());
addRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &spinBoxOutgoingPortsMax);
m_spinBoxOutgoingPortsMax.setMinimum(0);
m_spinBoxOutgoingPortsMax.setMaximum(65535);
m_spinBoxOutgoingPortsMax.setValue(session->outgoingPortsMax());
addRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &m_spinBoxOutgoingPortsMax);
// uTP-TCP mixed mode
comboBoxUtpMixedMode.addItems({tr("Prefer TCP"), tr("Peer proportional (throttles TCP)")});
comboBoxUtpMixedMode.setCurrentIndex(static_cast<int>(session->utpMixedMode()));
m_comboBoxUtpMixedMode.addItems({tr("Prefer TCP"), tr("Peer proportional (throttles TCP)")});
m_comboBoxUtpMixedMode.setCurrentIndex(static_cast<int>(session->utpMixedMode()));
addRow(UTP_MIX_MODE, (tr("%1-TCP mixed mode algorithm", "uTP-TCP mixed mode algorithm").arg(C_UTP)
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#mixed_mode_algorithm", "(?)"))
, &comboBoxUtpMixedMode);
, &m_comboBoxUtpMixedMode);
// multiple connections per IP
checkBoxMultiConnectionsPerIp.setChecked(session->multiConnectionsPerIpEnabled());
addRow(MULTI_CONNECTIONS_PER_IP, tr("Allow multiple connections from the same IP address"), &checkBoxMultiConnectionsPerIp);
m_checkBoxMultiConnectionsPerIp.setChecked(session->multiConnectionsPerIpEnabled());
addRow(MULTI_CONNECTIONS_PER_IP, tr("Allow multiple connections from the same IP address"), &m_checkBoxMultiConnectionsPerIp);
// Recheck completed torrents
checkBoxRecheckCompleted.setChecked(pref->recheckTorrentsOnCompletion());
addRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &checkBoxRecheckCompleted);
m_checkBoxRecheckCompleted.setChecked(pref->recheckTorrentsOnCompletion());
addRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &m_checkBoxRecheckCompleted);
// Transfer list refresh interval
spinBoxListRefresh.setMinimum(30);
spinBoxListRefresh.setMaximum(99999);
spinBoxListRefresh.setValue(session->refreshInterval());
spinBoxListRefresh.setSuffix(tr(" ms", " milliseconds"));
addRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spinBoxListRefresh);
m_spinBoxListRefresh.setMinimum(30);
m_spinBoxListRefresh.setMaximum(99999);
m_spinBoxListRefresh.setValue(session->refreshInterval());
m_spinBoxListRefresh.setSuffix(tr(" ms", " milliseconds"));
addRow(LIST_REFRESH, tr("Transfer list refresh interval"), &m_spinBoxListRefresh);
// Resolve Peer countries
checkBoxResolveCountries.setChecked(pref->resolvePeerCountries());
addRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &checkBoxResolveCountries);
m_checkBoxResolveCountries.setChecked(pref->resolvePeerCountries());
addRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &m_checkBoxResolveCountries);
// Resolve peer hosts
checkBoxResolveHosts.setChecked(pref->resolvePeerHostNames());
addRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &checkBoxResolveHosts);
m_checkBoxResolveHosts.setChecked(pref->resolvePeerHostNames());
addRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &m_checkBoxResolveHosts);
// Super seeding
checkBoxSuperSeeding.setChecked(session->isSuperSeedingEnabled());
m_checkBoxSuperSeeding.setChecked(session->isSuperSeedingEnabled());
addRow(SUPER_SEEDING, (tr("Strict super seeding") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#strict_super_seeding", "(?)"))
, &checkBoxSuperSeeding);
, &m_checkBoxSuperSeeding);
// Network interface
comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface"));
m_comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface"));
const QString currentInterface = session->networkInterface();
bool interfaceExists = currentInterface.isEmpty();
int i = 1;
@ -468,88 +468,88 @@ void AdvancedSettings::loadAdvancedSettings()
// https://github.com/qbittorrent/qBittorrent/pull/5135
if (iface.addressEntries().isEmpty()) continue;
comboBoxInterface.addItem(iface.humanReadableName(), iface.name());
m_comboBoxInterface.addItem(iface.humanReadableName(), iface.name());
if (!currentInterface.isEmpty() && (iface.name() == currentInterface)) {
comboBoxInterface.setCurrentIndex(i);
m_comboBoxInterface.setCurrentIndex(i);
interfaceExists = true;
}
++i;
}
// Saved interface does not exist, show it anyway
if (!interfaceExists) {
comboBoxInterface.addItem(session->networkInterfaceName(), currentInterface);
comboBoxInterface.setCurrentIndex(i);
m_comboBoxInterface.addItem(session->networkInterfaceName(), currentInterface);
m_comboBoxInterface.setCurrentIndex(i);
}
addRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &comboBoxInterface);
addRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &m_comboBoxInterface);
// Network interface address
updateInterfaceAddressCombo();
addRow(NETWORK_IFACE_ADDRESS, tr("Optional IP Address to bind to (requires restart)"), &comboBoxInterfaceAddress);
addRow(NETWORK_IFACE_ADDRESS, tr("Optional IP Address to bind to (requires restart)"), &m_comboBoxInterfaceAddress);
// Listen on IPv6 address
checkBoxListenIPv6.setChecked(session->isIPv6Enabled());
addRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &checkBoxListenIPv6);
m_checkBoxListenIPv6.setChecked(session->isIPv6Enabled());
addRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &m_checkBoxListenIPv6);
// Announce IP
lineEditAnnounceIP.setText(session->announceIP());
addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &lineEditAnnounceIP);
m_lineEditAnnounceIP.setText(session->announceIP());
addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &m_lineEditAnnounceIP);
// Program notifications
const MainWindow *const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
checkBoxProgramNotifications.setChecked(mainWindow->isNotificationsEnabled());
addRow(PROGRAM_NOTIFICATIONS, tr("Display notifications"), &checkBoxProgramNotifications);
m_checkBoxProgramNotifications.setChecked(mainWindow->isNotificationsEnabled());
addRow(PROGRAM_NOTIFICATIONS, tr("Display notifications"), &m_checkBoxProgramNotifications);
// Torrent added notifications
checkBoxTorrentAddedNotifications.setChecked(mainWindow->isTorrentAddedNotificationsEnabled());
addRow(TORRENT_ADDED_NOTIFICATIONS, tr("Display notifications for added torrents"), &checkBoxTorrentAddedNotifications);
m_checkBoxTorrentAddedNotifications.setChecked(mainWindow->isTorrentAddedNotificationsEnabled());
addRow(TORRENT_ADDED_NOTIFICATIONS, tr("Display notifications for added torrents"), &m_checkBoxTorrentAddedNotifications);
// Download tracker's favicon
checkBoxTrackerFavicon.setChecked(mainWindow->isDownloadTrackerFavicon());
addRow(DOWNLOAD_TRACKER_FAVICON, tr("Download tracker's favicon"), &checkBoxTrackerFavicon);
m_checkBoxTrackerFavicon.setChecked(mainWindow->isDownloadTrackerFavicon());
addRow(DOWNLOAD_TRACKER_FAVICON, tr("Download tracker's favicon"), &m_checkBoxTrackerFavicon);
// Save path history length
spinBoxSavePathHistoryLength.setRange(AddNewTorrentDialog::minPathHistoryLength, AddNewTorrentDialog::maxPathHistoryLength);
spinBoxSavePathHistoryLength.setValue(AddNewTorrentDialog::savePathHistoryLength());
addRow(SAVE_PATH_HISTORY_LENGTH, tr("Save path history length"), &spinBoxSavePathHistoryLength);
m_spinBoxSavePathHistoryLength.setRange(AddNewTorrentDialog::minPathHistoryLength, AddNewTorrentDialog::maxPathHistoryLength);
m_spinBoxSavePathHistoryLength.setValue(AddNewTorrentDialog::savePathHistoryLength());
addRow(SAVE_PATH_HISTORY_LENGTH, tr("Save path history length"), &m_spinBoxSavePathHistoryLength);
// Enable speed graphs
checkBoxSpeedWidgetEnabled.setChecked(pref->isSpeedWidgetEnabled());
addRow(ENABLE_SPEED_WIDGET, tr("Enable speed graphs"), &checkBoxSpeedWidgetEnabled);
m_checkBoxSpeedWidgetEnabled.setChecked(pref->isSpeedWidgetEnabled());
addRow(ENABLE_SPEED_WIDGET, tr("Enable speed graphs"), &m_checkBoxSpeedWidgetEnabled);
// Tracker State
checkBoxTrackerStatus.setChecked(session->isTrackerEnabled());
addRow(TRACKER_STATUS, tr("Enable embedded tracker"), &checkBoxTrackerStatus);
m_checkBoxTrackerStatus.setChecked(session->isTrackerEnabled());
addRow(TRACKER_STATUS, tr("Enable embedded tracker"), &m_checkBoxTrackerStatus);
// Tracker port
spinBoxTrackerPort.setMinimum(1);
spinBoxTrackerPort.setMaximum(65535);
spinBoxTrackerPort.setValue(pref->getTrackerPort());
addRow(TRACKER_PORT, tr("Embedded tracker port"), &spinBoxTrackerPort);
m_spinBoxTrackerPort.setMinimum(1);
m_spinBoxTrackerPort.setMaximum(65535);
m_spinBoxTrackerPort.setValue(pref->getTrackerPort());
addRow(TRACKER_PORT, tr("Embedded tracker port"), &m_spinBoxTrackerPort);
// Choking algorithm
comboBoxChokingAlgorithm.addItems({tr("Fixed slots"), tr("Upload rate based")});
comboBoxChokingAlgorithm.setCurrentIndex(static_cast<int>(session->chokingAlgorithm()));
m_comboBoxChokingAlgorithm.addItems({tr("Fixed slots"), tr("Upload rate based")});
m_comboBoxChokingAlgorithm.setCurrentIndex(static_cast<int>(session->chokingAlgorithm()));
addRow(CHOKING_ALGORITHM, (tr("Upload slots behavior") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#choking_algorithm", "(?)"))
, &comboBoxChokingAlgorithm);
, &m_comboBoxChokingAlgorithm);
// Seed choking algorithm
comboBoxSeedChokingAlgorithm.addItems({tr("Round-robin"), tr("Fastest upload"), tr("Anti-leech")});
comboBoxSeedChokingAlgorithm.setCurrentIndex(static_cast<int>(session->seedChokingAlgorithm()));
m_comboBoxSeedChokingAlgorithm.addItems({tr("Round-robin"), tr("Fastest upload"), tr("Anti-leech")});
m_comboBoxSeedChokingAlgorithm.setCurrentIndex(static_cast<int>(session->seedChokingAlgorithm()));
addRow(SEED_CHOKING_ALGORITHM, (tr("Upload choking algorithm") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#seed_choking_algorithm", "(?)"))
, &comboBoxSeedChokingAlgorithm);
, &m_comboBoxSeedChokingAlgorithm);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
checkBoxUpdateCheck.setChecked(pref->isUpdateCheckEnabled());
addRow(UPDATE_CHECK, tr("Check for software updates"), &checkBoxUpdateCheck);
m_checkBoxUpdateCheck.setChecked(pref->isUpdateCheckEnabled());
addRow(UPDATE_CHECK, tr("Check for software updates"), &m_checkBoxUpdateCheck);
#endif
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
checkBoxUseIconTheme.setChecked(pref->useSystemIconTheme());
addRow(USE_ICON_THEME, tr("Use system icon theme"), &checkBoxUseIconTheme);
m_checkBoxUseIconTheme.setChecked(pref->useSystemIconTheme());
addRow(USE_ICON_THEME, tr("Use system icon theme"), &m_checkBoxUseIconTheme);
#endif
// Torrent recheck confirmation
checkBoxConfirmTorrentRecheck.setChecked(pref->confirmTorrentRecheck());
addRow(CONFIRM_RECHECK_TORRENT, tr("Confirm torrent recheck"), &checkBoxConfirmTorrentRecheck);
m_checkBoxConfirmTorrentRecheck.setChecked(pref->confirmTorrentRecheck());
addRow(CONFIRM_RECHECK_TORRENT, tr("Confirm torrent recheck"), &m_checkBoxConfirmTorrentRecheck);
// Remove all tags confirmation
checkBoxConfirmRemoveAllTags.setChecked(pref->confirmRemoveAllTags());
addRow(CONFIRM_REMOVE_ALL_TAGS, tr("Confirm removal of all tags"), &checkBoxConfirmRemoveAllTags);
m_checkBoxConfirmRemoveAllTags.setChecked(pref->confirmRemoveAllTags());
addRow(CONFIRM_REMOVE_ALL_TAGS, tr("Confirm removal of all tags"), &m_checkBoxConfirmRemoveAllTags);
// Announce to all trackers in a tier
checkBoxAnnounceAllTrackers.setChecked(session->announceToAllTrackers());
addRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers in a tier"), &checkBoxAnnounceAllTrackers);
m_checkBoxAnnounceAllTrackers.setChecked(session->announceToAllTrackers());
addRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers in a tier"), &m_checkBoxAnnounceAllTrackers);
// Announce to all tiers
checkBoxAnnounceAllTiers.setChecked(session->announceToAllTiers());
addRow(ANNOUNCE_ALL_TIERS, tr("Always announce to all tiers"), &checkBoxAnnounceAllTiers);
m_checkBoxAnnounceAllTiers.setChecked(session->announceToAllTiers());
addRow(ANNOUNCE_ALL_TIERS, tr("Always announce to all tiers"), &m_checkBoxAnnounceAllTiers);
}
template <typename T>

View file

@ -57,24 +57,24 @@ private:
void loadAdvancedSettings();
template <typename T> void addRow(int row, const QString &text, T *widget);
QSpinBox spinBoxAsyncIOThreads, spinBoxFilePoolSize, spinBoxCheckingMemUsage, spinBoxCache,
spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh,
spinBoxTrackerPort, spinBoxCacheTTL, spinBoxSendBufferWatermark, spinBoxSendBufferLowWatermark,
spinBoxSendBufferWatermarkFactor, spinBoxSocketBacklogSize, spinBoxSavePathHistoryLength;
QCheckBox checkBoxOsCache, checkBoxRecheckCompleted, checkBoxResolveCountries, checkBoxResolveHosts, checkBoxSuperSeeding,
checkBoxProgramNotifications, checkBoxTorrentAddedNotifications, checkBoxTrackerFavicon, checkBoxTrackerStatus,
checkBoxConfirmTorrentRecheck, checkBoxConfirmRemoveAllTags, checkBoxListenIPv6, checkBoxAnnounceAllTrackers, checkBoxAnnounceAllTiers,
checkBoxMultiConnectionsPerIp, checkBoxSuggestMode, checkBoxCoalesceRW, checkBoxSpeedWidgetEnabled;
QComboBox comboBoxInterface, comboBoxInterfaceAddress, comboBoxUtpMixedMode, comboBoxChokingAlgorithm, comboBoxSeedChokingAlgorithm;
QLineEdit lineEditAnnounceIP;
QSpinBox m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxCache,
m_spinBoxSaveResumeDataInterval, m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxListRefresh,
m_spinBoxTrackerPort, m_spinBoxCacheTTL, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
m_spinBoxSendBufferWatermarkFactor, m_spinBoxSocketBacklogSize, m_spinBoxSavePathHistoryLength;
QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts, m_checkBoxSuperSeeding,
m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxListenIPv6, m_checkBoxAnnounceAllTrackers, m_checkBoxAnnounceAllTiers,
m_checkBoxMultiConnectionsPerIp, m_checkBoxSuggestMode, m_checkBoxCoalesceRW, m_checkBoxSpeedWidgetEnabled;
QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm, m_comboBoxSeedChokingAlgorithm;
QLineEdit m_lineEditAnnounceIP;
// OS dependent settings
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
QCheckBox checkBoxUpdateCheck;
QCheckBox m_checkBoxUpdateCheck;
#endif
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
QCheckBox checkBoxUseIconTheme;
QCheckBox m_checkBoxUseIconTheme;
#endif
};