diff --git a/Changelog b/Changelog index 57fa2fcea..2541205db 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,7 @@ - FEATURE: Added "Upload/Download limit" columns to transfer list - FEATURE: Torrent files can be exported to a given directory - FEATURE: Outgoing ports range can be customized (for QoS) + - FEATURE: User can choose to apply transfer limits on LAN too * Mon Jan 18 2010 - Christophe Dumez - v2.1.0 - FEATURE: Graphical User Interface can be disabled at compilation time (headless running) diff --git a/src/advancedsettings.h b/src/advancedsettings.h index 92ca4c209..5ae3e9864 100644 --- a/src/advancedsettings.h +++ b/src/advancedsettings.h @@ -4,17 +4,19 @@ #include #include #include +#include #include "preferences.h" enum AdvSettingsCols {PROPERTY, VALUE}; -enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX }; -#define ROW_COUNT 3 +enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN }; +#define ROW_COUNT 4 class AdvancedSettings: public QTableWidget { Q_OBJECT private: QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max; + QCheckBox *cb_ignore_limits_lan; public: AdvancedSettings(QWidget *parent=0): QTableWidget(parent) { @@ -35,6 +37,7 @@ public: delete spin_cache; delete outgoing_ports_min; delete outgoing_ports_max; + delete cb_ignore_limits_lan; } public slots: @@ -44,6 +47,8 @@ public: // Outgoing ports Preferences::setOutgoingPortsMin(outgoing_ports_min->value()); Preferences::setOutgoingPortsMax(outgoing_ports_max->value()); + // Ignore limits on LAN + Preferences::ignoreLimitsOnLAN(cb_ignore_limits_lan->isChecked()); } protected slots: @@ -72,6 +77,12 @@ protected slots: outgoing_ports_max->setMaximum(65535); outgoing_ports_max->setValue(Preferences::outgoingPortsMax()); setCellWidget(OUTGOING_PORT_MAX, VALUE, outgoing_ports_max); + // Ignore transfer limits on local network + setItem(IGNORE_LIMIT_LAN, PROPERTY, new QTableWidgetItem(tr("Ignore transfer limits on local network"))); + cb_ignore_limits_lan = new QCheckBox(); + connect(cb_ignore_limits_lan, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); + cb_ignore_limits_lan->setChecked(Preferences::ignoreLimitsOnLAN()); + setCellWidget(IGNORE_LIMIT_LAN, VALUE, cb_ignore_limits_lan); } void emitSettingsChanged() { diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 25b8aa3a1..e1d02170d 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -430,6 +430,8 @@ void Bittorrent::configureSession() { // Outgoing ports sessionSettings.outgoing_ports = std::make_pair(Preferences::outgoingPortsMin(), Preferences::outgoingPortsMax()); setSessionSettings(sessionSettings); + // Ignore limits on LAN + sessionSettings.ignore_limits_on_local_network = Preferences::ignoreLimitsOnLAN(); // Bittorrent // * Max connections limit setMaxConnections(Preferences::getMaxConnecs()); diff --git a/src/preferences.h b/src/preferences.h index 993f02910..656c832b9 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -858,6 +858,16 @@ public: settings.setValue(QString::fromUtf8("Preferences/Advanced/OutgoingPortsMax"), val); } + static bool ignoreLimitsOnLAN() { + QSettings settings("qBittorrent", "qBittorrent"); + return settings.value(QString::fromUtf8("Preferences/Advanced/IgnoreLimitsLAN"), true).toBool(); + } + + static void ignoreLimitsOnLAN(bool ignore) { + QSettings settings("qBittorrent", "qBittorrent"); + settings.setValue(QString::fromUtf8("Preferences/Advanced/IgnoreLimitsLAN"), ignore); + } + }; #endif // PREFERENCES_H