mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-24 02:06:07 +03:00
WebUI: Implement a 'Completed' status
This commit is contained in:
parent
f9e7345776
commit
e3a5ba09c4
6 changed files with 26 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<ul class="filterList">
|
||||
<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="completed_filter"><a href="#" onclick="setFilter('completed');return false;"><img src="images/skin/uploading.png"/>QBT_TR(Completed)QBT_TR</a></li>
|
||||
<li id="seeding_filter"><a href="#" onclick="setFilter('seeding');return false;"><img src="images/skin/uploading.png"/>QBT_TR(Seeding)QBT_TR</a></li>
|
||||
<li id="completed_filter"><a href="#" onclick="setFilter('completed');return false;"><img src="images/skin/completed.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="active_filter"><a href="#" onclick="setFilter('active');return false;"><img src="images/skin/filteractive.png"/>QBT_TR(Active)QBT_TR</a></li>
|
||||
|
|
|
@ -95,6 +95,7 @@ window.addEvent('load', function () {
|
|||
// Visually Select the right filter
|
||||
$("all_filter").removeClass("selectedFilter");
|
||||
$("downloading_filter").removeClass("selectedFilter");
|
||||
$("seeding_filter").removeClass("selectedFilter");
|
||||
$("completed_filter").removeClass("selectedFilter");
|
||||
$("paused_filter").removeClass("selectedFilter");
|
||||
$("resumed_filter").removeClass("selectedFilter");
|
||||
|
|
|
@ -253,12 +253,16 @@ var dynamicTable = new Class({
|
|||
if ((state != 'downloading') && !~state.indexOf('DL'))
|
||||
return false;
|
||||
break;
|
||||
case 'seeding':
|
||||
if ((state != 'uploading') && (state != 'stalledUP') && (state != 'queuedUP') && (state != 'checkingUP'))
|
||||
return false;
|
||||
break;
|
||||
case 'completed':
|
||||
if ((state != 'uploading') && !~state.indexOf('UP'))
|
||||
return false;
|
||||
break;
|
||||
case 'paused':
|
||||
if (!~state.indexOf('paused'))
|
||||
if (state != 'pausedDL')
|
||||
return false;
|
||||
break;
|
||||
case 'resumed':
|
||||
|
|
Loading…
Reference in a new issue