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());