mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #2283 from pmzqla/speed-limits
Alternative speed limits changes
This commit is contained in:
commit
50492902aa
@ -572,10 +572,7 @@ void Preferences::setGlobalUploadLimit(int limit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::getAltGlobalDownloadLimit() const {
|
int Preferences::getAltGlobalDownloadLimit() const {
|
||||||
int ret = value("Preferences/Connection/GlobalDLLimitAlt", 10).toInt();
|
return value("Preferences/Connection/GlobalDLLimitAlt", 10).toInt();
|
||||||
if (ret <= 0)
|
|
||||||
ret = 10;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setAltGlobalDownloadLimit(int limit) {
|
void Preferences::setAltGlobalDownloadLimit(int limit) {
|
||||||
@ -585,10 +582,7 @@ void Preferences::setAltGlobalDownloadLimit(int limit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::getAltGlobalUploadLimit() const {
|
int Preferences::getAltGlobalUploadLimit() const {
|
||||||
int ret = value("Preferences/Connection/GlobalUPLimitAlt", 10).toInt();
|
return value("Preferences/Connection/GlobalUPLimitAlt", 10).toInt();
|
||||||
if (ret <= 0)
|
|
||||||
ret = 10;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setAltGlobalUploadLimit(int limit) {
|
void Preferences::setAltGlobalUploadLimit(int limit) {
|
||||||
|
@ -228,11 +228,15 @@ void StatusBar::capDownloadSpeed() {
|
|||||||
QBtSession::instance()->setDownloadRateLimit(-1);
|
QBtSession::instance()->setDownloadRateLimit(-1);
|
||||||
if (!alt)
|
if (!alt)
|
||||||
pref->setGlobalDownloadLimit(-1);
|
pref->setGlobalDownloadLimit(-1);
|
||||||
|
else
|
||||||
|
pref->setAltGlobalDownloadLimit(-1);
|
||||||
} else {
|
} else {
|
||||||
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.);
|
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.);
|
||||||
QBtSession::instance()->setDownloadRateLimit(new_limit);
|
QBtSession::instance()->setDownloadRateLimit(new_limit);
|
||||||
if (!alt)
|
if (!alt)
|
||||||
pref->setGlobalDownloadLimit(new_limit/1024.);
|
pref->setGlobalDownloadLimit(new_limit/1024.);
|
||||||
|
else
|
||||||
|
pref->setAltGlobalDownloadLimit(new_limit/1024.);
|
||||||
}
|
}
|
||||||
refreshStatusBar();
|
refreshStatusBar();
|
||||||
}
|
}
|
||||||
@ -250,11 +254,15 @@ void StatusBar::capUploadSpeed() {
|
|||||||
QBtSession::instance()->setUploadRateLimit(-1);
|
QBtSession::instance()->setUploadRateLimit(-1);
|
||||||
if (!alt)
|
if (!alt)
|
||||||
Preferences::instance()->setGlobalUploadLimit(-1);
|
Preferences::instance()->setGlobalUploadLimit(-1);
|
||||||
|
else
|
||||||
|
Preferences::instance()->setAltGlobalUploadLimit(-1);
|
||||||
} else {
|
} else {
|
||||||
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.);
|
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.);
|
||||||
QBtSession::instance()->setUploadRateLimit(new_limit);
|
QBtSession::instance()->setUploadRateLimit(new_limit);
|
||||||
if (!alt)
|
if (!alt)
|
||||||
Preferences::instance()->setGlobalUploadLimit(new_limit/1024.);
|
Preferences::instance()->setGlobalUploadLimit(new_limit/1024.);
|
||||||
|
else
|
||||||
|
Preferences::instance()->setAltGlobalUploadLimit(new_limit/1024.);
|
||||||
}
|
}
|
||||||
refreshStatusBar();
|
refreshStatusBar();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user