1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-23 13:04:23 +00:00

Add 'Resumed' filter

This commit is contained in:
buinsky 2015-01-29 20:30:54 +03:00
parent 0f56440dec
commit f5f9e206fb
6 changed files with 21 additions and 1 deletions

View File

@ -39,6 +39,8 @@ QTorrentFilter::QTorrentFilter(QString filter, QString label)
type_ = Completed; type_ = Completed;
else if (filter == "paused") else if (filter == "paused")
type_ = Paused; type_ = Paused;
else if (filter == "resumed")
type_ = Resumed;
else if (filter == "active") else if (filter == "active")
type_ = Active; type_ = Active;
else if (filter == "inactive") else if (filter == "inactive")
@ -57,6 +59,8 @@ bool QTorrentFilter::apply(const QTorrentHandle& h) const
return isTorrentCompleted(h); return isTorrentCompleted(h);
case Paused: case Paused:
return isTorrentPaused(h); return isTorrentPaused(h);
case Resumed:
return isTorrentResumed(h);
case Active: case Active:
return isTorrentActive(h); return isTorrentActive(h);
case Inactive: case Inactive:
@ -98,6 +102,14 @@ bool QTorrentFilter::isTorrentPaused(const QTorrentHandle &h) const
|| state == QTorrentState::Error; || state == QTorrentState::Error;
} }
bool QTorrentFilter::isTorrentResumed(const QTorrentHandle &h) const
{
const QTorrentState state = h.torrentState();
return state != QTorrentState::PausedUploading
&& state != QTorrentState::PausedDownloading;
}
bool QTorrentFilter::isTorrentActive(const QTorrentHandle &h) const bool QTorrentFilter::isTorrentActive(const QTorrentHandle &h) const
{ {
const QTorrentState state = h.torrentState(); const QTorrentState state = h.torrentState();

View File

@ -40,6 +40,7 @@ public:
Downloading, Downloading,
Completed, Completed,
Paused, Paused,
Resumed,
Active, Active,
Inactive Inactive
}; };
@ -55,6 +56,7 @@ private:
bool isTorrentDownloading(const QTorrentHandle &h) const; bool isTorrentDownloading(const QTorrentHandle &h) const;
bool isTorrentCompleted(const QTorrentHandle &h) const; bool isTorrentCompleted(const QTorrentHandle &h) const;
bool isTorrentPaused(const QTorrentHandle &h) const; bool isTorrentPaused(const QTorrentHandle &h) const;
bool isTorrentResumed(const QTorrentHandle &h) const;
bool isTorrentActive(const QTorrentHandle &h) const; bool isTorrentActive(const QTorrentHandle &h) const;
bool isTorrentInactive(const QTorrentHandle &h) const; bool isTorrentInactive(const QTorrentHandle &h) const;
bool torrentHasLabel(const QTorrentHandle &h) const; bool torrentHasLabel(const QTorrentHandle &h) const;

View File

@ -212,7 +212,7 @@ void WebApplication::action_public_images()
} }
// GET params: // GET params:
// - filter (string): all, downloading, completed, paused, active, inactive // - filter (string): all, downloading, completed, paused, resumed, active, inactive
// - label (string): torrent label for filtering by it (empty string means "unlabeled"; no "label" param presented means "any label") // - 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 // - sort (string): name of column for sorting by its value
// - reverse (bool): enable reverse sorting // - reverse (bool): enable reverse sorting

View File

@ -2,6 +2,7 @@
<li id="all_filter"><a href="#" onclick="setFilter('all');return false;"><img src="images/skin/filterall.png"/>QBT_TR(All)QBT_TR</a></li> <li id="all_filter"><a href="#" onclick="setFilter('all');return false;"><img src="images/skin/filterall.png"/>QBT_TR(All)QBT_TR</a></li>
<li id="downloading_filter"><a href="#" onclick="setFilter('downloading');return false;"><img src="images/skin/downloading.png"/>QBT_TR(Downloading)QBT_TR</a></li> <li id="downloading_filter"><a href="#" onclick="setFilter('downloading');return false;"><img src="images/skin/downloading.png"/>QBT_TR(Downloading)QBT_TR</a></li>
<li id="completed_filter"><a href="#" onclick="setFilter('completed');return false;"><img src="images/skin/uploading.png"/>QBT_TR(Completed)QBT_TR</a></li> <li id="completed_filter"><a href="#" onclick="setFilter('completed');return false;"><img src="images/skin/uploading.png"/>QBT_TR(Completed)QBT_TR</a></li>
<li id="resumed_filter"><a href="#" onclick="setFilter('resumed');return false;"><img src="images/skin/resumed.png"/>QBT_TR(Resumed)QBT_TR</a></li>
<li id="paused_filter"><a href="#" onclick="setFilter('paused');return false;"><img src="images/skin/paused.png"/>QBT_TR(Paused)QBT_TR</a></li> <li id="paused_filter"><a href="#" onclick="setFilter('paused');return false;"><img src="images/skin/paused.png"/>QBT_TR(Paused)QBT_TR</a></li>
<li id="active_filter"><a href="#" onclick="setFilter('active');return false;"><img src="images/skin/filteractive.png"/>QBT_TR(Active)QBT_TR</a></li> <li id="active_filter"><a href="#" onclick="setFilter('active');return false;"><img src="images/skin/filteractive.png"/>QBT_TR(Active)QBT_TR</a></li>
<li id="inactive_filter"><a href="#" onclick="setFilter('inactive');return false;"><img src="images/skin/filterinactive.png"/>QBT_TR(Inactive)QBT_TR</a></li> <li id="inactive_filter"><a href="#" onclick="setFilter('inactive');return false;"><img src="images/skin/filterinactive.png"/>QBT_TR(Inactive)QBT_TR</a></li>

View File

@ -96,6 +96,7 @@ window.addEvent('load', function () {
$("downloading_filter").removeClass("selectedFilter"); $("downloading_filter").removeClass("selectedFilter");
$("completed_filter").removeClass("selectedFilter"); $("completed_filter").removeClass("selectedFilter");
$("paused_filter").removeClass("selectedFilter"); $("paused_filter").removeClass("selectedFilter");
$("resumed_filter").removeClass("selectedFilter");
$("active_filter").removeClass("selectedFilter"); $("active_filter").removeClass("selectedFilter");
$("inactive_filter").removeClass("selectedFilter"); $("inactive_filter").removeClass("selectedFilter");
$(f + "_filter").addClass("selectedFilter"); $(f + "_filter").addClass("selectedFilter");

View File

@ -261,6 +261,10 @@ var dynamicTable = new Class({
if (!~state.indexOf('paused')) if (!~state.indexOf('paused'))
return false; return false;
break; break;
case 'resumed':
if (~state.indexOf('paused'))
return false;
break;
case 'active': case 'active':
if ((state != 'uploading') && (state != 'downloading')) if ((state != 'uploading') && (state != 'downloading'))
return false; return false;