From 4b8532ea2d250285c82f5f45bfdf0928151c0618 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 15 Jul 2008 18:34:28 +0000 Subject: [PATCH] - Bug fix in session configuring (queueing) --- src/bittorrent.cpp | 24 ++++++++++++++++++++++-- src/bittorrent.h | 2 ++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 038c2ff76..7e69d5a74 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -166,11 +166,23 @@ bool bittorrent::isQueueingEnabled() const { } void bittorrent::setMaxActiveDownloads(int val) { - maxActiveDownloads = val; + if(val != maxActiveDownloads) { + maxActiveDownloads = val; + if(queueingEnabled) { + updateDownloadQueue(); + updateUploadQueue(); + } + } } void bittorrent::setMaxActiveTorrents(int val) { - maxActiveTorrents = val; + if(val != maxActiveTorrents) { + maxActiveTorrents = val; + if(queueingEnabled) { + updateDownloadQueue(); + updateUploadQueue(); + } + } } void bittorrent::increaseDlTorrentPriority(QString hash) { @@ -262,6 +274,14 @@ void bittorrent::setUploadLimit(QString hash, long val) { saveTorrentSpeedLimits(hash); } +int bittorrent::getMaximumActiveDownloads() const { + return maxActiveDownloads; +} + +int bittorrent::getMaximumActiveTorrents() const { + return maxActiveTorrents; +} + void bittorrent::handleDownloadFailure(QString url, QString reason) { emit downloadFromUrlFailure(url, reason); } diff --git a/src/bittorrent.h b/src/bittorrent.h index 2b0c59d57..9ae290190 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -108,6 +108,8 @@ class bittorrent : public QObject{ bool isQueueingEnabled() const; int getDlTorrentPriority(QString hash) const; int getUpTorrentPriority(QString hash) const; + int getMaximumActiveDownloads() const; + int getMaximumActiveTorrents() const; bool isDownloadQueued(QString hash) const; bool isUploadQueued(QString hash) const; int loadTorrentPriority(QString hash);