mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Merge 9d59ea536b
into b7a43ea118
This commit is contained in:
commit
5c22ce5b39
2 changed files with 17 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "bittorrent/infohash.h"
|
||||
#include "bittorrent/torrent.h"
|
||||
#include "bittorrent/trackerentrystatus.h"
|
||||
|
||||
const std::optional<QString> TorrentFilter::AnyCategory;
|
||||
const std::optional<TorrentIDSet> TorrentFilter::AnyID;
|
||||
|
@ -48,6 +49,7 @@ const TorrentFilter TorrentFilter::StalledDownloadingTorrent(TorrentFilter::Stal
|
|||
const TorrentFilter TorrentFilter::CheckingTorrent(TorrentFilter::Checking);
|
||||
const TorrentFilter TorrentFilter::MovingTorrent(TorrentFilter::Moving);
|
||||
const TorrentFilter TorrentFilter::ErroredTorrent(TorrentFilter::Errored);
|
||||
const TorrentFilter TorrentFilter::TrackerErroredTorrent(TorrentFilter::TrackerErrored);
|
||||
|
||||
using BitTorrent::Torrent;
|
||||
|
||||
|
@ -112,6 +114,8 @@ bool TorrentFilter::setTypeByName(const QString &filter)
|
|||
type = Moving;
|
||||
else if (filter == u"errored")
|
||||
type = Errored;
|
||||
else if (filter == u"tracker_errored")
|
||||
type = TrackerErrored;
|
||||
|
||||
return setType(type);
|
||||
}
|
||||
|
@ -204,6 +208,17 @@ bool TorrentFilter::matchState(const BitTorrent::Torrent *const torrent) const
|
|||
return torrent->isMoving();
|
||||
case Errored:
|
||||
return torrent->isErrored();
|
||||
case TrackerErrored:
|
||||
for (BitTorrent::TrackerEntryStatus &tracker : torrent->trackers())
|
||||
{
|
||||
if ((tracker.state == BitTorrent::TrackerEndpointState::NotWorking)
|
||||
|| (tracker.state == BitTorrent::TrackerEndpointState::TrackerError)
|
||||
|| (tracker.state == BitTorrent::TrackerEndpointState::Unreachable))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
Checking,
|
||||
Moving,
|
||||
Errored,
|
||||
TrackerErrored,
|
||||
|
||||
_Count
|
||||
};
|
||||
|
@ -84,6 +85,7 @@ public:
|
|||
static const TorrentFilter CheckingTorrent;
|
||||
static const TorrentFilter MovingTorrent;
|
||||
static const TorrentFilter ErroredTorrent;
|
||||
static const TorrentFilter TrackerErroredTorrent;
|
||||
|
||||
TorrentFilter() = default;
|
||||
// category & tags: pass empty string for uncategorized / untagged torrents.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue