diff --git a/src/core/qtlibtorrent/torrentmodel.cpp b/src/core/qtlibtorrent/torrentmodel.cpp index e719a086d..ad8157b36 100644 --- a/src/core/qtlibtorrent/torrentmodel.cpp +++ b/src/core/qtlibtorrent/torrentmodel.cpp @@ -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; } diff --git a/src/core/qtlibtorrent/torrentmodel.h b/src/core/qtlibtorrent/torrentmodel.h index 5cee6a0f3..2043e4cc1 100644 --- a/src/core/qtlibtorrent/torrentmodel.h +++ b/src/core/qtlibtorrent/torrentmodel.h @@ -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 { diff --git a/src/gui/torrentfilterenum.h b/src/gui/torrentfilterenum.h index cfa7ff138..8ba7cbbcd 100644 --- a/src/gui/torrentfilterenum.h +++ b/src/gui/torrentfilterenum.h @@ -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 diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index f3c3ceed8..e45636b13 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -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; diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index c38a1d0fa..710cf82b6 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -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))); } diff --git a/src/gui/transferlistsortmodel.cpp b/src/gui/transferlistsortmodel.cpp index a9fbdd84c..0ad4b0be8 100644 --- a/src/gui/transferlistsortmodel.cpp +++ b/src/gui/transferlistsortmodel.cpp @@ -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 diff --git a/src/icons.qrc b/src/icons.qrc index 5548f8a0f..860c6653d 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -363,6 +363,7 @@ icons/skin/toolbox-divider2.gif icons/skin/resumed.png icons/skin/uploading.png + icons/skin/completed.png icons/oxygen/system-log-out.png icons/oxygen/go-bottom.png icons/oxygen/go-top.png diff --git a/src/icons/skin/completed.png b/src/icons/skin/completed.png new file mode 100644 index 000000000..9ac9f164f Binary files /dev/null and b/src/icons/skin/completed.png differ