mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Disable deprecated libtorrent settings
This commit is contained in:
parent
c967bf31ff
commit
554eab50bb
@ -1257,18 +1257,21 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
|
|||||||
const int checkingMemUsageSize = checkingMemUsage() * 64;
|
const int checkingMemUsageSize = checkingMemUsage() * 64;
|
||||||
settingsPack.set_int(lt::settings_pack::checking_mem_usage, checkingMemUsageSize);
|
settingsPack.set_int(lt::settings_pack::checking_mem_usage, checkingMemUsageSize);
|
||||||
|
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
const int cacheSize = (diskCacheSize() > -1) ? (diskCacheSize() * 64) : -1;
|
const int cacheSize = (diskCacheSize() > -1) ? (diskCacheSize() * 64) : -1;
|
||||||
settingsPack.set_int(lt::settings_pack::cache_size, cacheSize);
|
settingsPack.set_int(lt::settings_pack::cache_size, cacheSize);
|
||||||
settingsPack.set_int(lt::settings_pack::cache_expiry, diskCacheTTL());
|
settingsPack.set_int(lt::settings_pack::cache_expiry, diskCacheTTL());
|
||||||
qDebug() << "Using a disk cache size of" << cacheSize << "MiB";
|
#endif
|
||||||
|
|
||||||
lt::settings_pack::io_buffer_mode_t mode = useOSCache() ? lt::settings_pack::enable_os_cache
|
lt::settings_pack::io_buffer_mode_t mode = useOSCache() ? lt::settings_pack::enable_os_cache
|
||||||
: lt::settings_pack::disable_os_cache;
|
: lt::settings_pack::disable_os_cache;
|
||||||
settingsPack.set_int(lt::settings_pack::disk_io_read_mode, mode);
|
settingsPack.set_int(lt::settings_pack::disk_io_read_mode, mode);
|
||||||
settingsPack.set_int(lt::settings_pack::disk_io_write_mode, mode);
|
settingsPack.set_int(lt::settings_pack::disk_io_write_mode, mode);
|
||||||
|
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
settingsPack.set_bool(lt::settings_pack::coalesce_reads, isCoalesceReadWriteEnabled());
|
settingsPack.set_bool(lt::settings_pack::coalesce_reads, isCoalesceReadWriteEnabled());
|
||||||
settingsPack.set_bool(lt::settings_pack::coalesce_writes, isCoalesceReadWriteEnabled());
|
settingsPack.set_bool(lt::settings_pack::coalesce_writes, isCoalesceReadWriteEnabled());
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
||||||
settingsPack.set_bool(lt::settings_pack::piece_extent_affinity, usePieceExtentAffinity());
|
settingsPack.set_bool(lt::settings_pack::piece_extent_affinity, usePieceExtentAffinity());
|
||||||
|
@ -87,11 +87,15 @@ enum AdvSettingsRows
|
|||||||
ASYNC_IO_THREADS,
|
ASYNC_IO_THREADS,
|
||||||
FILE_POOL_SIZE,
|
FILE_POOL_SIZE,
|
||||||
CHECKING_MEM_USAGE,
|
CHECKING_MEM_USAGE,
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
// cache
|
// cache
|
||||||
DISK_CACHE,
|
DISK_CACHE,
|
||||||
DISK_CACHE_TTL,
|
DISK_CACHE_TTL,
|
||||||
|
#endif
|
||||||
OS_CACHE,
|
OS_CACHE,
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
COALESCE_RW,
|
COALESCE_RW,
|
||||||
|
#endif
|
||||||
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
||||||
PIECE_EXTENT_AFFINITY,
|
PIECE_EXTENT_AFFINITY,
|
||||||
#endif
|
#endif
|
||||||
@ -147,8 +151,6 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
|
|||||||
setSelectionMode(QAbstractItemView::NoSelection);
|
setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
// Signals
|
// Signals
|
||||||
connect(&m_spinBoxCache, qOverload<int>(&QSpinBox::valueChanged)
|
|
||||||
, this, &AdvancedSettings::updateCacheSpinSuffix);
|
|
||||||
connect(&m_comboBoxInterface, qOverload<int>(&QComboBox::currentIndexChanged)
|
connect(&m_comboBoxInterface, qOverload<int>(&QComboBox::currentIndexChanged)
|
||||||
, this, &AdvancedSettings::updateInterfaceAddressCombo);
|
, this, &AdvancedSettings::updateInterfaceAddressCombo);
|
||||||
connect(&m_spinBoxSaveResumeDataInterval, qOverload<int>(&QSpinBox::valueChanged)
|
connect(&m_spinBoxSaveResumeDataInterval, qOverload<int>(&QSpinBox::valueChanged)
|
||||||
@ -192,13 +194,17 @@ void AdvancedSettings::saveAdvancedSettings()
|
|||||||
session->setFilePoolSize(m_spinBoxFilePoolSize.value());
|
session->setFilePoolSize(m_spinBoxFilePoolSize.value());
|
||||||
// Checking Memory Usage
|
// Checking Memory Usage
|
||||||
session->setCheckingMemUsage(m_spinBoxCheckingMemUsage.value());
|
session->setCheckingMemUsage(m_spinBoxCheckingMemUsage.value());
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
// Disk write cache
|
// Disk write cache
|
||||||
session->setDiskCacheSize(m_spinBoxCache.value());
|
session->setDiskCacheSize(m_spinBoxCache.value());
|
||||||
session->setDiskCacheTTL(m_spinBoxCacheTTL.value());
|
session->setDiskCacheTTL(m_spinBoxCacheTTL.value());
|
||||||
|
#endif
|
||||||
// Enable OS cache
|
// Enable OS cache
|
||||||
session->setUseOSCache(m_checkBoxOsCache.isChecked());
|
session->setUseOSCache(m_checkBoxOsCache.isChecked());
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
// Coalesce reads & writes
|
// Coalesce reads & writes
|
||||||
session->setCoalesceReadWriteEnabled(m_checkBoxCoalesceRW.isChecked());
|
session->setCoalesceReadWriteEnabled(m_checkBoxCoalesceRW.isChecked());
|
||||||
|
#endif
|
||||||
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
||||||
// Piece extent affinity
|
// Piece extent affinity
|
||||||
session->setPieceExtentAffinity(m_checkBoxPieceExtentAffinity.isChecked());
|
session->setPieceExtentAffinity(m_checkBoxPieceExtentAffinity.isChecked());
|
||||||
@ -290,6 +296,7 @@ void AdvancedSettings::saveAdvancedSettings()
|
|||||||
session->setPeerTurnoverInterval(m_spinBoxPeerTurnoverInterval.value());
|
session->setPeerTurnoverInterval(m_spinBoxPeerTurnoverInterval.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
void AdvancedSettings::updateCacheSpinSuffix(int value)
|
void AdvancedSettings::updateCacheSpinSuffix(int value)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
@ -299,6 +306,7 @@ void AdvancedSettings::updateCacheSpinSuffix(int value)
|
|||||||
else
|
else
|
||||||
m_spinBoxCache.setSuffix(tr(" MiB"));
|
m_spinBoxCache.setSuffix(tr(" MiB"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AdvancedSettings::updateSaveResumeDataIntervalSuffix(const int value)
|
void AdvancedSettings::updateSaveResumeDataIntervalSuffix(const int value)
|
||||||
{
|
{
|
||||||
@ -422,7 +430,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
m_spinBoxCheckingMemUsage.setSuffix(tr(" MiB"));
|
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", "(?)"))
|
addRow(CHECKING_MEM_USAGE, (tr("Outstanding memory when checking torrents") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#checking_mem_usage", "(?)"))
|
||||||
, &m_spinBoxCheckingMemUsage);
|
, &m_spinBoxCheckingMemUsage);
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
// Disk write cache
|
// Disk write cache
|
||||||
m_spinBoxCache.setMinimum(-1);
|
m_spinBoxCache.setMinimum(-1);
|
||||||
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
|
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
|
||||||
@ -434,6 +442,8 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
#endif
|
#endif
|
||||||
m_spinBoxCache.setValue(session->diskCacheSize());
|
m_spinBoxCache.setValue(session->diskCacheSize());
|
||||||
updateCacheSpinSuffix(m_spinBoxCache.value());
|
updateCacheSpinSuffix(m_spinBoxCache.value());
|
||||||
|
connect(&m_spinBoxCache, qOverload<int>(&QSpinBox::valueChanged)
|
||||||
|
, this, &AdvancedSettings::updateCacheSpinSuffix);
|
||||||
addRow(DISK_CACHE, (tr("Disk cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_size", "(?)"))
|
addRow(DISK_CACHE, (tr("Disk cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_size", "(?)"))
|
||||||
, &m_spinBoxCache);
|
, &m_spinBoxCache);
|
||||||
// Disk cache expiry
|
// Disk cache expiry
|
||||||
@ -443,14 +453,17 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
m_spinBoxCacheTTL.setSuffix(tr(" s", " seconds"));
|
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", "(?)"))
|
addRow(DISK_CACHE_TTL, (tr("Disk cache expiry interval") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_expiry", "(?)"))
|
||||||
, &m_spinBoxCacheTTL);
|
, &m_spinBoxCacheTTL);
|
||||||
|
#endif
|
||||||
// Enable OS cache
|
// Enable OS cache
|
||||||
m_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", "(?)"))
|
addRow(OS_CACHE, (tr("Enable OS cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#disk_io_write_mode", "(?)"))
|
||||||
, &m_checkBoxOsCache);
|
, &m_checkBoxOsCache);
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
// Coalesce reads & writes
|
// Coalesce reads & writes
|
||||||
m_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", "(?)"))
|
addRow(COALESCE_RW, (tr("Coalesce reads & writes") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#coalesce_reads", "(?)"))
|
||||||
, &m_checkBoxCoalesceRW);
|
, &m_checkBoxCoalesceRW);
|
||||||
|
#endif
|
||||||
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
||||||
// Piece extent affinity
|
// Piece extent affinity
|
||||||
m_checkBoxPieceExtentAffinity.setChecked(session->usePieceExtentAffinity());
|
m_checkBoxPieceExtentAffinity.setChecked(session->usePieceExtentAffinity());
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#ifndef ADVANCEDSETTINGS_H
|
#ifndef ADVANCEDSETTINGS_H
|
||||||
#define ADVANCEDSETTINGS_H
|
#define ADVANCEDSETTINGS_H
|
||||||
|
|
||||||
|
#include <libtorrent/version.hpp>
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@ -49,7 +51,9 @@ signals:
|
|||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
void updateCacheSpinSuffix(int value);
|
void updateCacheSpinSuffix(int value);
|
||||||
|
#endif
|
||||||
void updateSaveResumeDataIntervalSuffix(int value);
|
void updateSaveResumeDataIntervalSuffix(int value);
|
||||||
void updateInterfaceAddressCombo();
|
void updateInterfaceAddressCombo();
|
||||||
|
|
||||||
@ -57,18 +61,23 @@ private:
|
|||||||
void loadAdvancedSettings();
|
void loadAdvancedSettings();
|
||||||
template <typename T> void addRow(int row, const QString &text, T *widget);
|
template <typename T> void addRow(int row, const QString &text, T *widget);
|
||||||
|
|
||||||
QSpinBox m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxCache,
|
QSpinBox m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage,
|
||||||
m_spinBoxSaveResumeDataInterval, m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration,
|
m_spinBoxSaveResumeDataInterval, m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration,
|
||||||
m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxCacheTTL, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
|
m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
|
||||||
m_spinBoxSendBufferWatermarkFactor, m_spinBoxSocketBacklogSize, m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout,
|
m_spinBoxSendBufferWatermarkFactor, m_spinBoxSocketBacklogSize, m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout,
|
||||||
m_spinBoxSavePathHistoryLength, m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval;
|
m_spinBoxSavePathHistoryLength, m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval;
|
||||||
QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts,
|
QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts,
|
||||||
m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
|
m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
|
||||||
m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers, m_checkBoxAnnounceAllTiers,
|
m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers, m_checkBoxAnnounceAllTiers,
|
||||||
m_checkBoxMultiConnectionsPerIp, m_checkBoxValidateHTTPSTrackerCertificate, m_checkBoxPieceExtentAffinity, m_checkBoxSuggestMode, m_checkBoxCoalesceRW, m_checkBoxSpeedWidgetEnabled;
|
m_checkBoxMultiConnectionsPerIp, m_checkBoxValidateHTTPSTrackerCertificate, m_checkBoxPieceExtentAffinity, m_checkBoxSuggestMode, m_checkBoxSpeedWidgetEnabled;
|
||||||
QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm, m_comboBoxSeedChokingAlgorithm;
|
QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm, m_comboBoxSeedChokingAlgorithm;
|
||||||
QLineEdit m_lineEditAnnounceIP;
|
QLineEdit m_lineEditAnnounceIP;
|
||||||
|
|
||||||
|
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||||
|
QSpinBox m_spinBoxCache, m_spinBoxCacheTTL;
|
||||||
|
QCheckBox m_checkBoxCoalesceRW;
|
||||||
|
#endif
|
||||||
|
|
||||||
// OS dependent settings
|
// OS dependent settings
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
QComboBox m_comboBoxOSMemoryPriority;
|
QComboBox m_comboBoxOSMemoryPriority;
|
||||||
|
@ -961,7 +961,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="diskCache">QBT_TR(Disk cache:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#cache_size" target="_blank">(?)</a></label>
|
<label for="diskCache">QBT_TR(Disk cache (requires libtorrent < 2.0):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#cache_size" target="_blank">(?)</a></label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="diskCache" style="width: 15em;" /> QBT_TR(MiB)QBT_TR[CONTEXT=OptionsDialog]
|
<input type="text" id="diskCache" style="width: 15em;" /> QBT_TR(MiB)QBT_TR[CONTEXT=OptionsDialog]
|
||||||
@ -969,7 +969,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="diskCacheExpiryInterval">QBT_TR(Disk cache expiry interval:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#cache_expiry" target="_blank">(?)</a></label>
|
<label for="diskCacheExpiryInterval">QBT_TR(Disk cache expiry interval (requires libtorrent < 2.0):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#cache_expiry" target="_blank">(?)</a></label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="diskCacheExpiryInterval" style="width: 15em;"> QBT_TR(s)QBT_TR[CONTEXT=OptionsDialog]
|
<input type="text" id="diskCacheExpiryInterval" style="width: 15em;"> QBT_TR(s)QBT_TR[CONTEXT=OptionsDialog]
|
||||||
@ -985,7 +985,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="coalesceReadsAndWrites">QBT_TR(Coalesce reads & writes:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#coalesce_reads" target="_blank">(?)</a></label>
|
<label for="coalesceReadsAndWrites">QBT_TR(Coalesce reads & writes (requires libtorrent < 2.0):)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#coalesce_reads" target="_blank">(?)</a></label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="coalesceReadsAndWrites" />
|
<input type="checkbox" id="coalesceReadsAndWrites" />
|
||||||
|
Loading…
Reference in New Issue
Block a user