From b70cf7c04900ff38d05629af8daab8b543b58516 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 30 Oct 2010 13:59:07 +0000 Subject: [PATCH] BUGFIX: Correctly update total number of torrents when a torrent is automatically removed (closes #668726) --- Changelog | 1 + src/qtorrenthandle.cpp | 2 ++ src/src.pro | 2 +- src/transferlistwidget.cpp | 8 ++++++++ src/transferlistwidget.h | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 47d71a1bf..50202c1e2 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ - BUGFIX: Fix crash when pressing enter in save path field in torrent addition dialog - BUGFIX: Fix crash when deleting a torrent with no metadata (closes #667528) - BUGFIX: Fix possible crash on clicking a RSS article (closes #575624) + - BUGFIX: Correctly update total number of torrents when a torrent is automatically removed (closes #668726) - BUGFIX: Correctly display the hash of torrents with no metadata - BUGFIX: Elide status bar text if it is too wide diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index ab59637e4..ceb0c5719 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include "misc.h" @@ -755,6 +756,7 @@ void QTorrentHandle::add_tracker(const announce_entry& url) { } void QTorrentHandle::prioritize_first_last_piece(bool b) { + qDebug() << Q_FUNC_INFO << b; Q_ASSERT(h.is_valid()); // Detect main file int rank=0; diff --git a/src/src.pro b/src/src.pro index 1d4139149..01a931378 100644 --- a/src/src.pro +++ b/src/src.pro @@ -3,7 +3,7 @@ LANG_PATH = lang ICONS_PATH = Icons # Set the following variable to 1 to enable debug -DEBUG_MODE = 0 +DEBUG_MODE = 1 # Global TEMPLATE = app diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index f734c426b..66e75e231 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -140,6 +140,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittor connect(BTSession, SIGNAL(pausedTorrent(QTorrentHandle&)), this, SLOT(pauseTorrent(QTorrentHandle&))); connect(BTSession, SIGNAL(resumedTorrent(QTorrentHandle&)), this, SLOT(resumeTorrent(QTorrentHandle&))); connect(BTSession, SIGNAL(torrentFinishedChecking(QTorrentHandle&)), this, SLOT(updateMetadata(QTorrentHandle&))); + connect(BTSession, SIGNAL(deletedTorrent(QString)), SLOT(deleteTorrent(QString))); // Listen for list events connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(torrentDoubleClicked(QModelIndex))); @@ -255,6 +256,13 @@ void TransferListWidget::pauseTorrent(QTorrentHandle &h) { pauseTorrent(getRowFromHash(h.hash())); } +void TransferListWidget::deleteTorrent(QString hash) { + const int row = getRowFromHash(hash); + if(row >= 0) { + deleteTorrent(row, true); + } +} + void TransferListWidget::pauseTorrent(int row, bool refresh_list) { const QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(row)); listModel->setData(listModel->index(row, TR_DLSPEED), QVariant((double)0.0)); diff --git a/src/transferlistwidget.h b/src/transferlistwidget.h index 0379f5b91..1544b8f63 100644 --- a/src/transferlistwidget.h +++ b/src/transferlistwidget.h @@ -103,6 +103,7 @@ protected: protected slots: int updateTorrent(int row); + void deleteTorrent(QString hash); void deleteTorrent(int row, bool refresh_list=true); void pauseTorrent(int row, bool refresh_list=true); void resumeTorrent(int row, bool refresh_list=true);