mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-24 07:51:24 +02:00
gui: add network column in peers tab/window
This commit is contained in:
parent
e0e55060bf
commit
05c08c696a
@ -29,14 +29,16 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine
|
|||||||
return pLeft->nodeid < pRight->nodeid;
|
return pLeft->nodeid < pRight->nodeid;
|
||||||
case PeerTableModel::Address:
|
case PeerTableModel::Address:
|
||||||
return pLeft->addrName.compare(pRight->addrName) < 0;
|
return pLeft->addrName.compare(pRight->addrName) < 0;
|
||||||
case PeerTableModel::Subversion:
|
case PeerTableModel::Network:
|
||||||
return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0;
|
return pLeft->m_network < pRight->m_network;
|
||||||
case PeerTableModel::Ping:
|
case PeerTableModel::Ping:
|
||||||
return pLeft->m_min_ping_usec < pRight->m_min_ping_usec;
|
return pLeft->m_min_ping_usec < pRight->m_min_ping_usec;
|
||||||
case PeerTableModel::Sent:
|
case PeerTableModel::Sent:
|
||||||
return pLeft->nSendBytes < pRight->nSendBytes;
|
return pLeft->nSendBytes < pRight->nSendBytes;
|
||||||
case PeerTableModel::Received:
|
case PeerTableModel::Received:
|
||||||
return pLeft->nRecvBytes < pRight->nRecvBytes;
|
return pLeft->nRecvBytes < pRight->nRecvBytes;
|
||||||
|
case PeerTableModel::Subversion:
|
||||||
|
return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -104,7 +106,7 @@ PeerTableModel::PeerTableModel(interfaces::Node& node, QObject* parent) :
|
|||||||
m_node(node),
|
m_node(node),
|
||||||
timer(nullptr)
|
timer(nullptr)
|
||||||
{
|
{
|
||||||
columns << tr("NodeId") << tr("Node/Service") << tr("Ping") << tr("Sent") << tr("Received") << tr("User Agent");
|
columns << tr("NodeId") << tr("Node/Service") << tr("Network") << tr("Ping") << tr("Sent") << tr("Received") << tr("User Agent");
|
||||||
priv.reset(new PeerTablePriv());
|
priv.reset(new PeerTablePriv());
|
||||||
|
|
||||||
// set up timer for auto refresh
|
// set up timer for auto refresh
|
||||||
@ -158,17 +160,21 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
|
|||||||
case Address:
|
case Address:
|
||||||
// prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection
|
// prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection
|
||||||
return QString(rec->nodeStats.fInbound ? "↓ " : "↑ ") + QString::fromStdString(rec->nodeStats.addrName);
|
return QString(rec->nodeStats.fInbound ? "↓ " : "↑ ") + QString::fromStdString(rec->nodeStats.addrName);
|
||||||
case Subversion:
|
case Network:
|
||||||
return QString::fromStdString(rec->nodeStats.cleanSubVer);
|
return GUIUtil::NetworkToQString(rec->nodeStats.m_network);
|
||||||
case Ping:
|
case Ping:
|
||||||
return GUIUtil::formatPingTime(rec->nodeStats.m_min_ping_usec);
|
return GUIUtil::formatPingTime(rec->nodeStats.m_min_ping_usec);
|
||||||
case Sent:
|
case Sent:
|
||||||
return GUIUtil::formatBytes(rec->nodeStats.nSendBytes);
|
return GUIUtil::formatBytes(rec->nodeStats.nSendBytes);
|
||||||
case Received:
|
case Received:
|
||||||
return GUIUtil::formatBytes(rec->nodeStats.nRecvBytes);
|
return GUIUtil::formatBytes(rec->nodeStats.nRecvBytes);
|
||||||
|
case Subversion:
|
||||||
|
return QString::fromStdString(rec->nodeStats.cleanSubVer);
|
||||||
}
|
}
|
||||||
} else if (role == Qt::TextAlignmentRole) {
|
} else if (role == Qt::TextAlignmentRole) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
|
case Network:
|
||||||
|
return QVariant(Qt::AlignCenter);
|
||||||
case Ping:
|
case Ping:
|
||||||
case Sent:
|
case Sent:
|
||||||
case Received:
|
case Received:
|
||||||
|
@ -60,10 +60,11 @@ public:
|
|||||||
enum ColumnIndex {
|
enum ColumnIndex {
|
||||||
NetNodeId = 0,
|
NetNodeId = 0,
|
||||||
Address = 1,
|
Address = 1,
|
||||||
Ping = 2,
|
Network = 2,
|
||||||
Sent = 3,
|
Ping = 3,
|
||||||
Received = 4,
|
Sent = 4,
|
||||||
Subversion = 5
|
Received = 5,
|
||||||
|
Subversion = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @name Methods overridden from QAbstractTableModel
|
/** @name Methods overridden from QAbstractTableModel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user