Add filter "Checking" to side panel (#15166)

This commit is contained in:
AbeniMatteo
2021-07-16 13:08:10 +02:00
committed by GitHub
parent 933e56494c
commit e5943b64c1
6 changed files with 23 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ const TorrentFilter TorrentFilter::InactiveTorrent(TorrentFilter::Inactive);
const TorrentFilter TorrentFilter::StalledTorrent(TorrentFilter::Stalled);
const TorrentFilter TorrentFilter::StalledUploadingTorrent(TorrentFilter::StalledUploading);
const TorrentFilter TorrentFilter::StalledDownloadingTorrent(TorrentFilter::StalledDownloading);
const TorrentFilter TorrentFilter::CheckingTorrent(TorrentFilter::Checking);
const TorrentFilter TorrentFilter::ErroredTorrent(TorrentFilter::Errored);
using BitTorrent::Torrent;
@@ -101,6 +102,8 @@ bool TorrentFilter::setTypeByName(const QString &filter)
type = StalledUploading;
else if (filter == "stalled_downloading")
type = StalledDownloading;
else if (filter == "checking")
type = Checking;
else if (filter == "errored")
type = Errored;
@@ -180,6 +183,10 @@ bool TorrentFilter::matchState(const BitTorrent::Torrent *const torrent) const
return torrent->state() == BitTorrent::TorrentState::StalledUploading;
case StalledDownloading:
return torrent->state() == BitTorrent::TorrentState::StalledDownloading;
case Checking:
return (torrent->state() == BitTorrent::TorrentState::CheckingUploading)
|| (torrent->state() == BitTorrent::TorrentState::CheckingDownloading)
|| (torrent->state() == BitTorrent::TorrentState::CheckingResumeData);
case Errored:
return torrent->isErrored();
default: // All

View File

@@ -56,6 +56,7 @@ public:
Stalled,
StalledUploading,
StalledDownloading,
Checking,
Errored
};
@@ -74,6 +75,7 @@ public:
static const TorrentFilter StalledTorrent;
static const TorrentFilter StalledUploadingTorrent;
static const TorrentFilter StalledDownloadingTorrent;
static const TorrentFilter CheckingTorrent;
static const TorrentFilter ErroredTorrent;
TorrentFilter() = default;