Skip to content

Commit 9f76ba6

Browse files
committed
gui: add Connection Type column to peers window
1 parent 6578183 commit 9f76ba6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/qt/peertablemodel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine
3131
return pLeft->addrName.compare(pRight->addrName) < 0;
3232
case PeerTableModel::Direction:
3333
return pLeft->fInbound > pRight->fInbound;
34+
case PeerTableModel::ConnectionType:
35+
return pLeft->m_conn_type < pRight->m_conn_type;
3436
case PeerTableModel::Network:
3537
return pLeft->m_network < pRight->m_network;
3638
case PeerTableModel::Ping:
@@ -166,6 +168,8 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
166168
return QString::fromStdString(rec->nodeStats.addrName);
167169
case Direction:
168170
return QString(rec->nodeStats.fInbound ? "Inbound" : "Outbound");
171+
case ConnectionType:
172+
return GUIUtil::ConnectionTypeToShortQString(rec->nodeStats.m_conn_type, rec->nodeStats.fRelayTxes);
169173
case Network:
170174
return GUIUtil::NetworkToQString(rec->nodeStats.m_network);
171175
case Ping:
@@ -180,6 +184,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
180184
} else if (role == Qt::TextAlignmentRole) {
181185
switch (index.column()) {
182186
case Direction:
187+
case ConnectionType:
183188
case Network:
184189
return QVariant(Qt::AlignCenter);
185190
case Ping:

src/qt/peertablemodel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class PeerTableModel : public QAbstractTableModel
6161
NetNodeId = 0,
6262
Address,
6363
Direction,
64+
ConnectionType,
6465
Network,
6566
Ping,
6667
Sent,
@@ -84,7 +85,7 @@ public Q_SLOTS:
8485

8586
private:
8687
interfaces::Node& m_node;
87-
const QStringList columns{tr("Peer Id"), tr("Address"), tr("Direction"), tr("Network"), tr("Ping"), tr("Sent"), tr("Received"), tr("User Agent")};
88+
const QStringList columns{tr("Peer Id"), tr("Address"), tr("Direction"), tr("Type"), tr("Network"), tr("Ping"), tr("Sent"), tr("Received"), tr("User Agent")};
8889
std::unique_ptr<PeerTablePriv> priv;
8990
QTimer *timer;
9091
};

0 commit comments

Comments
 (0)