- Fix issue with speed limiting (infinite value was not handled properly)

This commit is contained in:
Christophe Dumez
2009-12-22 17:37:45 +00:00
parent 9989ec79c9
commit b675f4ac58
3 changed files with 20 additions and 10 deletions

View File

@@ -3,6 +3,7 @@
- BUGFIX: Fix "Temp path" button in program preferences - BUGFIX: Fix "Temp path" button in program preferences
- BUGFIX: Handle paths with [~, ., ..] properly - BUGFIX: Handle paths with [~, ., ..] properly
- BUGFIX: Trackers are now displayed for torrents without metadata - BUGFIX: Trackers are now displayed for torrents without metadata
- BUGFIX: Fix issue with speed limiting (value should be -1 not 0)
* Fri Dec 18 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.2 * Fri Dec 18 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.2
- BUGFIX: Fix .qbittorrent folder not being created (critical bug introduced in v2.0.1 that makes qBittorrent unusuable for new users) - BUGFIX: Fix .qbittorrent folder not being created (critical bug introduced in v2.0.1 that makes qBittorrent unusuable for new users)

View File

@@ -62,7 +62,10 @@ class SpeedLimitDialog : public QDialog, private Ui_bandwidth_dlg {
dlg.setDefaultValue(default_value/1024.); dlg.setDefaultValue(default_value/1024.);
if(dlg.exec() == QDialog::Accepted) { if(dlg.exec() == QDialog::Accepted) {
*ok = true; *ok = true;
return dlg.getSpeedLimit()*1024; int val = dlg.getSpeedLimit();
if(val <= 0)
return -1;
return val*1024;
} else { } else {
*ok = false; *ok = false;
return -2; return -2;

View File

@@ -168,12 +168,15 @@ public slots:
bool ok = false; bool ok = false;
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), BTSession->getSession()->download_rate_limit()); long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), BTSession->getSession()->download_rate_limit());
if(ok) { if(ok) {
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.); if(new_limit <= 0) {
BTSession->getSession()->set_download_rate_limit(new_limit); qDebug("Setting global download rate limit to Unlimited");
if(new_limit <= 0) BTSession->getSession()->set_download_rate_limit(-1);
Preferences::setGlobalDownloadLimit(-1); Preferences::setGlobalDownloadLimit(-1);
else } else {
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.);
BTSession->getSession()->set_download_rate_limit(new_limit);
Preferences::setGlobalDownloadLimit(new_limit/1024.); Preferences::setGlobalDownloadLimit(new_limit/1024.);
}
} }
} }
@@ -181,13 +184,16 @@ public slots:
bool ok = false; bool ok = false;
long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), BTSession->getSession()->upload_rate_limit()); long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), BTSession->getSession()->upload_rate_limit());
if(ok) { if(ok) {
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.); if(new_limit <= 0) {
BTSession->getSession()->set_upload_rate_limit(new_limit); qDebug("Setting global upload rate limit to Unlimited");
if(new_limit <= 0) BTSession->getSession()->set_upload_rate_limit(-1);
Preferences::setGlobalUploadLimit(-1); Preferences::setGlobalUploadLimit(-1);
else } else {
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.);
BTSession->getSession()->set_upload_rate_limit(new_limit);
Preferences::setGlobalUploadLimit(new_limit/1024.); Preferences::setGlobalUploadLimit(new_limit/1024.);
} }
}
} }
}; };