Browse Source

Add documentation links to some advanced settings

adaptive-webui-19844
thalieht 6 years ago
parent
commit
3fca49e44d
  1. 60
      src/gui/advancedsettings.cpp

60
src/gui/advancedsettings.cpp

@ -43,6 +43,14 @@
#include "gui/addnewtorrentdialog.h" #include "gui/addnewtorrentdialog.h"
#include "gui/mainwindow.h" #include "gui/mainwindow.h"
namespace
{
QString makeLink(const QString &url, const QString &linkLabel)
{
return QStringLiteral("<a href=\"%1\">%2</a>").arg(url, linkLabel);
}
}
enum AdvSettingsCols enum AdvSettingsCols
{ {
PROPERTY, PROPERTY,
@ -303,12 +311,12 @@ void AdvancedSettings::loadAdvancedSettings()
const BitTorrent::Session *const session = BitTorrent::Session::instance(); const BitTorrent::Session *const session = BitTorrent::Session::instance();
// add section headers // add section headers
labelQbtLink.setText(QString("<a href=\"%1\">%2</a>") labelQbtLink.setText(makeLink("https://github.com/qbittorrent/qBittorrent/wiki/Explanation-of-Options-in-qBittorrent#Advanced"
.arg("https://github.com/qbittorrent/qBittorrent/wiki/Explanation-of-Options-in-qBittorrent#Advanced", tr("Open documentation"))); , tr("Open documentation")));
labelQbtLink.setOpenExternalLinks(true); labelQbtLink.setOpenExternalLinks(true);
addRow(QBITTORRENT_HEADER, QString("<b>%1</b>").arg(tr("qBittorrent Section")), &labelQbtLink); addRow(QBITTORRENT_HEADER, QString("<b>%1</b>").arg(tr("qBittorrent Section")), &labelQbtLink);
labelLibtorrentLink.setText(QString("<a href=\"%1\">%2</a>").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); labelLibtorrentLink.setOpenExternalLinks(true);
addRow(LIBTORRENT_HEADER, QString("<b>%1</b>").arg(tr("libtorrent Section")), &labelLibtorrentLink); addRow(LIBTORRENT_HEADER, QString("<b>%1</b>").arg(tr("libtorrent Section")), &labelLibtorrentLink);
@ -316,7 +324,8 @@ void AdvancedSettings::loadAdvancedSettings()
spinBoxAsyncIOThreads.setMinimum(1); spinBoxAsyncIOThreads.setMinimum(1);
spinBoxAsyncIOThreads.setMaximum(1024); spinBoxAsyncIOThreads.setMaximum(1024);
spinBoxAsyncIOThreads.setValue(session->asyncIOThreads()); 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 // Checking Memory Usage
spinBoxCheckingMemUsage.setMinimum(1); spinBoxCheckingMemUsage.setMinimum(1);
@ -329,7 +338,8 @@ void AdvancedSettings::loadAdvancedSettings()
#endif #endif
spinBoxCheckingMemUsage.setValue(session->checkingMemUsage()); spinBoxCheckingMemUsage.setValue(session->checkingMemUsage());
spinBoxCheckingMemUsage.setSuffix(tr(" MiB")); 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 // Disk write cache
spinBoxCache.setMinimum(-1); spinBoxCache.setMinimum(-1);
@ -343,41 +353,50 @@ void AdvancedSettings::loadAdvancedSettings()
#endif #endif
spinBoxCache.setValue(session->diskCacheSize()); spinBoxCache.setValue(session->diskCacheSize());
updateCacheSpinSuffix(spinBoxCache.value()); 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 // Disk cache expiry
spinBoxCacheTTL.setMinimum(15); spinBoxCacheTTL.setMinimum(15);
spinBoxCacheTTL.setMaximum(600); spinBoxCacheTTL.setMaximum(600);
spinBoxCacheTTL.setValue(session->diskCacheTTL()); spinBoxCacheTTL.setValue(session->diskCacheTTL());
spinBoxCacheTTL.setSuffix(tr(" s", " seconds")); 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 // Enable OS cache
checkBoxOsCache.setChecked(session->useOSCache()); 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 // Guided read cache
checkBoxGuidedReadCache.setChecked(session->isGuidedReadCacheEnabled()); 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 // Coalesce reads & writes
checkBoxCoalesceRW.setChecked(session->isCoalesceReadWriteEnabled()); 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 // Suggest mode
checkBoxSuggestMode.setChecked(session->isSuggestModeEnabled()); 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 // Send buffer watermark
spinBoxSendBufferWatermark.setMinimum(1); spinBoxSendBufferWatermark.setMinimum(1);
spinBoxSendBufferWatermark.setMaximum(INT_MAX); spinBoxSendBufferWatermark.setMaximum(INT_MAX);
spinBoxSendBufferWatermark.setSuffix(tr(" KiB")); spinBoxSendBufferWatermark.setSuffix(tr(" KiB"));
spinBoxSendBufferWatermark.setValue(session->sendBufferWatermark()); 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.setMinimum(1);
spinBoxSendBufferLowWatermark.setMaximum(INT_MAX); spinBoxSendBufferLowWatermark.setMaximum(INT_MAX);
spinBoxSendBufferLowWatermark.setSuffix(tr(" KiB")); spinBoxSendBufferLowWatermark.setSuffix(tr(" KiB"));
spinBoxSendBufferLowWatermark.setValue(session->sendBufferLowWatermark()); 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.setMinimum(1);
spinBoxSendBufferWatermarkFactor.setMaximum(INT_MAX); spinBoxSendBufferWatermarkFactor.setMaximum(INT_MAX);
spinBoxSendBufferWatermarkFactor.setSuffix(" %"); spinBoxSendBufferWatermarkFactor.setSuffix(" %");
spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor()); 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 // Save resume data interval
spinBoxSaveResumeDataInterval.setMinimum(0); spinBoxSaveResumeDataInterval.setMinimum(0);
spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits<int>::max()); spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits<int>::max());
@ -397,7 +416,9 @@ void AdvancedSettings::loadAdvancedSettings()
// uTP-TCP mixed mode // uTP-TCP mixed mode
comboBoxUtpMixedMode.addItems({tr("Prefer TCP"), tr("Peer proportional (throttles TCP)")}); comboBoxUtpMixedMode.addItems({tr("Prefer TCP"), tr("Peer proportional (throttles TCP)")});
comboBoxUtpMixedMode.setCurrentIndex(static_cast<int>(session->utpMixedMode())); 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), &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 // multiple connections per IP
checkBoxMultiConnectionsPerIp.setChecked(session->multiConnectionsPerIpEnabled()); checkBoxMultiConnectionsPerIp.setChecked(session->multiConnectionsPerIpEnabled());
addRow(MULTI_CONNECTIONS_PER_IP, tr("Allow multiple connections from the same IP address"), &checkBoxMultiConnectionsPerIp); 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); addRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Unlimited]"), &spinBoxMaxHalfOpen);
// Super seeding // Super seeding
checkBoxSuperSeeding.setChecked(session->isSuperSeedingEnabled()); 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 // Network interface
comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface")); comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface"));
const QString currentInterface = session->networkInterface(); const QString currentInterface = session->networkInterface();
@ -487,11 +509,13 @@ void AdvancedSettings::loadAdvancedSettings()
// Choking algorithm // Choking algorithm
comboBoxChokingAlgorithm.addItems({tr("Fixed slots"), tr("Upload rate based")}); comboBoxChokingAlgorithm.addItems({tr("Fixed slots"), tr("Upload rate based")});
comboBoxChokingAlgorithm.setCurrentIndex(static_cast<int>(session->chokingAlgorithm())); comboBoxChokingAlgorithm.setCurrentIndex(static_cast<int>(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 // Seed choking algorithm
comboBoxSeedChokingAlgorithm.addItems({tr("Round-robin"), tr("Fastest upload"), tr("Anti-leech")}); comboBoxSeedChokingAlgorithm.addItems({tr("Round-robin"), tr("Fastest upload"), tr("Anti-leech")});
comboBoxSeedChokingAlgorithm.setCurrentIndex(static_cast<int>(session->seedChokingAlgorithm())); comboBoxSeedChokingAlgorithm.setCurrentIndex(static_cast<int>(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) #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
checkBoxUpdateCheck.setChecked(pref->isUpdateCheckEnabled()); checkBoxUpdateCheck.setChecked(pref->isUpdateCheckEnabled());

Loading…
Cancel
Save