diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index 06a27edc8..2ad64667f 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -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 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, @@ -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() { @@ -578,16 +581,16 @@ void AdvancedSettings::loadAdvancedSettings() m_spinBoxSocketSendBufferSize.setMaximum(std::numeric_limits::max() / 1024); m_spinBoxSocketSendBufferSize.setValue(session->socketSendBufferSize() / 1024); m_spinBoxSocketSendBufferSize.setSuffix(tr(" KiB")); - 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.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::max() / 1024); m_spinBoxSocketReceiveBufferSize.setValue(session->socketReceiveBufferSize() / 1024); m_spinBoxSocketReceiveBufferSize.setSuffix(tr(" KiB")); - 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.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() m_spinBoxSaveResumeDataInterval.setMinimum(0); m_spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits::max()); m_spinBoxSaveResumeDataInterval.setValue(session->saveResumeDataInterval()); - connect(&m_spinBoxSaveResumeDataInterval, qOverload(&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() m_spinBoxUPnPLeaseDuration.setMaximum(std::numeric_limits::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() 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::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() m_spinBoxNotificationTimeout.setMinimum(-1); m_spinBoxNotificationTimeout.setMaximum(std::numeric_limits::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(&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()); diff --git a/src/gui/advancedsettings.h b/src/gui/advancedsettings.h index dee557f90..5b0ab9b70 100644 --- a/src/gui/advancedsettings.h +++ b/src/gui/advancedsettings.h @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2015 + * Copyright (C) 2015 qBittorrent project * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,6 +34,7 @@ #include #include +#include "gui/desktopintegration.h" #include "guiapplicationcomponent.h" class AdvancedSettings final : public QTableWidget, public GUIApplicationComponent @@ -51,11 +52,15 @@ signals: void settingsChanged(); private slots: + void updateInterfaceAddressCombo(); + #ifndef QBT_USES_LIBTORRENT2 void updateCacheSpinSuffix(int value); #endif - void updateSaveResumeDataIntervalSuffix(int value); - void updateInterfaceAddressCombo(); + +#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS + void updateNotificationTimeoutSuffix(int value); +#endif private: void loadAdvancedSettings(); @@ -93,7 +98,7 @@ private: QCheckBox m_checkBoxIconsInMenusEnabled; #endif -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB) +#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS QSpinBox m_spinBoxNotificationTimeout; #endif }; diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 33a15f5a3..5d8c06a2e 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -1210,7 +1210,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD - + @@ -1218,7 +1218,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD - + @@ -1226,7 +1226,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD - + @@ -1348,7 +1348,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD - +