Browse Source

Correctly update the total number of torrents when a torrent is automatically removed

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
080a36de5f
  1. 8
      src/transferlistwidget.cpp
  2. 1
      src/transferlistwidget.h

8
src/transferlistwidget.cpp

@ -141,6 +141,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, QBtSes @@ -141,6 +141,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, QBtSes
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)));
@ -256,6 +257,13 @@ void TransferListWidget::pauseTorrent(QTorrentHandle &h) { @@ -256,6 +257,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));

1
src/transferlistwidget.h

@ -103,6 +103,7 @@ protected: @@ -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);

Loading…
Cancel
Save