mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-10 20:31:47 +00:00
parent
8420559e05
commit
f9e7345776
@ -70,6 +70,11 @@ QIcon get_stalled_uploading_icon() {
|
||||
return cached;
|
||||
}
|
||||
|
||||
QIcon get_completed_icon() {
|
||||
static QIcon cached = QIcon(":/icons/skin/completed.png");
|
||||
return cached;
|
||||
}
|
||||
|
||||
QIcon get_checking_icon() {
|
||||
static QIcon cached = QIcon(":/icons/skin/checking.png");
|
||||
return cached;
|
||||
@ -81,6 +86,16 @@ QIcon get_error_icon() {
|
||||
}
|
||||
}
|
||||
|
||||
TorrentStatusReport::TorrentStatusReport()
|
||||
: nb_downloading(0)
|
||||
, nb_seeding(0)
|
||||
, nb_completed(0)
|
||||
, nb_active(0)
|
||||
, nb_inactive(0)
|
||||
, nb_paused(0)
|
||||
{
|
||||
}
|
||||
|
||||
TorrentModelItem::TorrentModelItem(const QTorrentHandle &h)
|
||||
: m_torrent(h)
|
||||
, m_lastStatus(h.status(torrent_handle::query_accurate_download_counters))
|
||||
@ -151,8 +166,9 @@ QIcon TorrentModelItem::getIconByState(State state) {
|
||||
case STATE_SEEDING:
|
||||
return get_uploading_icon();
|
||||
case STATE_PAUSED_DL:
|
||||
case STATE_PAUSED_UP:
|
||||
return get_paused_icon();
|
||||
case STATE_PAUSED_UP:
|
||||
return get_completed_icon();
|
||||
case STATE_QUEUED_DL:
|
||||
case STATE_QUEUED_UP:
|
||||
return get_queued_icon();
|
||||
@ -549,6 +565,7 @@ TorrentStatusReport TorrentModel::getTorrentStatusReport() const
|
||||
++report.nb_downloading;
|
||||
break;
|
||||
case TorrentModelItem::STATE_PAUSED_DL:
|
||||
case TorrentModelItem::STATE_PAUSED_MISSING:
|
||||
++report.nb_paused;
|
||||
case TorrentModelItem::STATE_STALLED_DL:
|
||||
case TorrentModelItem::STATE_CHECKING_DL:
|
||||
@ -560,17 +577,16 @@ TorrentStatusReport TorrentModel::getTorrentStatusReport() const
|
||||
case TorrentModelItem::STATE_SEEDING:
|
||||
++report.nb_active;
|
||||
++report.nb_seeding;
|
||||
++report.nb_completed;
|
||||
break;
|
||||
case TorrentModelItem::STATE_PAUSED_UP:
|
||||
case TorrentModelItem::STATE_PAUSED_MISSING:
|
||||
++report.nb_paused;
|
||||
case TorrentModelItem::STATE_STALLED_UP:
|
||||
case TorrentModelItem::STATE_CHECKING_UP:
|
||||
case TorrentModelItem::STATE_QUEUED_UP: {
|
||||
case TorrentModelItem::STATE_QUEUED_UP:
|
||||
++report.nb_seeding;
|
||||
case TorrentModelItem::STATE_PAUSED_UP:
|
||||
++report.nb_completed;
|
||||
++report.nb_inactive;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -40,8 +40,13 @@
|
||||
#include "qtorrenthandle.h"
|
||||
|
||||
struct TorrentStatusReport {
|
||||
TorrentStatusReport(): nb_downloading(0), nb_seeding(0), nb_active(0), nb_inactive(0), nb_paused(0) {}
|
||||
uint nb_downloading; uint nb_seeding; uint nb_active; uint nb_inactive; uint nb_paused;
|
||||
TorrentStatusReport();
|
||||
uint nb_downloading;
|
||||
uint nb_seeding;
|
||||
uint nb_completed;
|
||||
uint nb_active;
|
||||
uint nb_inactive;
|
||||
uint nb_paused;
|
||||
};
|
||||
|
||||
class TorrentModelItem : public QObject {
|
||||
|
@ -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
|
||||
|
@ -363,6 +363,7 @@
|
||||
<file>icons/skin/toolbox-divider2.gif</file>
|
||||
<file>icons/skin/resumed.png</file>
|
||||
<file>icons/skin/uploading.png</file>
|
||||
<file>icons/skin/completed.png</file>
|
||||
<file>icons/oxygen/system-log-out.png</file>
|
||||
<file>icons/oxygen/go-bottom.png</file>
|
||||
<file>icons/oxygen/go-top.png</file>
|
||||
|
BIN
src/icons/skin/completed.png
Normal file
BIN
src/icons/skin/completed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 257 B |
Loading…
x
Reference in New Issue
Block a user