diff --git a/src/webui/qtorrentfilter.cpp b/src/webui/qtorrentfilter.cpp index 2c4ac2f6c..8a661bb6f 100644 --- a/src/webui/qtorrentfilter.cpp +++ b/src/webui/qtorrentfilter.cpp @@ -35,6 +35,8 @@ QTorrentFilter::QTorrentFilter(QString filter, QString label) { if (filter == "downloading") type_ = Downloading; + else if (filter == "seeding") + type_ = Seeding; else if (filter == "completed") type_ = Completed; else if (filter == "paused") @@ -55,6 +57,8 @@ bool QTorrentFilter::apply(const QTorrentHandle& h) const switch (type_) { case Downloading: return isTorrentDownloading(h); + case Seeding: + return isTorrentSeeding(h); case Completed: return isTorrentCompleted(h); case Paused: @@ -82,6 +86,16 @@ bool QTorrentFilter::isTorrentDownloading(const QTorrentHandle &h) const || state == QTorrentState::Error; } +bool QTorrentFilter::isTorrentSeeding(const QTorrentHandle &h) const +{ + const QTorrentState state = h.torrentState(); + + return state == QTorrentState::Uploading + || state == QTorrentState::StalledUploading + || state == QTorrentState::CheckingUploading + || state == QTorrentState::QueuedUploading; +} + bool QTorrentFilter::isTorrentCompleted(const QTorrentHandle &h) const { const QTorrentState state = h.torrentState(); @@ -97,8 +111,7 @@ bool QTorrentFilter::isTorrentPaused(const QTorrentHandle &h) const { const QTorrentState state = h.torrentState(); - return state == QTorrentState::PausedDownloading - || state == QTorrentState::PausedUploading + return state == QTorrentState::PausedUploading || state == QTorrentState::Error; } diff --git a/src/webui/qtorrentfilter.h b/src/webui/qtorrentfilter.h index 10e2bf2c0..dd399dadd 100644 --- a/src/webui/qtorrentfilter.h +++ b/src/webui/qtorrentfilter.h @@ -38,6 +38,7 @@ public: { All, Downloading, + Seeding, Completed, Paused, Resumed, @@ -54,6 +55,7 @@ private: QString label_; bool isTorrentDownloading(const QTorrentHandle &h) const; + bool isTorrentSeeding(const QTorrentHandle &h) const; bool isTorrentCompleted(const QTorrentHandle &h) const; bool isTorrentPaused(const QTorrentHandle &h) const; bool isTorrentResumed(const QTorrentHandle &h) const; diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index f1ce1e3de..50e833f06 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -213,7 +213,7 @@ void WebApplication::action_public_images() } // GET params: -// - filter (string): all, downloading, completed, paused, resumed, active, inactive +// - filter (string): all, downloading, seeding, completed, paused, resumed, active, inactive // - label (string): torrent label for filtering by it (empty string means "unlabeled"; no "label" param presented means "any label") // - sort (string): name of column for sorting by its value // - reverse (bool): enable reverse sorting diff --git a/src/webui/www/public/filters.html b/src/webui/www/public/filters.html index 1270f4fef..a7089c75f 100644 --- a/src/webui/www/public/filters.html +++ b/src/webui/www/public/filters.html @@ -1,7 +1,8 @@