@ -40,7 +40,6 @@
@@ -40,7 +40,6 @@
# include "base/preferences.h"
# include "base/unicodestrings.h"
# include "gui/addnewtorrentdialog.h"
# include "gui/desktopintegration.h"
# include "gui/mainwindow.h"
# include "interfaces/iguiapplication.h"
@ -83,7 +82,7 @@ namespace
@@ -83,7 +82,7 @@ namespace
RESOLVE_COUNTRIES ,
PROGRAM_NOTIFICATIONS ,
TORRENT_ADDED_NOTIFICATIONS ,
# if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
# ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
NOTIFICATION_TIMEOUT ,
# endif
CONFIRM_REMOVE_ALL_TAGS ,
@ -231,9 +230,9 @@ void AdvancedSettings::saveAdvancedSettings() const
@@ -231,9 +230,9 @@ void AdvancedSettings::saveAdvancedSettings() const
// Outgoing connections per second
session - > setConnectionSpeed ( m_spinBoxConnectionSpeed . value ( ) ) ;
// Socket send buffer size
session - > setSocketSendBufferSize ( m_spinBoxSocketSendBufferSize . value ( ) ) ;
session - > setSocketSendBufferSize ( m_spinBoxSocketSendBufferSize . value ( ) * 1024 ) ;
// Socket receive buffer size
session - > setSocketReceiveBufferSize ( m_spinBoxSocketReceiveBufferSize . value ( ) ) ;
session - > setSocketReceiveBufferSize ( m_spinBoxSocketReceiveBufferSize . value ( ) * 1024 ) ;
// Socket listen backlog size
session - > setSocketBacklogSize ( m_spinBoxSocketBacklogSize . value ( ) ) ;
// Save resume data interval
@ -333,13 +332,17 @@ void AdvancedSettings::updateCacheSpinSuffix(const int value)
@@ -333,13 +332,17 @@ void AdvancedSettings::updateCacheSpinSuffix(const int value)
}
# endif
void AdvancedSettings : : updateSaveResumeDataIntervalSuffix ( const int value )
# ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
void AdvancedSettings : : updateNotificationTimeoutSuffix ( const int value )
{
if ( value > 0 )
m_spinBoxSaveResumeDataInterval . setSuffix ( tr ( " min " , " minutes " ) ) ;
if ( value = = 0 )
m_spinBoxNotificationTimeout . setSuffix ( tr ( " (infinite) " ) ) ;
else if ( value < 0 )
m_spinBoxNotificationTimeout . setSuffix ( tr ( " (system default) " ) ) ;
else
m_spinBoxSaveResumeDataInterval . setSuffix ( tr ( " (disabled) " ) ) ;
m_spinBoxNotificationTimeout . setSuffix ( tr ( " ms " , " milliseconds " ) ) ;
}
# endif
void AdvancedSettings : : updateInterfaceAddressCombo ( )
{
@ -506,7 +509,7 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -506,7 +509,7 @@ void AdvancedSettings::loadAdvancedSettings()
# endif
// Disk queue size
m_spinBoxDiskQueueSize . setMinimum ( 1 ) ;
m_spinBoxDiskQueueSize . setMaximum ( std : : numeric_limits < int > : : max ( ) ) ;
m_spinBoxDiskQueueSize . setMaximum ( std : : numeric_limits < int > : : max ( ) / 1024 ) ;
m_spinBoxDiskQueueSize . setValue ( session - > diskQueueSize ( ) / 1024 ) ;
m_spinBoxDiskQueueSize . setSuffix ( tr ( " KiB " ) ) ;
addRow ( DISK_QUEUE_SIZE , ( tr ( " Disk queue size " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#max_queued_disk_bytes " , u " (?) " ) )
@ -575,19 +578,19 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -575,19 +578,19 @@ void AdvancedSettings::loadAdvancedSettings()
, & m_spinBoxConnectionSpeed ) ;
// Socket send buffer size
m_spinBoxSocketSendBufferSize . setMinimum ( 0 ) ;
m_spinBoxSocketSendBufferSize . setMaximum ( std : : numeric_limits < int > : : max ( ) ) ;
m_spinBoxSocketSendBufferSize . setValue ( session - > socketSendBufferSize ( ) ) ;
m_spinBoxSocketSendBufferSize . setSuffix ( tr ( " Bytes " ) ) ;
m_spinBoxSocketSendBufferSize . setSpecialValueText ( tr ( " System default " ) ) ;
addRow ( SOCKET_SEND_BUFFER_SIZE , ( tr ( " Socket send buffer size " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#send_socket_buffer_size " , u " (?) " ) )
m_spinBoxSocketSendBufferSize . setMaximum ( std : : numeric_limits < int > : : max ( ) / 1024 ) ;
m_spinBoxSocketSendBufferSize . setValue ( session - > socketSendBufferSize ( ) / 1024 ) ;
m_spinBoxSocketSendBufferSize . setSuffix ( tr ( " Ki B " ) ) ;
m_spinBoxSocketSendBufferSize . setSpecialValueText ( tr ( " 0 (system default) " ) ) ;
addRow ( SOCKET_SEND_BUFFER_SIZE , ( tr ( " Socket send buffer size [0: system default] " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#send_socket_buffer_size " , u " (?) " ) )
, & m_spinBoxSocketSendBufferSize ) ;
// Socket receive buffer size
m_spinBoxSocketReceiveBufferSize . setMinimum ( 0 ) ;
m_spinBoxSocketReceiveBufferSize . setMaximum ( std : : numeric_limits < int > : : max ( ) ) ;
m_spinBoxSocketReceiveBufferSize . setValue ( session - > socketReceiveBufferSize ( ) ) ;
m_spinBoxSocketReceiveBufferSize . setSuffix ( tr ( " Bytes " ) ) ;
m_spinBoxSocketReceiveBufferSize . setSpecialValueText ( tr ( " System default " ) ) ;
addRow ( SOCKET_RECEIVE_BUFFER_SIZE , ( tr ( " Socket receive buffer size " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#recv_socket_buffer_size " , u " (?) " ) )
m_spinBoxSocketReceiveBufferSize . setMaximum ( std : : numeric_limits < int > : : max ( ) / 1024 ) ;
m_spinBoxSocketReceiveBufferSize . setValue ( session - > socketReceiveBufferSize ( ) / 1024 ) ;
m_spinBoxSocketReceiveBufferSize . setSuffix ( tr ( " Ki B " ) ) ;
m_spinBoxSocketReceiveBufferSize . setSpecialValueText ( tr ( " 0 (system default) " ) ) ;
addRow ( SOCKET_RECEIVE_BUFFER_SIZE , ( tr ( " Socket receive buffer size [0: system default] " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#recv_socket_buffer_size " , u " (?) " ) )
, & m_spinBoxSocketReceiveBufferSize ) ;
// Socket listen backlog size
m_spinBoxSocketBacklogSize . setMinimum ( 1 ) ;
@ -599,22 +602,23 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -599,22 +602,23 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxSaveResumeDataInterval . setMinimum ( 0 ) ;
m_spinBoxSaveResumeDataInterval . setMaximum ( std : : numeric_limits < int > : : max ( ) ) ;
m_spinBoxSaveResumeDataInterval . setValue ( session - > saveResumeDataInterval ( ) ) ;
connect ( & m_spinBoxSaveResumeDataInterval , qOverload < int > ( & QSpinBox : : valueChanged )
, this , & AdvancedSettings : : updateSaveResumeDataIntervalSuffix ) ;
updateSaveResumeDataIntervalSuffix ( m_spinBoxSaveResumeDataInterval . value ( ) ) ;
addRow ( SAVE_RESUME_DATA_INTERVAL , tr ( " Save resume data interval " , " How often the fastresume file is saved. " ) , & m_spinBoxSaveResumeDataInterval ) ;
m_spinBoxSaveResumeDataInterval . setSuffix ( tr ( " min " , " minutes " ) ) ;
m_spinBoxSaveResumeDataInterval . setSpecialValueText ( tr ( " 0 (disabled) " ) ) ;
addRow ( SAVE_RESUME_DATA_INTERVAL , tr ( " Save resume data interval [0: disabled] " , " How often the fastresume file is saved. " ) , & m_spinBoxSaveResumeDataInterval ) ;
// Outgoing port Min
m_spinBoxOutgoingPortsMin . setMinimum ( 0 ) ;
m_spinBoxOutgoingPortsMin . setMaximum ( 65535 ) ;
m_spinBoxOutgoingPortsMin . setValue ( session - > outgoingPortsMin ( ) ) ;
addRow ( OUTGOING_PORT_MIN , ( tr ( " Outgoing ports (Min) [0: Disabled] " )
m_spinBoxOutgoingPortsMin . setSpecialValueText ( tr ( " 0 (disabled) " ) ) ;
addRow ( OUTGOING_PORT_MIN , ( tr ( " Outgoing ports (Min) [0: disabled] " )
+ u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#outgoing_port " , u " (?) " ) )
, & m_spinBoxOutgoingPortsMin ) ;
// Outgoing port Min
// Outgoing port Max
m_spinBoxOutgoingPortsMax . setMinimum ( 0 ) ;
m_spinBoxOutgoingPortsMax . setMaximum ( 65535 ) ;
m_spinBoxOutgoingPortsMax . setValue ( session - > outgoingPortsMax ( ) ) ;
addRow ( OUTGOING_PORT_MAX , ( tr ( " Outgoing ports (Max) [0: Disabled] " )
m_spinBoxOutgoingPortsMax . setSpecialValueText ( tr ( " 0 (disabled) " ) ) ;
addRow ( OUTGOING_PORT_MAX , ( tr ( " Outgoing ports (Max) [0: disabled] " )
+ u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#outgoing_port " , u " (?) " ) )
, & m_spinBoxOutgoingPortsMax ) ;
// UPnP lease duration
@ -622,7 +626,8 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -622,7 +626,8 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxUPnPLeaseDuration . setMaximum ( std : : numeric_limits < int > : : max ( ) ) ;
m_spinBoxUPnPLeaseDuration . setValue ( session - > UPnPLeaseDuration ( ) ) ;
m_spinBoxUPnPLeaseDuration . setSuffix ( tr ( " s " , " seconds " ) ) ;
addRow ( UPNP_LEASE_DURATION , ( tr ( " UPnP lease duration [0: Permanent lease] " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#upnp_lease_duration " , u " (?) " ) )
m_spinBoxUPnPLeaseDuration . setSpecialValueText ( tr ( " 0 (permanent lease) " ) ) ;
addRow ( UPNP_LEASE_DURATION , ( tr ( " UPnP lease duration [0: permanent lease] " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#upnp_lease_duration " , u " (?) " ) )
, & m_spinBoxUPnPLeaseDuration ) ;
// Type of service
m_spinBoxPeerToS . setMinimum ( 0 ) ;
@ -711,11 +716,12 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -711,11 +716,12 @@ void AdvancedSettings::loadAdvancedSettings()
addRow ( MAX_CONCURRENT_HTTP_ANNOUNCES , ( tr ( " Max concurrent HTTP announces " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#max_concurrent_http_announces " , u " (?) " ) )
, & m_spinBoxMaxConcurrentHTTPAnnounces ) ;
// Stop tracker timeout
m_spinBoxStopTrackerTimeout . setMaximum ( std : : numeric_limits < int > : : max ( ) ) ;
m_spinBoxStopTrackerTimeout . setValue ( session - > stopTrackerTimeout ( ) ) ;
m_spinBoxStopTrackerTimeout . setSuffix ( tr ( " s " , " seconds " ) ) ;
addRow ( STOP_TRACKER_TIMEOUT , ( tr ( " Stop tracker timeout " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout " , u " (?) " ) )
m_spinBoxStopTrackerTimeout . setSpecialValueText ( tr ( " 0 (disabled) " ) ) ;
addRow ( STOP_TRACKER_TIMEOUT , ( tr ( " Stop tracker timeout [0: disabled] " ) + u ' ' + makeLink ( u " https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout " , u " (?) " ) )
, & m_spinBoxStopTrackerTimeout ) ;
// Program notifications
m_checkBoxProgramNotifications . setChecked ( app ( ) - > desktopIntegration ( ) - > isNotificationsEnabled ( ) ) ;
addRow ( PROGRAM_NOTIFICATIONS , tr ( " Display notifications " ) , & m_checkBoxProgramNotifications ) ;
@ -727,9 +733,10 @@ void AdvancedSettings::loadAdvancedSettings()
@@ -727,9 +733,10 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxNotificationTimeout . setMinimum ( - 1 ) ;
m_spinBoxNotificationTimeout . setMaximum ( std : : numeric_limits < int > : : max ( ) ) ;
m_spinBoxNotificationTimeout . setValue ( app ( ) - > desktopIntegration ( ) - > notificationTimeout ( ) ) ;
m_spinBoxNotificationTimeout . setSpecialValueText ( tr ( " System default " ) ) ;
m_spinBoxNotificationTimeout . setSuffix ( tr ( " ms " , " milliseconds " ) ) ;
addRow ( NOTIFICATION_TIMEOUT , tr ( " Notification timeout [0: infinite] " ) , & m_spinBoxNotificationTimeout ) ;
connect ( & m_spinBoxNotificationTimeout , qOverload < int > ( & QSpinBox : : valueChanged )
, this , & AdvancedSettings : : updateNotificationTimeoutSuffix ) ;
updateNotificationTimeoutSuffix ( m_spinBoxNotificationTimeout . value ( ) ) ;
addRow ( NOTIFICATION_TIMEOUT , tr ( " Notification timeout [0: infinite, -1: system default] " ) , & m_spinBoxNotificationTimeout ) ;
# endif
// Reannounce to all trackers when ip/port changed
m_checkBoxReannounceWhenAddressChanged . setChecked ( session - > isReannounceWhenAddressChangedEnabled ( ) ) ;