From 3e783873ec831848065957b60a789e401c171e0e Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 2 Sep 2007 14:57:07 +0000 Subject: [PATCH] - BUGFIX: Made pause/resume all function affect both (dl/up) tabs when window is hidden --- TODO | 1 + src/GUI.cpp | 86 +++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index d3a95408f..24966cdb5 100644 --- a/TODO +++ b/TODO @@ -90,4 +90,5 @@ beta6->beta7 changelog: - BUGFIX: Forgot to remove *.pyc files when uninstalling a search plugin - BUGFIX: Fixed drag'n drop on non-KDE systems - BUGFIX: Fixed log context menu position +- BUGFIX: Made pause/resume all function affect both (dl/up) tabs when window is hidden - COSMETIC: Improved some icons diff --git a/src/GUI.cpp b/src/GUI.cpp index eeafc7b9c..f55d24057 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -935,23 +935,40 @@ void GUI::togglePausedState(QString hash) { void GUI::on_actionPause_All_triggered() { bool change = false; bool inDownloadList = true; - if(tabs->currentIndex() > 1) return; - if(tabs->currentIndex() == 1) - inDownloadList = false; - QStringList hashes; - if(inDownloadList) { - hashes = BTSession->getUnfinishedTorrents(); - } else { - hashes = BTSession->getFinishedTorrents(); + bool hidden = false; + switch(getCurrentTabIndex()) { + case -1: + hidden = true; + inDownloadList = false; + break; + case 0: + break; + case 1: + inDownloadList = false; + break; + default: + return; + } + + QStringList DL_hashes; + QStringList F_hashes; + if(hidden || inDownloadList) { + DL_hashes = BTSession->getUnfinishedTorrents(); + } + if(hidden || !inDownloadList) { + F_hashes = BTSession->getFinishedTorrents(); } QString hash; - foreach(hash, hashes) { + foreach(hash, DL_hashes) { if(BTSession->pauseTorrent(hash)){ change = true; - if(inDownloadList) - downloadingTorrentTab->pauseTorrent(hash); - else - finishedTorrentTab->pauseTorrent(hash); + downloadingTorrentTab->pauseTorrent(hash); + } + } + foreach(hash, F_hashes) { + if(BTSession->pauseTorrent(hash)){ + change = true; + finishedTorrentTab->pauseTorrent(hash); } } if(change) @@ -987,23 +1004,40 @@ void GUI::on_actionPause_triggered() { void GUI::on_actionStart_All_triggered() { bool change = false; bool inDownloadList = true; - if(tabs->currentIndex() > 1) return; - if(tabs->currentIndex() == 1) - inDownloadList = false; - QStringList hashes; - if(inDownloadList) { - hashes = BTSession->getUnfinishedTorrents(); - } else { - hashes = BTSession->getFinishedTorrents(); + bool hidden = false; + switch(getCurrentTabIndex()) { + case -1: + hidden = true; + inDownloadList = false; + break; + case 0: + break; + case 1: + inDownloadList = false; + break; + default: + return; + } + + QStringList DL_hashes; + QStringList F_hashes; + if(hidden || inDownloadList) { + DL_hashes = BTSession->getUnfinishedTorrents(); + } + if(hidden || !inDownloadList) { + F_hashes = BTSession->getFinishedTorrents(); } QString hash; - foreach(hash, hashes) { + foreach(hash, DL_hashes) { if(BTSession->resumeTorrent(hash)){ change = true; - if(inDownloadList) - downloadingTorrentTab->resumeTorrent(hash); - else - finishedTorrentTab->resumeTorrent(hash); + downloadingTorrentTab->resumeTorrent(hash); + } + } + foreach(hash, F_hashes) { + if(BTSession->resumeTorrent(hash)){ + change = true; + finishedTorrentTab->resumeTorrent(hash); } } if(change)