mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Merge pull request #2140 from sorokin/fix-torrent-removal
Fix torrent removal. Closes #2132
This commit is contained in:
commit
6d64f2430c
@ -821,8 +821,6 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
|
||||
else
|
||||
addConsoleMessage(tr("'%1' was removed from transfer list.", "'xxx.avi' was removed...").arg(fileName));
|
||||
qDebug("Torrent deleted.");
|
||||
emit deletedTorrent(hash);
|
||||
qDebug("Deleted signal emitted.");
|
||||
}
|
||||
|
||||
void QBtSession::pauseAllTorrents() {
|
||||
|
@ -272,7 +272,6 @@ private slots:
|
||||
|
||||
signals:
|
||||
void addedTorrent(const QTorrentHandle& h);
|
||||
void deletedTorrent(const QString &hash);
|
||||
void torrentAboutToBeRemoved(const QTorrentHandle &h);
|
||||
void pausedTorrent(const QTorrentHandle& h);
|
||||
void resumedTorrent(const QTorrentHandle& h);
|
||||
|
@ -331,7 +331,6 @@ void TorrentModel::populate() {
|
||||
// Listen for torrent changes
|
||||
connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString)));
|
||||
connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), SLOT(handleFinishedTorrent(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(resumedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
|
||||
@ -440,18 +439,6 @@ void TorrentModel::addTorrent(const QTorrentHandle &h)
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentModel::removeTorrent(const QString &hash)
|
||||
{
|
||||
const int row = torrentRow(hash);
|
||||
qDebug() << Q_FUNC_INFO << hash << row;
|
||||
if (row >= 0) {
|
||||
beginRemoveTorrent(row);
|
||||
delete m_torrents[row];
|
||||
m_torrents.removeAt(row);
|
||||
endRemoveTorrent();
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentModel::beginInsertTorrent(int row)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
@ -578,8 +565,14 @@ QString TorrentModel::torrentHash(int row) const
|
||||
void TorrentModel::handleTorrentAboutToBeRemoved(const QTorrentHandle &h)
|
||||
{
|
||||
const int row = torrentRow(h.hash());
|
||||
qDebug() << Q_FUNC_INFO << row;
|
||||
if (row >= 0) {
|
||||
emit torrentAboutToBeRemoved(m_torrents.at(row));
|
||||
|
||||
beginRemoveTorrent(row);
|
||||
delete m_torrents[row];
|
||||
m_torrents.removeAt(row);
|
||||
endRemoveTorrent();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,6 @@ signals:
|
||||
|
||||
private slots:
|
||||
void addTorrent(const QTorrentHandle& h);
|
||||
void removeTorrent(const QString &hash);
|
||||
void handleTorrentUpdate(const QTorrentHandle &h);
|
||||
void handleFinishedTorrent(const QTorrentHandle& h);
|
||||
void notifyTorrentChanged(int row);
|
||||
|
@ -117,7 +117,7 @@ private:
|
||||
TorrentSpeedMonitor::TorrentSpeedMonitor(QBtSession* session)
|
||||
: m_session(session)
|
||||
{
|
||||
connect(m_session, SIGNAL(deletedTorrent(QString)), SLOT(removeSamples(QString)));
|
||||
connect(m_session, SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(removeSamples(QTorrentHandle)));
|
||||
connect(m_session, SIGNAL(pausedTorrent(QTorrentHandle)), SLOT(removeSamples(QTorrentHandle)));
|
||||
connect(m_session, SIGNAL(statsReceived(libtorrent::stats_alert)), SLOT(statsReceived(libtorrent::stats_alert)));
|
||||
}
|
||||
@ -143,11 +143,6 @@ Sample<qreal> SpeedSample::average() const
|
||||
return Sample<qreal>(m_sum) * (1. / m_speedSamples.size());
|
||||
}
|
||||
|
||||
void TorrentSpeedMonitor::removeSamples(const QString &hash)
|
||||
{
|
||||
m_samples.remove(hash);
|
||||
}
|
||||
|
||||
void TorrentSpeedMonitor::removeSamples(const QTorrentHandle& h) {
|
||||
try {
|
||||
m_samples.remove(h.hash());
|
||||
|
@ -52,7 +52,6 @@ public:
|
||||
|
||||
private slots:
|
||||
void statsReceived(const libtorrent::stats_alert& stats);
|
||||
void removeSamples(const QString& hash);
|
||||
void removeSamples(const QTorrentHandle& h);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user