Browse Source

Fix total values for "Seeds" & "Peers"

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
1a010cbfc6
  1. 4
      src/gui/torrentmodel.cpp
  2. 8
      src/gui/transferlistdelegate.cpp

4
src/gui/torrentmodel.cpp

@ -185,9 +185,9 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const
case TR_STATUS: case TR_STATUS:
return static_cast<int>(torrent->state()); return static_cast<int>(torrent->state());
case TR_SEEDS: case TR_SEEDS:
return (role == Qt::DisplayRole) ? torrent->seedsCount() : torrent->completeCount(); return (role == Qt::DisplayRole) ? torrent->seedsCount() : torrent->totalSeedsCount();
case TR_PEERS: case TR_PEERS:
return (role == Qt::DisplayRole) ? (torrent->peersCount() - torrent->seedsCount()) : torrent->incompleteCount(); return (role == Qt::DisplayRole) ? torrent->leechsCount() : torrent->totalLeechersCount();
case TR_DLSPEED: case TR_DLSPEED:
return torrent->downloadPayloadRate(); return torrent->downloadPayloadRate();
case TR_UPSPEED: case TR_UPSPEED:

8
src/gui/transferlistdelegate.cpp

@ -86,11 +86,11 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
} }
case TorrentModel::TR_SEEDS: case TorrentModel::TR_SEEDS:
case TorrentModel::TR_PEERS: { case TorrentModel::TR_PEERS: {
QString display = index.data().toString(); qlonglong value = index.data().toLongLong();
qlonglong total = index.data(Qt::UserRole).toLongLong(); qlonglong total = index.data(Qt::UserRole).toLongLong();
// Scrape was successful, we have total values if (hideValues && (!value && !total))
if (total > 0) break;
display += " (" + QString::number(total) + ")"; QString display = QString::number(value) + " (" + QString::number(total) + ")";
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
QItemDelegate::drawDisplay(painter, opt, opt.rect, display); QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
break; break;

Loading…
Cancel
Save