Chocobo1 2 years ago
parent
commit
9d7fcea5d6
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 53
      src/gui/advancedsettings.cpp
  2. 13
      src/gui/advancedsettings.h
  3. 8
      src/webui/www/private/views/preferences.html

53
src/gui/advancedsettings.cpp

@ -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,
@ -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()
{
@ -578,16 +581,16 @@ void AdvancedSettings::loadAdvancedSettings() @@ -578,16 +581,16 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxSocketSendBufferSize.setMaximum(std::numeric_limits<int>::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<int>::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() @@ -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());

13
src/gui/advancedsettings.h

@ -1,6 +1,6 @@ @@ -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 @@ @@ -34,6 +34,7 @@
#include <QSpinBox>
#include <QTableWidget>
#include "gui/desktopintegration.h"
#include "guiapplicationcomponent.h"
class AdvancedSettings final : public QTableWidget, public GUIApplicationComponent
@ -51,11 +52,15 @@ signals: @@ -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: @@ -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
};

8
src/webui/www/private/views/preferences.html

@ -1210,7 +1210,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD @@ -1210,7 +1210,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
</tr>
<tr>
<td>
<label for="outgoingPortsMin">QBT_TR(Outgoing ports (Min) [0: Disabled]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#outgoing_port" target="_blank">(?)</a></label>
<label for="outgoingPortsMin">QBT_TR(Outgoing ports (Min) [0: disabled]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#outgoing_port" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="outgoingPortsMin" style="width: 15em;" />
@ -1218,7 +1218,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
</tr>
<tr>
<td>
<label for="outgoingPortsMax">QBT_TR(Outgoing ports (Max) [0: Disabled]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#outgoing_port" target="_blank">(?)</a></label>
<label for="outgoingPortsMax">QBT_TR(Outgoing ports (Max) [0: disabled]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#outgoing_port" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="outgoingPortsMax" style="width: 15em;" />
@ -1226,7 +1226,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
</tr>
<tr>
<td>
<label for="UPnPLeaseDuration">QBT_TR(UPnP lease duration [0: Permanent lease]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#upnp_lease_duration" target="_blank">(?)</a></label>
<label for="UPnPLeaseDuration">QBT_TR(UPnP lease duration [0: permanent lease]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#upnp_lease_duration" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="UPnPLeaseDuration" style="width: 15em;" />
@ -1348,7 +1348,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
</tr>
<tr>
<td>
<label for="stopTrackerTimeout">QBT_TR(Stop tracker timeout:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout" target="_blank">(?)</a></label>
<label for="stopTrackerTimeout">QBT_TR(Stop tracker timeout [0: disabled]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="stopTrackerTimeout" style="width: 15em;" />

Loading…
Cancel
Save