@ -125,9 +125,9 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
@@ -125,9 +125,9 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
setSelectionMode ( QAbstractItemView : : NoSelection ) ;
setEditTriggers ( QAbstractItemView : : NoEditTriggers ) ;
// Signals
connect ( & spin_c ache , static_cast < void ( QSpinBox : : * ) ( int ) > ( & QSpinBox : : valueChanged )
connect ( & spinBoxC ache , static_cast < void ( QSpinBox : : * ) ( int ) > ( & QSpinBox : : valueChanged )
, this , & AdvancedSettings : : updateCacheSpinSuffix ) ;
connect ( & combo_i face , static_cast < void ( QComboBox : : * ) ( int ) > ( & QComboBox : : currentIndexChanged )
connect ( & comboBoxInter face , static_cast < void ( QComboBox : : * ) ( int ) > ( & QComboBox : : currentIndexChanged )
, this , & AdvancedSettings : : updateInterfaceAddressCombo ) ;
// Load settings
loadAdvancedSettings ( ) ;
@ -141,116 +141,116 @@ void AdvancedSettings::saveAdvancedSettings()
@@ -141,116 +141,116 @@ void AdvancedSettings::saveAdvancedSettings()
BitTorrent : : Session * const session = BitTorrent : : Session : : instance ( ) ;
// Disk write cache
session - > setDiskCacheSize ( spin_c ache . value ( ) ) ;
session - > setDiskCacheTTL ( spin_cache_ttl . value ( ) ) ;
session - > setDiskCacheSize ( spinBoxC ache . value ( ) ) ;
session - > setDiskCacheTTL ( spinBoxCacheTTL . value ( ) ) ;
// Enable OS cache
session - > setUseOSCache ( cb_os_c ache . isChecked ( ) ) ;
session - > setUseOSCache ( checkBoxOsC ache . isChecked ( ) ) ;
// Guided read cache
session - > setGuidedReadCacheEnabled ( cb GuidedReadCache . isChecked ( ) ) ;
session - > setGuidedReadCacheEnabled ( checkBox GuidedReadCache . isChecked ( ) ) ;
// Coalesce reads & writes
session - > setCoalesceReadWriteEnabled ( cb CoalesceRW . isChecked ( ) ) ;
session - > setCoalesceReadWriteEnabled ( checkBox CoalesceRW . isChecked ( ) ) ;
// Suggest mode
session - > setSuggestMode ( cb SuggestMode . isChecked ( ) ) ;
session - > setSuggestMode ( checkBox SuggestMode . isChecked ( ) ) ;
// Send buffer watermark
session - > setSendBufferWatermark ( spinSendBufferWatermark . value ( ) ) ;
session - > setSendBufferLowWatermark ( spinSendBufferLowWatermark . value ( ) ) ;
session - > setSendBufferWatermarkFactor ( spinSendBufferWatermarkFactor . value ( ) ) ;
session - > setSendBufferWatermark ( spinBox SendBufferWatermark . value ( ) ) ;
session - > setSendBufferLowWatermark ( spinBox SendBufferLowWatermark . value ( ) ) ;
session - > setSendBufferWatermarkFactor ( spinBox SendBufferWatermarkFactor . value ( ) ) ;
// Save resume data interval
session - > setSaveResumeDataInterval ( spin_save_resume_data_i nterval . value ( ) ) ;
session - > setSaveResumeDataInterval ( spinBoxSaveResumeDataI nterval . value ( ) ) ;
// Outgoing ports
session - > setOutgoingPortsMin ( outgoing_ports_m in. value ( ) ) ;
session - > setOutgoingPortsMax ( outgoing_ports_m ax. value ( ) ) ;
session - > setOutgoingPortsMin ( spinBoxOutgoingPortsM in. value ( ) ) ;
session - > setOutgoingPortsMax ( spinBoxOutgoingPortsM ax. value ( ) ) ;
// uTP-TCP mixed mode
session - > setUtpMixedMode ( static_cast < BitTorrent : : MixedModeAlgorithm > ( comboUtpMixedMode . currentIndex ( ) ) ) ;
session - > setUtpMixedMode ( static_cast < BitTorrent : : MixedModeAlgorithm > ( comboBox UtpMixedMode . currentIndex ( ) ) ) ;
// multiple connections per IP
session - > setMultiConnectionsPerIpEnabled ( cb MultiConnectionsPerIp . isChecked ( ) ) ;
session - > setMultiConnectionsPerIpEnabled ( checkBox MultiConnectionsPerIp . isChecked ( ) ) ;
// Recheck torrents on completion
pref - > recheckTorrentsOnCompletion ( cb_recheck_c ompleted . isChecked ( ) ) ;
pref - > recheckTorrentsOnCompletion ( checkBoxRecheckC ompleted . isChecked ( ) ) ;
// Transfer list refresh interval
session - > setRefreshInterval ( spin_list_r efresh . value ( ) ) ;
session - > setRefreshInterval ( spinBoxListR efresh . value ( ) ) ;
// Peer resolution
pref - > resolvePeerCountries ( cb_resolve_c ountries . isChecked ( ) ) ;
pref - > resolvePeerHostNames ( cb_resolve_h osts . isChecked ( ) ) ;
pref - > resolvePeerCountries ( checkBoxResolveC ountries . isChecked ( ) ) ;
pref - > resolvePeerHostNames ( checkBoxResolveH osts . isChecked ( ) ) ;
// Max Half-Open connections
session - > setMaxHalfOpenConnections ( spin_maxhalfo pen . value ( ) ) ;
session - > setMaxHalfOpenConnections ( spinBoxMaxHalfO pen . value ( ) ) ;
// Super seeding
session - > setSuperSeedingEnabled ( cb_super_s eeding . isChecked ( ) ) ;
session - > setSuperSeedingEnabled ( checkBoxSuperS eeding . isChecked ( ) ) ;
// Network interface
if ( combo_i face . currentIndex ( ) = = 0 ) {
if ( comboBoxInter face . currentIndex ( ) = = 0 ) {
// All interfaces (default)
session - > setNetworkInterface ( QString ( ) ) ;
session - > setNetworkInterfaceName ( QString ( ) ) ;
}
else {
session - > setNetworkInterface ( combo_i face . itemData ( combo_i face . currentIndex ( ) ) . toString ( ) ) ;
session - > setNetworkInterfaceName ( combo_i face . currentText ( ) ) ;
session - > setNetworkInterface ( comboBoxInter face . itemData ( comboBoxInter face . currentIndex ( ) ) . toString ( ) ) ;
session - > setNetworkInterfaceName ( comboBoxInter face . currentText ( ) ) ;
}
// Interface address
if ( combo_iface_a ddress . currentIndex ( ) = = 0 ) {
if ( comboBoxInterfaceA ddress . currentIndex ( ) = = 0 ) {
// All addresses (default)
session - > setNetworkInterfaceAddress ( QString : : null ) ;
}
else {
QHostAddress ifaceAddr ( combo_iface_a ddress . currentText ( ) . trimmed ( ) ) ;
QHostAddress ifaceAddr ( comboBoxInterfaceA ddress . currentText ( ) . trimmed ( ) ) ;
ifaceAddr . isNull ( ) ? session - > setNetworkInterfaceAddress ( QString : : null ) : session - > setNetworkInterfaceAddress ( ifaceAddr . toString ( ) ) ;
}
session - > setIPv6Enabled ( cb_listen_ip v6 . isChecked ( ) ) ;
session - > setIPv6Enabled ( checkBoxListenIP v6 . isChecked ( ) ) ;
// Announce IP
QHostAddress addr ( tx tAnnounceIP. text ( ) . trimmed ( ) ) ;
QHostAddress addr ( lineEdi tAnnounceIP. text ( ) . trimmed ( ) ) ;
session - > setAnnounceIP ( addr . isNull ( ) ? " " : addr . toString ( ) ) ;
// Program notification
MainWindow * const mainWindow = static_cast < Application * > ( QCoreApplication : : instance ( ) ) - > mainWindow ( ) ;
mainWindow - > setNotificationsEnabled ( cb_program_n otifications . isChecked ( ) ) ;
mainWindow - > setTorrentAddedNotificationsEnabled ( cb_torrent_added_n otifications . isChecked ( ) ) ;
mainWindow - > setNotificationsEnabled ( checkBoxProgramN otifications . isChecked ( ) ) ;
mainWindow - > setTorrentAddedNotificationsEnabled ( checkBoxTorrentAddedN otifications . isChecked ( ) ) ;
// Misc GUI properties
mainWindow - > setDownloadTrackerFavicon ( cb_tracker_f avicon . isChecked ( ) ) ;
AddNewTorrentDialog : : setSavePathHistoryLength ( spinSavePathHistoryLength . value ( ) ) ;
mainWindow - > setDownloadTrackerFavicon ( checkBoxTrackerF avicon . isChecked ( ) ) ;
AddNewTorrentDialog : : setSavePathHistoryLength ( spinBox SavePathHistoryLength . value ( ) ) ;
// Tracker
session - > setTrackerEnabled ( cb_tracker_s tatus . isChecked ( ) ) ;
pref - > setTrackerPort ( spin_tracker_p ort . value ( ) ) ;
session - > setTrackerEnabled ( checkBoxTrackerS tatus . isChecked ( ) ) ;
pref - > setTrackerPort ( spinBoxTrackerP ort . value ( ) ) ;
// Choking algorithm
session - > setChokingAlgorithm ( static_cast < BitTorrent : : ChokingAlgorithm > ( comboChokingAlgorithm . currentIndex ( ) ) ) ;
session - > setChokingAlgorithm ( static_cast < BitTorrent : : ChokingAlgorithm > ( comboBox ChokingAlgorithm . currentIndex ( ) ) ) ;
// Seed choking algorithm
session - > setSeedChokingAlgorithm ( static_cast < BitTorrent : : SeedChokingAlgorithm > ( comboSeedChokingAlgorithm . currentIndex ( ) ) ) ;
session - > setSeedChokingAlgorithm ( static_cast < BitTorrent : : SeedChokingAlgorithm > ( comboBox SeedChokingAlgorithm . currentIndex ( ) ) ) ;
# if defined(Q_OS_WIN) || defined(Q_OS_MAC)
pref - > setUpdateCheckEnabled ( cb_update_c heck . isChecked ( ) ) ;
pref - > setUpdateCheckEnabled ( checkBoxUpdateC heck . isChecked ( ) ) ;
# endif
// Icon theme
# if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
pref - > useSystemIconTheme ( cb_use_icon_t heme . isChecked ( ) ) ;
pref - > useSystemIconTheme ( checkBoxUseIconT heme . isChecked ( ) ) ;
# endif
pref - > setConfirmTorrentRecheck ( cb_confirm_torrent_r echeck . isChecked ( ) ) ;
pref - > setConfirmTorrentRecheck ( checkBoxConfirmTorrentR echeck . isChecked ( ) ) ;
pref - > setConfirmRemoveAllTags ( cb_confirm_remove_all_t ags . isChecked ( ) ) ;
pref - > setConfirmRemoveAllTags ( checkBoxConfirmRemoveAllT ags . isChecked ( ) ) ;
session - > setAnnounceToAllTrackers ( cb_announce_all_t rackers . isChecked ( ) ) ;
session - > setAnnounceToAllTiers ( cb_announce_all_t iers . isChecked ( ) ) ;
session - > setAnnounceToAllTrackers ( checkBoxAnnounceAllT rackers . isChecked ( ) ) ;
session - > setAnnounceToAllTiers ( checkBoxAnnounceAllT iers . isChecked ( ) ) ;
}
void AdvancedSettings : : updateCacheSpinSuffix ( int value )
{
if ( value = = 0 )
spin_c ache . setSuffix ( tr ( " (disabled) " ) ) ;
spinBoxC ache . setSuffix ( tr ( " (disabled) " ) ) ;
else if ( value < 0 )
spin_c ache . setSuffix ( tr ( " (auto) " ) ) ;
spinBoxC ache . setSuffix ( tr ( " (auto) " ) ) ;
else
spin_c ache . setSuffix ( tr ( " MiB " ) ) ;
spinBoxC ache . setSuffix ( tr ( " MiB " ) ) ;
}
void AdvancedSettings : : updateInterfaceAddressCombo ( )
{
// Try to get the currently selected interface name
const QString ifaceName = combo_i face . itemData ( combo_i face . currentIndex ( ) ) . toString ( ) ; // Empty string for the first element
const QString ifaceName = comboBoxInter face . itemData ( comboBoxInter face . currentIndex ( ) ) . toString ( ) ; // Empty string for the first element
const QString currentAddress = BitTorrent : : Session : : instance ( ) - > networkInterfaceAddress ( ) ;
// Clear all items and reinsert them, default to all
combo_iface_a ddress . clear ( ) ;
combo_iface_a ddress . addItem ( tr ( " All addresses " ) ) ;
combo_iface_a ddress . setCurrentIndex ( 0 ) ;
comboBoxInterfaceA ddress . clear ( ) ;
comboBoxInterfaceA ddress . addItem ( tr ( " All addresses " ) ) ;
comboBoxInterfaceA ddress . setCurrentIndex ( 0 ) ;
auto populateCombo = [ this , & currentAddress ] ( const QString & ip , const QAbstractSocket : : NetworkLayerProtocol & protocol )
{
@ -258,10 +258,10 @@ void AdvancedSettings::updateInterfaceAddressCombo()
@@ -258,10 +258,10 @@ void AdvancedSettings::updateInterfaceAddressCombo()
// Only take ipv4 for now?
if ( ( protocol ! = QAbstractSocket : : IPv4Protocol ) & & ( protocol ! = QAbstractSocket : : IPv6Protocol ) )
return ;
combo_iface_a ddress . addItem ( ip ) ;
comboBoxInterfaceA ddress . addItem ( ip ) ;
//Try to select the last added one
if ( ip = = currentAddress )
combo_iface_a ddress . setCurrentIndex ( combo_iface_a ddress . count ( ) - 1 ) ;
comboBoxInterfaceA ddress . setCurrentIndex ( comboBoxInterfaceA ddress . count ( ) - 1 ) ;
} ;
if ( ifaceName . isEmpty ( ) ) {
@ -297,104 +297,104 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -297,104 +297,104 @@ void AdvancedSettings::loadAdvancedSettings()
labelLibtorrentLink . setText ( QString ( " <a href= \" %1 \" >%2</a> " ) . arg ( " https://www.libtorrent.org/reference.html " , tr ( " Open documentation " ) ) ) ;
labelLibtorrentLink . setOpenExternalLinks ( true ) ;
// Disk write cache
spin_c ache . setMinimum ( - 1 ) ;
spinBoxC ache . setMinimum ( - 1 ) ;
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
// These macros may not be available on compilers other than MSVC and GCC
# if defined(__x86_64__) || defined(_M_X64)
spin_c ache . setMaximum ( 4096 ) ;
spinBoxC ache . setMaximum ( 4096 ) ;
# else
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
spin_c ache . setMaximum ( 1536 ) ;
spinBoxC ache . setMaximum ( 1536 ) ;
# endif
spin_c ache . setValue ( session - > diskCacheSize ( ) ) ;
updateCacheSpinSuffix ( spin_c ache . value ( ) ) ;
addRow ( DISK_CACHE , tr ( " Disk cache " ) , & spin_c ache ) ;
spinBoxC ache . setValue ( session - > diskCacheSize ( ) ) ;
updateCacheSpinSuffix ( spinBoxC ache . value ( ) ) ;
addRow ( DISK_CACHE , tr ( " Disk cache " ) , & spinBoxC ache ) ;
// Disk cache expiry
spin_cache_ttl . setMinimum ( 15 ) ;
spin_cache_ttl . setMaximum ( 600 ) ;
spin_cache_ttl . setValue ( session - > diskCacheTTL ( ) ) ;
spin_cache_ttl . setSuffix ( tr ( " s " , " seconds " ) ) ;
addRow ( DISK_CACHE_TTL , tr ( " Disk cache expiry interval " ) , & spin_cache_ttl ) ;
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 ) ;
// Enable OS cache
cb_os_c ache . setChecked ( session - > useOSCache ( ) ) ;
addRow ( OS_CACHE , tr ( " Enable OS cache " ) , & cb_os_c ache ) ;
checkBoxOsC ache . setChecked ( session - > useOSCache ( ) ) ;
addRow ( OS_CACHE , tr ( " Enable OS cache " ) , & checkBoxOsC ache ) ;
// Guided read cache
cb GuidedReadCache . setChecked ( session - > isGuidedReadCacheEnabled ( ) ) ;
addRow ( GUIDED_READ_CACHE , tr ( " Guided read cache " ) , & cb GuidedReadCache ) ;
checkBox GuidedReadCache . setChecked ( session - > isGuidedReadCacheEnabled ( ) ) ;
addRow ( GUIDED_READ_CACHE , tr ( " Guided read cache " ) , & checkBox GuidedReadCache ) ;
// Coalesce reads & writes
cb CoalesceRW . setChecked ( session - > isCoalesceReadWriteEnabled ( ) ) ;
checkBox CoalesceRW . setChecked ( session - > isCoalesceReadWriteEnabled ( ) ) ;
# if LIBTORRENT_VERSION_NUM >= 10107
addRow ( COALESCE_RW , tr ( " Coalesce reads & writes " ) , & cb CoalesceRW ) ;
addRow ( COALESCE_RW , tr ( " Coalesce reads & writes " ) , & checkBox CoalesceRW ) ;
# endif
// Suggest mode
cb SuggestMode . setChecked ( session - > isSuggestModeEnabled ( ) ) ;
addRow ( SUGGEST_MODE , tr ( " Send upload piece suggestions " ) , & cb SuggestMode ) ;
checkBox SuggestMode . setChecked ( session - > isSuggestModeEnabled ( ) ) ;
addRow ( SUGGEST_MODE , tr ( " Send upload piece suggestions " ) , & checkBox SuggestMode ) ;
// Send buffer watermark
spinSendBufferWatermark . setMinimum ( 1 ) ;
spinSendBufferWatermark . setMaximum ( INT_MAX ) ;
spinSendBufferWatermark . setSuffix ( tr ( " KiB " ) ) ;
spinSendBufferWatermark . setValue ( session - > sendBufferWatermark ( ) ) ;
addRow ( SEND_BUF_WATERMARK , tr ( " Send buffer watermark " ) , & spinSendBufferWatermark ) ;
spinSendBufferLowWatermark . setMinimum ( 1 ) ;
spinSendBufferLowWatermark . setMaximum ( INT_MAX ) ;
spinSendBufferLowWatermark . setSuffix ( tr ( " KiB " ) ) ;
spinSendBufferLowWatermark . setValue ( session - > sendBufferLowWatermark ( ) ) ;
addRow ( SEND_BUF_LOW_WATERMARK , tr ( " Send buffer low watermark " ) , & spinSendBufferLowWatermark ) ;
spinSendBufferWatermarkFactor . setMinimum ( 1 ) ;
spinSendBufferWatermarkFactor . setMaximum ( INT_MAX ) ;
spinSendBufferWatermarkFactor . setSuffix ( " % " ) ;
spinSendBufferWatermarkFactor . setValue ( session - > sendBufferWatermarkFactor ( ) ) ;
addRow ( SEND_BUF_WATERMARK_FACTOR , tr ( " Send buffer watermark factor " ) , & spinSendBufferWatermarkFactor ) ;
spinBox SendBufferWatermark . setMinimum ( 1 ) ;
spinBox SendBufferWatermark . setMaximum ( INT_MAX ) ;
spinBox SendBufferWatermark . setSuffix ( tr ( " KiB " ) ) ;
spinBox SendBufferWatermark . setValue ( session - > sendBufferWatermark ( ) ) ;
addRow ( SEND_BUF_WATERMARK , tr ( " Send buffer watermark " ) , & spinBox SendBufferWatermark ) ;
spinBox SendBufferLowWatermark . setMinimum ( 1 ) ;
spinBox SendBufferLowWatermark . setMaximum ( INT_MAX ) ;
spinBox SendBufferLowWatermark . setSuffix ( tr ( " KiB " ) ) ;
spinBox SendBufferLowWatermark . setValue ( session - > sendBufferLowWatermark ( ) ) ;
addRow ( SEND_BUF_LOW_WATERMARK , tr ( " Send buffer low watermark " ) , & spinBox SendBufferLowWatermark ) ;
spinBox SendBufferWatermarkFactor . setMinimum ( 1 ) ;
spinBox SendBufferWatermarkFactor . setMaximum ( INT_MAX ) ;
spinBox SendBufferWatermarkFactor . setSuffix ( " % " ) ;
spinBox SendBufferWatermarkFactor . setValue ( session - > sendBufferWatermarkFactor ( ) ) ;
addRow ( SEND_BUF_WATERMARK_FACTOR , tr ( " Send buffer watermark factor " ) , & spinBox SendBufferWatermarkFactor ) ;
// Save resume data interval
spin_save_resume_data_i nterval . setMinimum ( 1 ) ;
spin_save_resume_data_i nterval . setMaximum ( 1440 ) ;
spin_save_resume_data_i nterval . setValue ( session - > saveResumeDataInterval ( ) ) ;
spin_save_resume_data_i nterval . setSuffix ( tr ( " m " , " minutes " ) ) ;
addRow ( SAVE_RESUME_DATA_INTERVAL , tr ( " Save resume data interval " , " How often the fastresume file is saved. " ) , & spin_save_resume_data_i nterval ) ;
spinBoxSaveResumeDataI nterval . setMinimum ( 1 ) ;
spinBoxSaveResumeDataI nterval . setMaximum ( 1440 ) ;
spinBoxSaveResumeDataI nterval . setValue ( session - > saveResumeDataInterval ( ) ) ;
spinBoxSaveResumeDataI nterval . setSuffix ( tr ( " m " , " minutes " ) ) ;
addRow ( SAVE_RESUME_DATA_INTERVAL , tr ( " Save resume data interval " , " How often the fastresume file is saved. " ) , & spinBoxSaveResumeDataI nterval ) ;
// Outgoing port Min
outgoing_ports_m in. setMinimum ( 0 ) ;
outgoing_ports_m in. setMaximum ( 65535 ) ;
outgoing_ports_m in. setValue ( session - > outgoingPortsMin ( ) ) ;
addRow ( OUTGOING_PORT_MIN , tr ( " Outgoing ports (Min) [0: Disabled] " ) , & outgoing_ports_m in) ;
spinBoxOutgoingPortsM in. setMinimum ( 0 ) ;
spinBoxOutgoingPortsM in. setMaximum ( 65535 ) ;
spinBoxOutgoingPortsM in. setValue ( session - > outgoingPortsMin ( ) ) ;
addRow ( OUTGOING_PORT_MIN , tr ( " Outgoing ports (Min) [0: Disabled] " ) , & spinBoxOutgoingPortsM in) ;
// Outgoing port Min
outgoing_ports_m ax. setMinimum ( 0 ) ;
outgoing_ports_m ax. setMaximum ( 65535 ) ;
outgoing_ports_m ax. setValue ( session - > outgoingPortsMax ( ) ) ;
addRow ( OUTGOING_PORT_MAX , tr ( " Outgoing ports (Max) [0: Disabled] " ) , & outgoing_ports_m ax) ;
spinBoxOutgoingPortsM ax. setMinimum ( 0 ) ;
spinBoxOutgoingPortsM ax. setMaximum ( 65535 ) ;
spinBoxOutgoingPortsM ax. setValue ( session - > outgoingPortsMax ( ) ) ;
addRow ( OUTGOING_PORT_MAX , tr ( " Outgoing ports (Max) [0: Disabled] " ) , & spinBoxOutgoingPortsM ax) ;
// uTP-TCP mixed mode
comboUtpMixedMode . addItems ( { tr ( " Prefer TCP " ) , tr ( " Peer proportional (throttles TCP) " ) } ) ;
comboUtpMixedMode . setCurrentIndex ( static_cast < int > ( session - > utpMixedMode ( ) ) ) ;
addRow ( UTP_MIX_MODE , tr ( " %1-TCP mixed mode algorithm " , " uTP-TCP mixed mode algorithm " ) . arg ( C_UTP ) , & comboUtpMixedMode ) ;
comboBox UtpMixedMode . addItems ( { tr ( " Prefer TCP " ) , tr ( " Peer proportional (throttles TCP) " ) } ) ;
comboBox UtpMixedMode . setCurrentIndex ( static_cast < int > ( session - > utpMixedMode ( ) ) ) ;
addRow ( UTP_MIX_MODE , tr ( " %1-TCP mixed mode algorithm " , " uTP-TCP mixed mode algorithm " ) . arg ( C_UTP ) , & comboBox UtpMixedMode ) ;
// multiple connections per IP
cb MultiConnectionsPerIp . setChecked ( session - > multiConnectionsPerIpEnabled ( ) ) ;
addRow ( MULTI_CONNECTIONS_PER_IP , tr ( " Allow multiple connections from the same IP address " ) , & cb MultiConnectionsPerIp ) ;
checkBox MultiConnectionsPerIp . setChecked ( session - > multiConnectionsPerIpEnabled ( ) ) ;
addRow ( MULTI_CONNECTIONS_PER_IP , tr ( " Allow multiple connections from the same IP address " ) , & checkBox MultiConnectionsPerIp ) ;
// Recheck completed torrents
cb_recheck_c ompleted . setChecked ( pref - > recheckTorrentsOnCompletion ( ) ) ;
addRow ( RECHECK_COMPLETED , tr ( " Recheck torrents on completion " ) , & cb_recheck_c ompleted ) ;
checkBoxRecheckC ompleted . setChecked ( pref - > recheckTorrentsOnCompletion ( ) ) ;
addRow ( RECHECK_COMPLETED , tr ( " Recheck torrents on completion " ) , & checkBoxRecheckC ompleted ) ;
// Transfer list refresh interval
spin_list_r efresh . setMinimum ( 30 ) ;
spin_list_r efresh . setMaximum ( 99999 ) ;
spin_list_r efresh . setValue ( session - > refreshInterval ( ) ) ;
spin_list_r efresh . setSuffix ( tr ( " ms " , " milliseconds " ) ) ;
addRow ( LIST_REFRESH , tr ( " Transfer list refresh interval " ) , & spin_list_r efresh ) ;
spinBoxListR efresh . setMinimum ( 30 ) ;
spinBoxListR efresh . setMaximum ( 99999 ) ;
spinBoxListR efresh . setValue ( session - > refreshInterval ( ) ) ;
spinBoxListR efresh . setSuffix ( tr ( " ms " , " milliseconds " ) ) ;
addRow ( LIST_REFRESH , tr ( " Transfer list refresh interval " ) , & spinBoxListR efresh ) ;
// Resolve Peer countries
cb_resolve_c ountries . setChecked ( pref - > resolvePeerCountries ( ) ) ;
addRow ( RESOLVE_COUNTRIES , tr ( " Resolve peer countries (GeoIP) " ) , & cb_resolve_c ountries ) ;
checkBoxResolveC ountries . setChecked ( pref - > resolvePeerCountries ( ) ) ;
addRow ( RESOLVE_COUNTRIES , tr ( " Resolve peer countries (GeoIP) " ) , & checkBoxResolveC ountries ) ;
// Resolve peer hosts
cb_resolve_h osts . setChecked ( pref - > resolvePeerHostNames ( ) ) ;
addRow ( RESOLVE_HOSTS , tr ( " Resolve peer host names " ) , & cb_resolve_h osts ) ;
checkBoxResolveH osts . setChecked ( pref - > resolvePeerHostNames ( ) ) ;
addRow ( RESOLVE_HOSTS , tr ( " Resolve peer host names " ) , & checkBoxResolveH osts ) ;
// Max Half Open connections
spin_maxhalfo pen . setMinimum ( 0 ) ;
spin_maxhalfo pen . setMaximum ( 99999 ) ;
spin_maxhalfo pen . setValue ( session - > maxHalfOpenConnections ( ) ) ;
addRow ( MAX_HALF_OPEN , tr ( " Maximum number of half-open connections [0: Unlimited] " ) , & spin_maxhalfo pen ) ;
spinBoxMaxHalfO pen . setMinimum ( 0 ) ;
spinBoxMaxHalfO pen . setMaximum ( 99999 ) ;
spinBoxMaxHalfO pen . setValue ( session - > maxHalfOpenConnections ( ) ) ;
addRow ( MAX_HALF_OPEN , tr ( " Maximum number of half-open connections [0: Unlimited] " ) , & spinBoxMaxHalfO pen ) ;
// Super seeding
cb_super_s eeding . setChecked ( session - > isSuperSeedingEnabled ( ) ) ;
addRow ( SUPER_SEEDING , tr ( " Strict super seeding " ) , & cb_super_s eeding ) ;
checkBoxSuperS eeding . setChecked ( session - > isSuperSeedingEnabled ( ) ) ;
addRow ( SUPER_SEEDING , tr ( " Strict super seeding " ) , & checkBoxSuperS eeding ) ;
// Network interface
combo_i face . addItem ( tr ( " Any interface " , " i.e. Any network interface " ) ) ;
const QString current_i face = session - > networkInterface ( ) ;
bool interface_exists = current_i face . isEmpty ( ) ;
comboBoxInter face . addItem ( tr ( " Any interface " , " i.e. Any network interface " ) ) ;
const QString currentInter face = session - > networkInterface ( ) ;
bool interfaceExists = currentInter face . isEmpty ( ) ;
int i = 1 ;
foreach ( const QNetworkInterface & iface , QNetworkInterface : : allInterfaces ( ) ) {
// This line fixes a Qt bug => https://bugreports.qt.io/browse/QTBUG-52633
@ -403,83 +403,83 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -403,83 +403,83 @@ void AdvancedSettings::loadAdvancedSettings()
// https://github.com/qbittorrent/qBittorrent/pull/5135
if ( iface . addressEntries ( ) . isEmpty ( ) ) continue ;
combo_i face . addItem ( iface . humanReadableName ( ) , iface . name ( ) ) ;
if ( ! current_i face . isEmpty ( ) & & ( iface . name ( ) = = current_i face ) ) {
combo_i face . setCurrentIndex ( i ) ;
interface_e xists = true ;
comboBoxInter face . addItem ( iface . humanReadableName ( ) , iface . name ( ) ) ;
if ( ! currentInter face . isEmpty ( ) & & ( iface . name ( ) = = currentInter face ) ) {
comboBoxInter face . setCurrentIndex ( i ) ;
interfaceE xists = true ;
}
+ + i ;
}
// Saved interface does not exist, show it anyway
if ( ! interface_e xists ) {
combo_i face . addItem ( session - > networkInterfaceName ( ) , current_i face ) ;
combo_i face . setCurrentIndex ( i ) ;
if ( ! interfaceE xists ) {
comboBoxInter face . addItem ( session - > networkInterfaceName ( ) , currentInter face ) ;
comboBoxInter face . setCurrentIndex ( i ) ;
}
addRow ( NETWORK_IFACE , tr ( " Network Interface (requires restart) " ) , & combo_i face ) ;
addRow ( NETWORK_IFACE , tr ( " Network Interface (requires restart) " ) , & comboBoxInter face ) ;
// Network interface address
updateInterfaceAddressCombo ( ) ;
addRow ( NETWORK_IFACE_ADDRESS , tr ( " Optional IP Address to bind to (requires restart) " ) , & combo_iface_a ddress ) ;
addRow ( NETWORK_IFACE_ADDRESS , tr ( " Optional IP Address to bind to (requires restart) " ) , & comboBoxInterfaceA ddress ) ;
// Listen on IPv6 address
cb_listen_ip v6 . setChecked ( session - > isIPv6Enabled ( ) ) ;
addRow ( NETWORK_LISTEN_IPV6 , tr ( " Listen on IPv6 address (requires restart) " ) , & cb_listen_ip v6 ) ;
checkBoxListenIP v6 . setChecked ( session - > isIPv6Enabled ( ) ) ;
addRow ( NETWORK_LISTEN_IPV6 , tr ( " Listen on IPv6 address (requires restart) " ) , & checkBoxListenIP v6 ) ;
// Announce IP
tx tAnnounceIP. setText ( session - > announceIP ( ) ) ;
addRow ( ANNOUNCE_IP , tr ( " IP Address to report to trackers (requires restart) " ) , & tx tAnnounceIP) ;
lineEdi tAnnounceIP. setText ( session - > announceIP ( ) ) ;
addRow ( ANNOUNCE_IP , tr ( " IP Address to report to trackers (requires restart) " ) , & lineEdi tAnnounceIP) ;
// Program notifications
const MainWindow * const mainWindow = static_cast < Application * > ( QCoreApplication : : instance ( ) ) - > mainWindow ( ) ;
cb_program_n otifications . setChecked ( mainWindow - > isNotificationsEnabled ( ) ) ;
addRow ( PROGRAM_NOTIFICATIONS , tr ( " Display notifications " ) , & cb_program_n otifications ) ;
const MainWindow * const mainWindow = static_cast < Application * > ( QCoreApplication : : instance ( ) ) - > mainWindow ( ) ;
checkBoxProgramN otifications . setChecked ( mainWindow - > isNotificationsEnabled ( ) ) ;
addRow ( PROGRAM_NOTIFICATIONS , tr ( " Display notifications " ) , & checkBoxProgramN otifications ) ;
// Torrent added notifications
cb_torrent_added_n otifications . setChecked ( mainWindow - > isTorrentAddedNotificationsEnabled ( ) ) ;
addRow ( TORRENT_ADDED_NOTIFICATIONS , tr ( " Display notifications for added torrents " ) , & cb_torrent_added_n otifications ) ;
checkBoxTorrentAddedN otifications . setChecked ( mainWindow - > isTorrentAddedNotificationsEnabled ( ) ) ;
addRow ( TORRENT_ADDED_NOTIFICATIONS , tr ( " Display notifications for added torrents " ) , & checkBoxTorrentAddedN otifications ) ;
// Download tracker's favicon
cb_tracker_f avicon . setChecked ( mainWindow - > isDownloadTrackerFavicon ( ) ) ;
addRow ( DOWNLOAD_TRACKER_FAVICON , tr ( " Download tracker's favicon " ) , & cb_tracker_f avicon ) ;
checkBoxTrackerF avicon . setChecked ( mainWindow - > isDownloadTrackerFavicon ( ) ) ;
addRow ( DOWNLOAD_TRACKER_FAVICON , tr ( " Download tracker's favicon " ) , & checkBoxTrackerF avicon ) ;
// Save path history length
spinSavePathHistoryLength . setRange ( AddNewTorrentDialog : : minPathHistoryLength , AddNewTorrentDialog : : maxPathHistoryLength ) ;
spinSavePathHistoryLength . setValue ( AddNewTorrentDialog : : savePathHistoryLength ( ) ) ;
addRow ( SAVE_PATH_HISTORY_LENGTH , tr ( " Save path history length " ) , & spinSavePathHistoryLength ) ;
spinBox SavePathHistoryLength . setRange ( AddNewTorrentDialog : : minPathHistoryLength , AddNewTorrentDialog : : maxPathHistoryLength ) ;
spinBox SavePathHistoryLength . setValue ( AddNewTorrentDialog : : savePathHistoryLength ( ) ) ;
addRow ( SAVE_PATH_HISTORY_LENGTH , tr ( " Save path history length " ) , & spinBox SavePathHistoryLength ) ;
// Tracker State
cb_tracker_s tatus . setChecked ( session - > isTrackerEnabled ( ) ) ;
addRow ( TRACKER_STATUS , tr ( " Enable embedded tracker " ) , & cb_tracker_s tatus ) ;
checkBoxTrackerS tatus . setChecked ( session - > isTrackerEnabled ( ) ) ;
addRow ( TRACKER_STATUS , tr ( " Enable embedded tracker " ) , & checkBoxTrackerS tatus ) ;
// Tracker port
spin_tracker_p ort . setMinimum ( 1 ) ;
spin_tracker_p ort . setMaximum ( 65535 ) ;
spin_tracker_p ort . setValue ( pref - > getTrackerPort ( ) ) ;
addRow ( TRACKER_PORT , tr ( " Embedded tracker port " ) , & spin_tracker_p ort ) ;
spinBoxTrackerP ort . setMinimum ( 1 ) ;
spinBoxTrackerP ort . setMaximum ( 65535 ) ;
spinBoxTrackerP ort . setValue ( pref - > getTrackerPort ( ) ) ;
addRow ( TRACKER_PORT , tr ( " Embedded tracker port " ) , & spinBoxTrackerP ort ) ;
// Choking algorithm
comboChokingAlgorithm . addItems ( { tr ( " Fixed slots " ) , tr ( " Upload rate based " ) } ) ;
comboChokingAlgorithm . setCurrentIndex ( static_cast < int > ( session - > chokingAlgorithm ( ) ) ) ;
addRow ( CHOKING_ALGORITHM , tr ( " Upload slots behavior " ) , & comboChokingAlgorithm ) ;
comboBox ChokingAlgorithm . addItems ( { tr ( " Fixed slots " ) , tr ( " Upload rate based " ) } ) ;
comboBox ChokingAlgorithm . setCurrentIndex ( static_cast < int > ( session - > chokingAlgorithm ( ) ) ) ;
addRow ( CHOKING_ALGORITHM , tr ( " Upload slots behavior " ) , & comboBox ChokingAlgorithm ) ;
// Seed choking algorithm
comboSeedChokingAlgorithm . addItems ( { tr ( " Round-robin " ) , tr ( " Fastest upload " ) , tr ( " Anti-leech " ) } ) ;
comboSeedChokingAlgorithm . setCurrentIndex ( static_cast < int > ( session - > seedChokingAlgorithm ( ) ) ) ;
addRow ( SEED_CHOKING_ALGORITHM , tr ( " Upload choking algorithm " ) , & comboSeedChokingAlgorithm ) ;
comboBox SeedChokingAlgorithm . addItems ( { tr ( " Round-robin " ) , tr ( " Fastest upload " ) , tr ( " Anti-leech " ) } ) ;
comboBox SeedChokingAlgorithm . setCurrentIndex ( static_cast < int > ( session - > seedChokingAlgorithm ( ) ) ) ;
addRow ( SEED_CHOKING_ALGORITHM , tr ( " Upload choking algorithm " ) , & comboBox SeedChokingAlgorithm ) ;
# if defined(Q_OS_WIN) || defined(Q_OS_MAC)
cb_update_c heck . setChecked ( pref - > isUpdateCheckEnabled ( ) ) ;
addRow ( UPDATE_CHECK , tr ( " Check for software updates " ) , & cb_update_c heck ) ;
checkBoxUpdateC heck . setChecked ( pref - > isUpdateCheckEnabled ( ) ) ;
addRow ( UPDATE_CHECK , tr ( " Check for software updates " ) , & checkBoxUpdateC heck ) ;
# endif
# if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
cb_use_icon_t heme . setChecked ( pref - > useSystemIconTheme ( ) ) ;
addRow ( USE_ICON_THEME , tr ( " Use system icon theme " ) , & cb_use_icon_t heme ) ;
checkBoxUseIconT heme . setChecked ( pref - > useSystemIconTheme ( ) ) ;
addRow ( USE_ICON_THEME , tr ( " Use system icon theme " ) , & checkBoxUseIconT heme ) ;
# endif
// Torrent recheck confirmation
cb_confirm_torrent_r echeck . setChecked ( pref - > confirmTorrentRecheck ( ) ) ;
addRow ( CONFIRM_RECHECK_TORRENT , tr ( " Confirm torrent recheck " ) , & cb_confirm_torrent_r echeck ) ;
checkBoxConfirmTorrentR echeck . setChecked ( pref - > confirmTorrentRecheck ( ) ) ;
addRow ( CONFIRM_RECHECK_TORRENT , tr ( " Confirm torrent recheck " ) , & checkBoxConfirmTorrentR echeck ) ;
// Remove all tags confirmation
cb_confirm_remove_all_t ags . setChecked ( pref - > confirmRemoveAllTags ( ) ) ;
addRow ( CONFIRM_REMOVE_ALL_TAGS , tr ( " Confirm removal of all tags " ) , & cb_confirm_remove_all_t ags ) ;
checkBoxConfirmRemoveAllT ags . setChecked ( pref - > confirmRemoveAllTags ( ) ) ;
addRow ( CONFIRM_REMOVE_ALL_TAGS , tr ( " Confirm removal of all tags " ) , & checkBoxConfirmRemoveAllT ags ) ;
// Announce to all trackers in a tier
cb_announce_all_t rackers . setChecked ( session - > announceToAllTrackers ( ) ) ;
addRow ( ANNOUNCE_ALL_TRACKERS , tr ( " Always announce to all trackers in a tier " ) , & cb_announce_all_t rackers ) ;
checkBoxAnnounceAllT rackers . setChecked ( session - > announceToAllTrackers ( ) ) ;
addRow ( ANNOUNCE_ALL_TRACKERS , tr ( " Always announce to all trackers in a tier " ) , & checkBoxAnnounceAllT rackers ) ;
// Announce to all tiers
cb_announce_all_t iers . setChecked ( session - > announceToAllTiers ( ) ) ;
addRow ( ANNOUNCE_ALL_TIERS , tr ( " Always announce to all tiers " ) , & cb_announce_all_t iers ) ;
checkBoxAnnounceAllT iers . setChecked ( session - > announceToAllTiers ( ) ) ;
addRow ( ANNOUNCE_ALL_TIERS , tr ( " Always announce to all tiers " ) , & checkBoxAnnounceAllT iers ) ;
}
template < typename T >