mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Move "torrent status report" functionality out of Session class
This commit is contained in:
parent
9968eb53b2
commit
418164bee4
3 changed files with 41 additions and 49 deletions
|
@ -1796,11 +1796,6 @@ QHash<InfoHash, TorrentHandle *> Session::torrents() const
|
|||
return m_torrents;
|
||||
}
|
||||
|
||||
TorrentStatusReport Session::torrentStatusReport() const
|
||||
{
|
||||
return m_torrentStatusReport;
|
||||
}
|
||||
|
||||
bool Session::addTorrent(const QString &source, const AddTorrentParams ¶ms)
|
||||
{
|
||||
// `source`: .torrent file path/url or magnet uri
|
||||
|
@ -4404,26 +4399,6 @@ void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
|
|||
updatedTorrents.push_back(torrent);
|
||||
}
|
||||
|
||||
m_torrentStatusReport = TorrentStatusReport();
|
||||
for (const TorrentHandle *torrent : asConst(m_torrents)) {
|
||||
if (torrent->isDownloading())
|
||||
++m_torrentStatusReport.nbDownloading;
|
||||
if (torrent->isUploading())
|
||||
++m_torrentStatusReport.nbSeeding;
|
||||
if (torrent->isCompleted())
|
||||
++m_torrentStatusReport.nbCompleted;
|
||||
if (torrent->isPaused())
|
||||
++m_torrentStatusReport.nbPaused;
|
||||
if (torrent->isResumed())
|
||||
++m_torrentStatusReport.nbResumed;
|
||||
if (torrent->isActive())
|
||||
++m_torrentStatusReport.nbActive;
|
||||
if (torrent->isInactive())
|
||||
++m_torrentStatusReport.nbInactive;
|
||||
if (torrent->isErrored())
|
||||
++m_torrentStatusReport.nbErrored;
|
||||
}
|
||||
|
||||
emit torrentsUpdated(updatedTorrents);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue