mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
@@ -31,7 +31,18 @@
|
||||
#ifndef TORRENTFILTERENUM_H
|
||||
#define TORRENTFILTERENUM_H
|
||||
|
||||
namespace TorrentFilter {
|
||||
enum TorrentFilter {ALL, DOWNLOADING, COMPLETED, RESUMED, PAUSED, ACTIVE, INACTIVE};
|
||||
namespace TorrentFilter
|
||||
{
|
||||
enum TorrentFilter
|
||||
{
|
||||
ALL,
|
||||
DOWNLOADING,
|
||||
SEEDING,
|
||||
COMPLETED,
|
||||
RESUMED,
|
||||
PAUSED,
|
||||
ACTIVE,
|
||||
INACTIVE
|
||||
};
|
||||
}
|
||||
#endif // TORRENTFILTERENUM_H
|
||||
|
||||
@@ -119,9 +119,11 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
|
||||
display = tr("Checking resume data", "used when loading the torrents from disk after qbt is launched. It checks the correctness of the .fastresume file. Normally it is completed in a fraction of a second, unless loading many many torrents.");
|
||||
break;
|
||||
case TorrentModelItem::STATE_PAUSED_DL:
|
||||
case TorrentModelItem::STATE_PAUSED_UP:
|
||||
display = tr("Paused");
|
||||
break;
|
||||
case TorrentModelItem::STATE_PAUSED_UP:
|
||||
display = tr("Completed");
|
||||
break;
|
||||
case TorrentModelItem::STATE_PAUSED_MISSING:
|
||||
display = tr("Missing Files");
|
||||
break;
|
||||
|
||||
@@ -105,25 +105,28 @@ StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *tr
|
||||
|
||||
// Add status filters
|
||||
QListWidgetItem *all = new QListWidgetItem(this);
|
||||
all->setData(Qt::DisplayRole, QVariant(tr("All") + " (0)"));
|
||||
all->setData(Qt::DisplayRole, QVariant(tr("All (0)", "this is for the status filter")));
|
||||
all->setData(Qt::DecorationRole, QIcon(":/icons/skin/filterall.png"));
|
||||
QListWidgetItem *downloading = new QListWidgetItem(this);
|
||||
downloading->setData(Qt::DisplayRole, QVariant(tr("Downloading") + " (0)"));
|
||||
downloading->setData(Qt::DisplayRole, QVariant(tr("Downloading (0)")));
|
||||
downloading->setData(Qt::DecorationRole, QIcon(":/icons/skin/downloading.png"));
|
||||
QListWidgetItem *seeding = new QListWidgetItem(this);
|
||||
seeding->setData(Qt::DisplayRole, QVariant(tr("Seeding (0)")));
|
||||
seeding->setData(Qt::DecorationRole, QIcon(":/icons/skin/uploading.png"));
|
||||
QListWidgetItem *completed = new QListWidgetItem(this);
|
||||
completed->setData(Qt::DisplayRole, QVariant(tr("Completed") + " (0)"));
|
||||
completed->setData(Qt::DecorationRole, QIcon(":/icons/skin/uploading.png"));
|
||||
completed->setData(Qt::DisplayRole, QVariant(tr("Completed (0)")));
|
||||
completed->setData(Qt::DecorationRole, QIcon(":/icons/skin/completed.png"));
|
||||
QListWidgetItem *resumed = new QListWidgetItem(this);
|
||||
resumed->setData(Qt::DisplayRole, QVariant(tr("Resumed") + " (0)"));
|
||||
resumed->setData(Qt::DisplayRole, QVariant(tr("Resumed (0)")));
|
||||
resumed->setData(Qt::DecorationRole, QIcon(":/icons/skin/resumed.png"));
|
||||
QListWidgetItem *paused = new QListWidgetItem(this);
|
||||
paused->setData(Qt::DisplayRole, QVariant(tr("Paused") + " (0)"));
|
||||
paused->setData(Qt::DisplayRole, QVariant(tr("Paused (0)")));
|
||||
paused->setData(Qt::DecorationRole, QIcon(":/icons/skin/paused.png"));
|
||||
QListWidgetItem *active = new QListWidgetItem(this);
|
||||
active->setData(Qt::DisplayRole, QVariant(tr("Active") + " (0)"));
|
||||
active->setData(Qt::DisplayRole, QVariant(tr("Active (0)")));
|
||||
active->setData(Qt::DecorationRole, QIcon(":/icons/skin/filteractive.png"));
|
||||
QListWidgetItem *inactive = new QListWidgetItem(this);
|
||||
inactive->setData(Qt::DisplayRole, QVariant(tr("Inactive") + " (0)"));
|
||||
inactive->setData(Qt::DisplayRole, QVariant(tr("Inactive (0)")));
|
||||
inactive->setData(Qt::DecorationRole, QIcon(":/icons/skin/filterinactive.png"));
|
||||
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
@@ -141,9 +144,10 @@ void StatusFiltersWidget::updateTorrentNumbers()
|
||||
const TorrentStatusReport report = transferList->getSourceModel()->getTorrentStatusReport();
|
||||
item(TorrentFilter::ALL)->setData(Qt::DisplayRole, QVariant(tr("All (%1)").arg(report.nb_active + report.nb_inactive)));
|
||||
item(TorrentFilter::DOWNLOADING)->setData(Qt::DisplayRole, QVariant(tr("Downloading (%1)").arg(report.nb_downloading)));
|
||||
item(TorrentFilter::COMPLETED)->setData(Qt::DisplayRole, QVariant(tr("Completed (%1)").arg(report.nb_seeding)));
|
||||
item(TorrentFilter::SEEDING)->setData(Qt::DisplayRole, QVariant(tr("Seeding (%1)").arg(report.nb_seeding)));
|
||||
item(TorrentFilter::COMPLETED)->setData(Qt::DisplayRole, QVariant(tr("Completed (%1)").arg(report.nb_completed)));
|
||||
item(TorrentFilter::PAUSED)->setData(Qt::DisplayRole, QVariant(tr("Paused (%1)").arg(report.nb_paused)));
|
||||
item(TorrentFilter::RESUMED)->setData(Qt::DisplayRole, QVariant(tr("Resumed (%1)").arg(report.nb_active + report.nb_inactive - report.nb_paused)));
|
||||
item(TorrentFilter::RESUMED)->setData(Qt::DisplayRole, QVariant(tr("Resumed (%1)").arg(report.nb_downloading + report.nb_seeding)));
|
||||
item(TorrentFilter::ACTIVE)->setData(Qt::DisplayRole, QVariant(tr("Active (%1)").arg(report.nb_active)));
|
||||
item(TorrentFilter::INACTIVE)->setData(Qt::DisplayRole, QVariant(tr("Inactive (%1)").arg(report.nb_inactive)));
|
||||
}
|
||||
|
||||
@@ -231,16 +231,20 @@ bool TransferListSortModel::matchStatusFilter(int sourceRow, const QModelIndex &
|
||||
case TorrentFilter::DOWNLOADING:
|
||||
return (state == TorrentModelItem::STATE_DOWNLOADING || state == TorrentModelItem::STATE_STALLED_DL
|
||||
|| state == TorrentModelItem::STATE_PAUSED_DL || state == TorrentModelItem::STATE_CHECKING_DL
|
||||
|| state == TorrentModelItem::STATE_QUEUED_DL || state == TorrentModelItem::STATE_DOWNLOADING_META);
|
||||
|| state == TorrentModelItem::STATE_QUEUED_DL || state == TorrentModelItem::STATE_DOWNLOADING_META
|
||||
|| state == TorrentModelItem::STATE_PAUSED_MISSING);
|
||||
|
||||
case TorrentFilter::SEEDING:
|
||||
return (state == TorrentModelItem::STATE_SEEDING || state == TorrentModelItem::STATE_STALLED_UP
|
||||
|| state == TorrentModelItem::STATE_CHECKING_UP || state == TorrentModelItem::STATE_QUEUED_UP);
|
||||
|
||||
case TorrentFilter::COMPLETED:
|
||||
return (state == TorrentModelItem::STATE_SEEDING || state == TorrentModelItem::STATE_STALLED_UP
|
||||
|| state == TorrentModelItem::STATE_PAUSED_UP || state == TorrentModelItem::STATE_CHECKING_UP
|
||||
|| state == TorrentModelItem::STATE_PAUSED_MISSING || state == TorrentModelItem::STATE_QUEUED_UP);
|
||||
|| state == TorrentModelItem::STATE_QUEUED_UP);
|
||||
|
||||
case TorrentFilter::PAUSED:
|
||||
return (state == TorrentModelItem::STATE_PAUSED_UP || state == TorrentModelItem::STATE_PAUSED_DL
|
||||
|| state == TorrentModelItem::STATE_PAUSED_MISSING);
|
||||
return (state == TorrentModelItem::STATE_PAUSED_DL || state == TorrentModelItem::STATE_PAUSED_MISSING);
|
||||
|
||||
case TorrentFilter::RESUMED:
|
||||
return (state != TorrentModelItem::STATE_PAUSED_UP && state != TorrentModelItem::STATE_PAUSED_DL
|
||||
|
||||
Reference in New Issue
Block a user