From 4e2ebe5a6991412607c23836d1a853f4e8ae7152 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 26 Aug 2007 17:25:37 +0000 Subject: [PATCH] - Fixed torrent switching to finished tab --- src/FinishedTorrents.cpp | 5 ++++- src/GUI.cpp | 6 +----- src/downloadingTorrents.cpp | 5 ++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index 5c3d6a014..7aee49a10 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -262,7 +262,10 @@ QString FinishedTorrents::getHashFromRow(unsigned int row) const { // Will move it to download tab void FinishedTorrents::deleteTorrent(QString hash){ int row = getRowFromHash(hash); - Q_ASSERT(row != -1); + if(row == -1){ + qDebug("Torrent is not in finished list, nothing to delete"); + return; + } finishedListModel->removeRow(row); QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished"); --nbFinished; diff --git a/src/GUI.cpp b/src/GUI.cpp index 9182bf6c7..8778dcc05 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -251,11 +251,7 @@ void GUI::finishedTorrent(QTorrentHandle& h) { } if(show_msg) downloadingTorrentTab->setInfoBar(tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(fileName)); - if(BTSession->getUnfinishedTorrents().contains(hash)) { - downloadingTorrentTab->deleteTorrent(hash); - }else{ - qDebug("finished torrent %s is not in download list, nothing to do", hash.toUtf8().data()); - } + downloadingTorrentTab->deleteTorrent(hash); finishedTorrentTab->addTorrent(hash); if(show_msg && systrayIntegration && (useOSD == 1 || (useOSD == 2 && (isMinimized() || isHidden())))) { myTrayIcon->showMessage(tr("Download finished"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(fileName), QSystemTrayIcon::Information, TIME_TRAY_BALLOON); diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index 5b63c04f9..7d4041aae 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -176,7 +176,10 @@ void DownloadingTorrents::resumeTorrent(QString hash){ // Remove a torrent from the download list but NOT from the BT Session void DownloadingTorrents::deleteTorrent(QString hash) { int row = getRowFromHash(hash); - Q_ASSERT(row != -1); + if(row == -1){ + qDebug("torrent is not in download list, nothing to delete"); + return; + } DLListModel->removeRow(row); --nbTorrents; emit unfinishedTorrentsNumberChanged(nbTorrents);