From 3fca49e44db0def4b4e4f68164283452e1dcd2fe Mon Sep 17 00:00:00 2001 From: thalieht Date: Sat, 9 Mar 2019 17:21:02 +0200 Subject: [PATCH 1/4] Add documentation links to some advanced settings --- src/gui/advancedsettings.cpp | 60 +++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index 5cbcbe1c8..fc6ae4af4 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -43,6 +43,14 @@ #include "gui/addnewtorrentdialog.h" #include "gui/mainwindow.h" +namespace +{ + QString makeLink(const QString &url, const QString &linkLabel) + { + return QStringLiteral("%2").arg(url, linkLabel); + } +} + enum AdvSettingsCols { PROPERTY, @@ -303,12 +311,12 @@ void AdvancedSettings::loadAdvancedSettings() const BitTorrent::Session *const session = BitTorrent::Session::instance(); // add section headers - labelQbtLink.setText(QString("%2") - .arg("https://github.com/qbittorrent/qBittorrent/wiki/Explanation-of-Options-in-qBittorrent#Advanced", tr("Open documentation"))); + labelQbtLink.setText(makeLink("https://github.com/qbittorrent/qBittorrent/wiki/Explanation-of-Options-in-qBittorrent#Advanced" + , tr("Open documentation"))); labelQbtLink.setOpenExternalLinks(true); addRow(QBITTORRENT_HEADER, QString("%1").arg(tr("qBittorrent Section")), &labelQbtLink); - labelLibtorrentLink.setText(QString("%2").arg("https://www.libtorrent.org/reference.html", tr("Open documentation"))); + labelLibtorrentLink.setText(makeLink("https://www.libtorrent.org/reference.html", tr("Open documentation"))); labelLibtorrentLink.setOpenExternalLinks(true); addRow(LIBTORRENT_HEADER, QString("%1").arg(tr("libtorrent Section")), &labelLibtorrentLink); @@ -316,7 +324,8 @@ void AdvancedSettings::loadAdvancedSettings() spinBoxAsyncIOThreads.setMinimum(1); spinBoxAsyncIOThreads.setMaximum(1024); spinBoxAsyncIOThreads.setValue(session->asyncIOThreads()); - addRow(ASYNC_IO_THREADS, tr("Asynchronous I/O threads"), &spinBoxAsyncIOThreads); + addRow(ASYNC_IO_THREADS, (tr("Asynchronous I/O threads") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#aio_threads", "(?)")) + , &spinBoxAsyncIOThreads); // Checking Memory Usage spinBoxCheckingMemUsage.setMinimum(1); @@ -329,7 +338,8 @@ void AdvancedSettings::loadAdvancedSettings() #endif spinBoxCheckingMemUsage.setValue(session->checkingMemUsage()); spinBoxCheckingMemUsage.setSuffix(tr(" MiB")); - addRow(CHECKING_MEM_USAGE, tr("Outstanding memory when checking torrents"), &spinBoxCheckingMemUsage); + addRow(CHECKING_MEM_USAGE, (tr("Outstanding memory when checking torrents") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#checking_mem_usage", "(?)")) + , &spinBoxCheckingMemUsage); // Disk write cache spinBoxCache.setMinimum(-1); @@ -343,41 +353,50 @@ void AdvancedSettings::loadAdvancedSettings() #endif spinBoxCache.setValue(session->diskCacheSize()); updateCacheSpinSuffix(spinBoxCache.value()); - addRow(DISK_CACHE, tr("Disk cache"), &spinBoxCache); + addRow(DISK_CACHE, (tr("Disk cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_size", "(?)")) + , &spinBoxCache); // Disk cache expiry spinBoxCacheTTL.setMinimum(15); spinBoxCacheTTL.setMaximum(600); spinBoxCacheTTL.setValue(session->diskCacheTTL()); spinBoxCacheTTL.setSuffix(tr(" s", " seconds")); - addRow(DISK_CACHE_TTL, tr("Disk cache expiry interval"), &spinBoxCacheTTL); + addRow(DISK_CACHE_TTL, (tr("Disk cache expiry interval") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_expiry", "(?)")) + , &spinBoxCacheTTL); // Enable OS cache checkBoxOsCache.setChecked(session->useOSCache()); - addRow(OS_CACHE, tr("Enable OS cache"), &checkBoxOsCache); + addRow(OS_CACHE, (tr("Enable OS cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#disk_io_write_mode", "(?)")) + , &checkBoxOsCache); // Guided read cache checkBoxGuidedReadCache.setChecked(session->isGuidedReadCacheEnabled()); - addRow(GUIDED_READ_CACHE, tr("Guided read cache"), &checkBoxGuidedReadCache); + addRow(GUIDED_READ_CACHE, (tr("Guided read cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#guided_read_cache", "(?)")) + , &checkBoxGuidedReadCache); // Coalesce reads & writes checkBoxCoalesceRW.setChecked(session->isCoalesceReadWriteEnabled()); - addRow(COALESCE_RW, tr("Coalesce reads & writes"), &checkBoxCoalesceRW); + addRow(COALESCE_RW, (tr("Coalesce reads & writes") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#coalesce_reads", "(?)")) + , &checkBoxCoalesceRW); // Suggest mode checkBoxSuggestMode.setChecked(session->isSuggestModeEnabled()); - addRow(SUGGEST_MODE, tr("Send upload piece suggestions"), &checkBoxSuggestMode); + addRow(SUGGEST_MODE, (tr("Send upload piece suggestions") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#suggest_mode", "(?)")) + , &checkBoxSuggestMode); // Send buffer watermark spinBoxSendBufferWatermark.setMinimum(1); spinBoxSendBufferWatermark.setMaximum(INT_MAX); spinBoxSendBufferWatermark.setSuffix(tr(" KiB")); spinBoxSendBufferWatermark.setValue(session->sendBufferWatermark()); - addRow(SEND_BUF_WATERMARK, tr("Send buffer watermark"), &spinBoxSendBufferWatermark); + 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(INT_MAX); spinBoxSendBufferLowWatermark.setSuffix(tr(" KiB")); spinBoxSendBufferLowWatermark.setValue(session->sendBufferLowWatermark()); - addRow(SEND_BUF_LOW_WATERMARK, tr("Send buffer low watermark"), &spinBoxSendBufferLowWatermark); + 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(INT_MAX); spinBoxSendBufferWatermarkFactor.setSuffix(" %"); spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor()); - addRow(SEND_BUF_WATERMARK_FACTOR, tr("Send buffer watermark factor"), &spinBoxSendBufferWatermarkFactor); + addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor", "(?)")) + , &spinBoxSendBufferWatermarkFactor); // Save resume data interval spinBoxSaveResumeDataInterval.setMinimum(0); spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits::max()); @@ -397,7 +416,9 @@ void AdvancedSettings::loadAdvancedSettings() // uTP-TCP mixed mode comboBoxUtpMixedMode.addItems({tr("Prefer TCP"), tr("Peer proportional (throttles TCP)")}); comboBoxUtpMixedMode.setCurrentIndex(static_cast(session->utpMixedMode())); - addRow(UTP_MIX_MODE, tr("%1-TCP mixed mode algorithm", "uTP-TCP mixed mode algorithm").arg(C_UTP), &comboBoxUtpMixedMode); + 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); // multiple connections per IP checkBoxMultiConnectionsPerIp.setChecked(session->multiConnectionsPerIpEnabled()); addRow(MULTI_CONNECTIONS_PER_IP, tr("Allow multiple connections from the same IP address"), &checkBoxMultiConnectionsPerIp); @@ -423,7 +444,8 @@ void AdvancedSettings::loadAdvancedSettings() addRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Unlimited]"), &spinBoxMaxHalfOpen); // Super seeding checkBoxSuperSeeding.setChecked(session->isSuperSeedingEnabled()); - addRow(SUPER_SEEDING, tr("Strict super seeding"), &checkBoxSuperSeeding); + addRow(SUPER_SEEDING, (tr("Strict super seeding") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#strict_super_seeding", "(?)")) + , &checkBoxSuperSeeding); // Network interface comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface")); const QString currentInterface = session->networkInterface(); @@ -487,11 +509,13 @@ void AdvancedSettings::loadAdvancedSettings() // Choking algorithm comboBoxChokingAlgorithm.addItems({tr("Fixed slots"), tr("Upload rate based")}); comboBoxChokingAlgorithm.setCurrentIndex(static_cast(session->chokingAlgorithm())); - addRow(CHOKING_ALGORITHM, tr("Upload slots behavior"), &comboBoxChokingAlgorithm); + addRow(CHOKING_ALGORITHM, (tr("Upload slots behavior") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#choking_algorithm", "(?)")) + , &comboBoxChokingAlgorithm); // Seed choking algorithm comboBoxSeedChokingAlgorithm.addItems({tr("Round-robin"), tr("Fastest upload"), tr("Anti-leech")}); comboBoxSeedChokingAlgorithm.setCurrentIndex(static_cast(session->seedChokingAlgorithm())); - addRow(SEED_CHOKING_ALGORITHM, tr("Upload choking algorithm"), &comboBoxSeedChokingAlgorithm); + addRow(SEED_CHOKING_ALGORITHM, (tr("Upload choking algorithm") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#seed_choking_algorithm", "(?)")) + , &comboBoxSeedChokingAlgorithm); #if defined(Q_OS_WIN) || defined(Q_OS_MAC) checkBoxUpdateCheck.setChecked(pref->isUpdateCheckEnabled()); From cccaca0c01699cc17f62c1391d391e305f0bdbb5 Mon Sep 17 00:00:00 2001 From: thalieht Date: Sat, 9 Mar 2019 17:25:39 +0200 Subject: [PATCH 2/4] Center align the section labels in advanced settings --- src/gui/advancedsettings.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index fc6ae4af4..786abff17 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -315,10 +315,12 @@ void AdvancedSettings::loadAdvancedSettings() , tr("Open documentation"))); labelQbtLink.setOpenExternalLinks(true); addRow(QBITTORRENT_HEADER, QString("%1").arg(tr("qBittorrent Section")), &labelQbtLink); + static_cast(cellWidget(QBITTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); labelLibtorrentLink.setText(makeLink("https://www.libtorrent.org/reference.html", tr("Open documentation"))); labelLibtorrentLink.setOpenExternalLinks(true); addRow(LIBTORRENT_HEADER, QString("%1").arg(tr("libtorrent Section")), &labelLibtorrentLink); + static_cast(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); // Async IO threads spinBoxAsyncIOThreads.setMinimum(1); From bcfa62cc76d3bdcf50bef3ec99070c9350cea743 Mon Sep 17 00:00:00 2001 From: thalieht Date: Sat, 9 Mar 2019 17:29:23 +0200 Subject: [PATCH 3/4] Rename "#" column to "Tier" in the tracker list --- src/gui/properties/trackerlistwidget.cpp | 2 +- src/webui/www/private/scripts/dynamicTable.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/properties/trackerlistwidget.cpp b/src/gui/properties/trackerlistwidget.cpp index 207738cdd..da83461fe 100644 --- a/src/gui/properties/trackerlistwidget.cpp +++ b/src/gui/properties/trackerlistwidget.cpp @@ -582,7 +582,7 @@ void TrackerListWidget::saveSettings() const QStringList TrackerListWidget::headerLabels() { static const QStringList header { - "#" + tr("Tier") , tr("URL") , tr("Status") , tr("Peers") diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 27f1f4fb1..9c56ce7a2 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -1572,7 +1572,7 @@ var TorrentTrackersTable = new Class({ Extends: DynamicTable, initColumns: function() { - this.newColumn('tier', '', 'QBT_TR(#)QBT_TR[CONTEXT=TrackerListWidget]', 35, true); + this.newColumn('tier', '', 'QBT_TR(Tier)QBT_TR[CONTEXT=TrackerListWidget]', 35, true); this.newColumn('url', '', 'QBT_TR(URL)QBT_TR[CONTEXT=TrackerListWidget]', 250, true); this.newColumn('status', '', 'QBT_TR(Status)QBT_TR[CONTEXT=TrackerListWidget]', 125, true); this.newColumn('peers', '', 'QBT_TR(Peers)QBT_TR[CONTEXT=TrackerListWidget]', 75, true); From 4c53447d3535ba666ff277aa88cec7cdee902f49 Mon Sep 17 00:00:00 2001 From: thalieht Date: Mon, 11 Mar 2019 21:47:49 +0200 Subject: [PATCH 4/4] Remove the max half-open connections option from GUI Its functionality was deprecated long ago. --- src/base/bittorrent/session.cpp | 15 --------------- src/base/bittorrent/session.h | 3 --- src/gui/advancedsettings.cpp | 8 -------- src/gui/advancedsettings.h | 2 +- 4 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 1e542ecbf..d02fa3843 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -287,7 +287,6 @@ Session::Session(QObject *parent) , m_announceIP(BITTORRENT_SESSION_KEY("AnnounceIP")) , m_isSuperSeedingEnabled(BITTORRENT_SESSION_KEY("SuperSeedingEnabled"), false) , m_maxConnections(BITTORRENT_SESSION_KEY("MaxConnections"), 500, lowerLimited(0, -1)) - , m_maxHalfOpenConnections(BITTORRENT_SESSION_KEY("MaxHalfOpenConnections"), 20, lowerLimited(0, -1)) , m_maxUploads(BITTORRENT_SESSION_KEY("MaxUploads"), -1, lowerLimited(0, -1)) , m_maxConnectionsPerTorrent(BITTORRENT_SESSION_KEY("MaxConnectionsPerTorrent"), 100, lowerLimited(0, -1)) , m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY("MaxUploadsPerTorrent"), -1, lowerLimited(0, -1)) @@ -3113,20 +3112,6 @@ void Session::setMaxConnections(int max) } } -int Session::maxHalfOpenConnections() const -{ - return m_maxHalfOpenConnections; -} - -void Session::setMaxHalfOpenConnections(int max) -{ - max = (max > 0) ? max : -1; - if (max != m_maxHalfOpenConnections) { - m_maxHalfOpenConnections = max; - configureDeferred(); - } -} - int Session::maxUploads() const { return m_maxUploads; diff --git a/src/base/bittorrent/session.h b/src/base/bittorrent/session.h index dc9103e7d..ce421c593 100644 --- a/src/base/bittorrent/session.h +++ b/src/base/bittorrent/session.h @@ -413,8 +413,6 @@ namespace BitTorrent void setSuperSeedingEnabled(bool enabled); int maxConnections() const; void setMaxConnections(int max); - int maxHalfOpenConnections() const; - void setMaxHalfOpenConnections(int max); int maxConnectionsPerTorrent() const; void setMaxConnectionsPerTorrent(int max); int maxUploads() const; @@ -660,7 +658,6 @@ namespace BitTorrent CachedSettingValue m_announceIP; CachedSettingValue m_isSuperSeedingEnabled; CachedSettingValue m_maxConnections; - CachedSettingValue m_maxHalfOpenConnections; CachedSettingValue m_maxUploads; CachedSettingValue m_maxConnectionsPerTorrent; CachedSettingValue m_maxUploadsPerTorrent; diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index 786abff17..dd5d5139a 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -102,7 +102,6 @@ enum AdvSettingsRows SEND_BUF_LOW_WATERMARK, SEND_BUF_WATERMARK_FACTOR, // ports - MAX_HALF_OPEN, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, UTP_MIX_MODE, @@ -189,8 +188,6 @@ void AdvancedSettings::saveAdvancedSettings() // Peer resolution pref->resolvePeerCountries(checkBoxResolveCountries.isChecked()); pref->resolvePeerHostNames(checkBoxResolveHosts.isChecked()); - // Max Half-Open connections - session->setMaxHalfOpenConnections(spinBoxMaxHalfOpen.value()); // Super seeding session->setSuperSeedingEnabled(checkBoxSuperSeeding.isChecked()); // Network interface @@ -439,11 +436,6 @@ void AdvancedSettings::loadAdvancedSettings() // Resolve peer hosts checkBoxResolveHosts.setChecked(pref->resolvePeerHostNames()); addRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &checkBoxResolveHosts); - // Max Half Open connections - spinBoxMaxHalfOpen.setMinimum(0); - spinBoxMaxHalfOpen.setMaximum(99999); - spinBoxMaxHalfOpen.setValue(session->maxHalfOpenConnections()); - addRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Unlimited]"), &spinBoxMaxHalfOpen); // Super seeding checkBoxSuperSeeding.setChecked(session->isSuperSeedingEnabled()); addRow(SUPER_SEEDING, (tr("Strict super seeding") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#strict_super_seeding", "(?)")) diff --git a/src/gui/advancedsettings.h b/src/gui/advancedsettings.h index 4272e08c3..41d8dfbf0 100644 --- a/src/gui/advancedsettings.h +++ b/src/gui/advancedsettings.h @@ -59,7 +59,7 @@ private: template void addRow(int row, const QString &text, T *widget); QLabel labelQbtLink, labelLibtorrentLink; - QSpinBox spinBoxAsyncIOThreads, spinBoxCheckingMemUsage, spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh, spinBoxMaxHalfOpen, + QSpinBox spinBoxAsyncIOThreads, spinBoxCheckingMemUsage, spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh, spinBoxTrackerPort, spinBoxCacheTTL, spinBoxSendBufferWatermark, spinBoxSendBufferLowWatermark, spinBoxSendBufferWatermarkFactor, spinBoxSavePathHistoryLength; QCheckBox checkBoxOsCache, checkBoxRecheckCompleted, checkBoxResolveCountries, checkBoxResolveHosts, checkBoxSuperSeeding,