From 1a010cbfc61c7823aaa35731d200362c6967b54b Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 1 Feb 2016 20:07:18 +0800 Subject: [PATCH] Fix total values for "Seeds" & "Peers" --- src/gui/torrentmodel.cpp | 4 ++-- src/gui/transferlistdelegate.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/torrentmodel.cpp b/src/gui/torrentmodel.cpp index 67f0bad0d..451a5a02d 100644 --- a/src/gui/torrentmodel.cpp +++ b/src/gui/torrentmodel.cpp @@ -185,9 +185,9 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const case TR_STATUS: return static_cast(torrent->state()); case TR_SEEDS: - return (role == Qt::DisplayRole) ? torrent->seedsCount() : torrent->completeCount(); + return (role == Qt::DisplayRole) ? torrent->seedsCount() : torrent->totalSeedsCount(); case TR_PEERS: - return (role == Qt::DisplayRole) ? (torrent->peersCount() - torrent->seedsCount()) : torrent->incompleteCount(); + return (role == Qt::DisplayRole) ? torrent->leechsCount() : torrent->totalLeechersCount(); case TR_DLSPEED: return torrent->downloadPayloadRate(); case TR_UPSPEED: diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index c2c1a6aa5..9ab172418 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -86,11 +86,11 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem } case TorrentModel::TR_SEEDS: case TorrentModel::TR_PEERS: { - QString display = index.data().toString(); + qlonglong value = index.data().toLongLong(); qlonglong total = index.data(Qt::UserRole).toLongLong(); - // Scrape was successful, we have total values - if (total > 0) - display += " (" + QString::number(total) + ")"; + if (hideValues && (!value && !total)) + break; + QString display = QString::number(value) + " (" + QString::number(total) + ")"; opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; QItemDelegate::drawDisplay(painter, opt, opt.rect, display); break;