From eb3db365e7789bd09bd26c4d3c6cfda4f6fa31a1 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 17 Jul 2007 11:45:36 +0000 Subject: [PATCH] - Can't set a limit for a torrent superior to the global limit in program preferences --- src/allocationDlg.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/allocationDlg.h b/src/allocationDlg.h index 08dbb8929..b05e14f40 100644 --- a/src/allocationDlg.h +++ b/src/allocationDlg.h @@ -53,14 +53,22 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg { unsigned int nbTorrents = hashes.size(); if(!nbTorrents) close(); int val; + int max; if(nbTorrents == 1){ torrent_handle h = BTSession->getTorrentHandle(hashes.at(0)); - if(uploadMode) + if(uploadMode){ val = (int)(h.upload_limit() / 1024.); - else + max = (int)(BTSession->getSession()->upload_rate_limit() / 1024.); + }else{ 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); - if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum()) + if(val > bandwidthSlider->maximum()) + val = bandwidthSlider->maximum(); + else if(val < bandwidthSlider->minimum()) val = -1; bandwidthSlider->setValue(val); if(val == -1) {