From 9b5fea1987adc51c15b8de748a81c65baa7435af Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sun, 14 Dec 2014 10:00:00 +0100 Subject: [PATCH 1/2] Don't put limits to the alternative speed limits --- src/preferences/preferences.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index 9d7e1d910..5b57cf61c 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -572,10 +572,7 @@ void Preferences::setGlobalUploadLimit(int limit) { } int Preferences::getAltGlobalDownloadLimit() const { - int ret = value("Preferences/Connection/GlobalDLLimitAlt", 10).toInt(); - if (ret <= 0) - ret = 10; - return ret; + return value("Preferences/Connection/GlobalDLLimitAlt", 10).toInt(); } void Preferences::setAltGlobalDownloadLimit(int limit) { @@ -585,10 +582,7 @@ void Preferences::setAltGlobalDownloadLimit(int limit) { } int Preferences::getAltGlobalUploadLimit() const { - int ret = value("Preferences/Connection/GlobalUPLimitAlt", 10).toInt(); - if (ret <= 0) - ret = 10; - return ret; + return value("Preferences/Connection/GlobalUPLimitAlt", 10).toInt(); } void Preferences::setAltGlobalUploadLimit(int limit) { From d202a596715400655ee8168ce8d8f8b588c74dd0 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sun, 14 Dec 2014 10:00:00 +0100 Subject: [PATCH 2/2] Don't forget alternative speed limits changes --- src/statusbar.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/statusbar.cpp b/src/statusbar.cpp index e030c0a46..0382cd023 100644 --- a/src/statusbar.cpp +++ b/src/statusbar.cpp @@ -228,11 +228,15 @@ void StatusBar::capDownloadSpeed() { QBtSession::instance()->setDownloadRateLimit(-1); if (!alt) pref->setGlobalDownloadLimit(-1); + else + pref->setAltGlobalDownloadLimit(-1); } else { qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.); QBtSession::instance()->setDownloadRateLimit(new_limit); if (!alt) pref->setGlobalDownloadLimit(new_limit/1024.); + else + pref->setAltGlobalDownloadLimit(new_limit/1024.); } refreshStatusBar(); } @@ -250,11 +254,15 @@ void StatusBar::capUploadSpeed() { QBtSession::instance()->setUploadRateLimit(-1); if (!alt) Preferences::instance()->setGlobalUploadLimit(-1); + else + Preferences::instance()->setAltGlobalUploadLimit(-1); } else { qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.); QBtSession::instance()->setUploadRateLimit(new_limit); if (!alt) Preferences::instance()->setGlobalUploadLimit(new_limit/1024.); + else + Preferences::instance()->setAltGlobalUploadLimit(new_limit/1024.); } refreshStatusBar(); }