Implement separate (advanced) "Tracker status" filter

PR #23452.
This commit is contained in:
Vladimir Golovnev
2025-12-03 10:09:35 +03:00
committed by GitHub
parent f68bc3fef9
commit c45dfb6662
33 changed files with 1226 additions and 652 deletions

View File

@@ -547,7 +547,7 @@ void SyncController::maindataAction()
connect(btSession, &BitTorrent::Session::torrentsUpdated, this, &SyncController::onTorrentsUpdated);
connect(btSession, &BitTorrent::Session::trackersAdded, this, &SyncController::onTorrentTrackersChanged);
connect(btSession, &BitTorrent::Session::trackersRemoved, this, &SyncController::onTorrentTrackersChanged);
connect(btSession, &BitTorrent::Session::trackersChanged, this, &SyncController::onTorrentTrackersChanged);
connect(btSession, &BitTorrent::Session::trackersReset, this, &SyncController::onTorrentTrackersChanged);
connect(btSession, &BitTorrent::Session::trackerEntryStatusesUpdated, this, &SyncController::onTorrentTrackerEntryStatusesUpdated);
}

View File

@@ -31,7 +31,6 @@
#include <algorithm>
#include <chrono>
#include <concepts>
#include <functional>
#include <QBitArray>
#include <QFileInfo>
@@ -506,6 +505,50 @@ namespace
return nonstd::make_unexpected(TorrentsController::tr("Priority is not valid"));
return priority;
}
TorrentFilter::Status parseTorrentStatus(const QString &statusStr)
{
if (statusStr == u"downloading")
return TorrentFilter::Downloading;
if (statusStr == u"seeding")
return TorrentFilter::Seeding;
if (statusStr == u"completed")
return TorrentFilter::Completed;
if (statusStr == u"stopped")
return TorrentFilter::Stopped;
if (statusStr == u"running")
return TorrentFilter::Running;
if (statusStr == u"active")
return TorrentFilter::Active;
if (statusStr == u"inactive")
return TorrentFilter::Inactive;
if (statusStr == u"stalled")
return TorrentFilter::Stalled;
if (statusStr == u"stalled_uploading")
return TorrentFilter::StalledUploading;
if (statusStr == u"stalled_downloading")
return TorrentFilter::StalledDownloading;
if (statusStr == u"checking")
return TorrentFilter::Checking;
if (statusStr == u"moving")
return TorrentFilter::Moving;
if (statusStr == u"errored")
return TorrentFilter::Errored;
return TorrentFilter::All;
}
}
TorrentsController::TorrentsController(IApplication *app, QObject *parent)
@@ -574,7 +617,7 @@ void TorrentsController::infoAction()
idSet->insert(BitTorrent::TorrentID::fromString(hash));
}
const TorrentFilter torrentFilter {filter, idSet, category, tag, isPrivate};
const TorrentFilter torrentFilter {parseTorrentStatus(filter), idSet, category, tag, isPrivate};
QVariantList torrentList;
for (const BitTorrent::Torrent *torrent : asConst(BitTorrent::Session::instance()->torrents()))
{