Browse Source

Add Sent and Received information to the debug menu peer list

0.16
Aaron Golliver 7 years ago
parent
commit
6b1891e2c0
  1. 20
      src/qt/peertablemodel.cpp
  2. 6
      src/qt/peertablemodel.h

20
src/qt/peertablemodel.cpp

@ -33,6 +33,10 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine
return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0; return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0;
case PeerTableModel::Ping: case PeerTableModel::Ping:
return pLeft->dMinPing < pRight->dMinPing; return pLeft->dMinPing < pRight->dMinPing;
case PeerTableModel::Sent:
return pLeft->nSendBytes < pRight->nSendBytes;
case PeerTableModel::Received:
return pLeft->nRecvBytes < pRight->nRecvBytes;
} }
return false; return false;
@ -114,7 +118,7 @@ PeerTableModel::PeerTableModel(ClientModel *parent) :
clientModel(parent), clientModel(parent),
timer(0) timer(0)
{ {
columns << tr("NodeId") << tr("Node/Service") << tr("User Agent") << tr("Ping"); columns << tr("NodeId") << tr("Node/Service") << tr("Ping") << tr("Sent") << tr("Received") << tr("User Agent");
priv.reset(new PeerTablePriv()); priv.reset(new PeerTablePriv());
// default to unsorted // default to unsorted
priv->sortColumn = -1; priv->sortColumn = -1;
@ -173,10 +177,20 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
return QString::fromStdString(rec->nodeStats.cleanSubVer); return QString::fromStdString(rec->nodeStats.cleanSubVer);
case Ping: case Ping:
return GUIUtil::formatPingTime(rec->nodeStats.dMinPing); return GUIUtil::formatPingTime(rec->nodeStats.dMinPing);
case Sent:
return GUIUtil::formatBytes(rec->nodeStats.nSendBytes);
case Received:
return GUIUtil::formatBytes(rec->nodeStats.nRecvBytes);
} }
} else if (role == Qt::TextAlignmentRole) { } else if (role == Qt::TextAlignmentRole) {
if (index.column() == Ping) switch (index.column()) {
return (QVariant)(Qt::AlignRight | Qt::AlignVCenter); case Ping:
case Sent:
case Received:
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
default:
return QVariant();
}
} }
return QVariant(); return QVariant();

6
src/qt/peertablemodel.h

@ -55,8 +55,10 @@ public:
enum ColumnIndex { enum ColumnIndex {
NetNodeId = 0, NetNodeId = 0,
Address = 1, Address = 1,
Subversion = 2, Ping = 2,
Ping = 3 Sent = 3,
Received = 4,
Subversion = 5
}; };
/** @name Methods overridden from QAbstractTableModel /** @name Methods overridden from QAbstractTableModel

Loading…
Cancel
Save