1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-14 08:48:17 +00:00

- Can't set a limit for a torrent superior to the global limit in program preferences

This commit is contained in:
Christophe Dumez 2007-07-17 11:45:36 +00:00
parent 2dea5f2ff8
commit eb3db365e7

View File

@ -53,14 +53,22 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
unsigned int nbTorrents = hashes.size(); unsigned int nbTorrents = hashes.size();
if(!nbTorrents) close(); if(!nbTorrents) close();
int val; int val;
int max;
if(nbTorrents == 1){ if(nbTorrents == 1){
torrent_handle h = BTSession->getTorrentHandle(hashes.at(0)); torrent_handle h = BTSession->getTorrentHandle(hashes.at(0));
if(uploadMode) if(uploadMode){
val = (int)(h.upload_limit() / 1024.); val = (int)(h.upload_limit() / 1024.);
else max = (int)(BTSession->getSession()->upload_rate_limit() / 1024.);
}else{
val = (int)(h.download_limit() / 1024.); val = (int)(h.download_limit() / 1024.);
max = (int)(BTSession->getSession()->download_rate_limit() / 1024.);
}
if(max != -1)
bandwidthSlider->setMaximum(max);
qDebug("Bandwidth limit: %d", val); qDebug("Bandwidth limit: %d", val);
if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum()) if(val > bandwidthSlider->maximum())
val = bandwidthSlider->maximum();
else if(val < bandwidthSlider->minimum())
val = -1; val = -1;
bandwidthSlider->setValue(val); bandwidthSlider->setValue(val);
if(val == -1) { if(val == -1) {