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