aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2020-12-25 14:46:03 +0100
committerJon Atack <jon@atack.com>2020-12-27 14:30:24 +0100
commit05c08c696a1bc45ab28abe6f82bebbdbd6239c23 (patch)
treea474d9200f0b66463b3dc77e1a4e07c66a2cc676
parente0e55060bf697fe8b9ed43ff62383a0451e9c0ce (diff)
gui: add network column in peers tab/window
-rw-r--r--src/qt/peertablemodel.cpp16
-rw-r--r--src/qt/peertablemodel.h9
2 files changed, 16 insertions, 9 deletions
diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp
index 5220f8e138..54c9291b9d 100644
--- a/src/qt/peertablemodel.cpp
+++ b/src/qt/peertablemodel.cpp
@@ -29,14 +29,16 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine
return pLeft->nodeid < pRight->nodeid;
case PeerTableModel::Address:
return pLeft->addrName.compare(pRight->addrName) < 0;
- case PeerTableModel::Subversion:
- return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0;
+ case PeerTableModel::Network:
+ return pLeft->m_network < pRight->m_network;
case PeerTableModel::Ping:
return pLeft->m_min_ping_usec < pRight->m_min_ping_usec;
case PeerTableModel::Sent:
return pLeft->nSendBytes < pRight->nSendBytes;
case PeerTableModel::Received:
return pLeft->nRecvBytes < pRight->nRecvBytes;
+ case PeerTableModel::Subversion:
+ return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0;
}
return false;
@@ -104,7 +106,7 @@ PeerTableModel::PeerTableModel(interfaces::Node& node, QObject* parent) :
m_node(node),
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());
// set up timer for auto refresh
@@ -158,17 +160,21 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
case Address:
// 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);
- case Subversion:
- return QString::fromStdString(rec->nodeStats.cleanSubVer);
+ case Network:
+ return GUIUtil::NetworkToQString(rec->nodeStats.m_network);
case Ping:
return GUIUtil::formatPingTime(rec->nodeStats.m_min_ping_usec);
case Sent:
return GUIUtil::formatBytes(rec->nodeStats.nSendBytes);
case Received:
return GUIUtil::formatBytes(rec->nodeStats.nRecvBytes);
+ case Subversion:
+ return QString::fromStdString(rec->nodeStats.cleanSubVer);
}
} else if (role == Qt::TextAlignmentRole) {
switch (index.column()) {
+ case Network:
+ return QVariant(Qt::AlignCenter);
case Ping:
case Sent:
case Received:
diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h
index 99de772ac0..39cbe16df3 100644
--- a/src/qt/peertablemodel.h
+++ b/src/qt/peertablemodel.h
@@ -60,10 +60,11 @@ public:
enum ColumnIndex {
NetNodeId = 0,
Address = 1,
- Ping = 2,
- Sent = 3,
- Received = 4,
- Subversion = 5
+ Network = 2,
+ Ping = 3,
+ Sent = 4,
+ Received = 5,
+ Subversion = 6
};
/** @name Methods overridden from QAbstractTableModel