Skip to content

Commit 816fc10

Browse files
committed
gui: add Connection Type column to peers window
1 parent 47d35e8 commit 816fc10

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/qt/peertablemodel.cpp

+5
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);
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

+7-6
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ class PeerTableModel : public QAbstractTableModel
6161
NetNodeId = 0,
6262
Address = 1,
6363
Direction = 2,
64-
Network = 3,
65-
Ping = 4,
66-
Sent = 5,
67-
Received = 6,
68-
Subversion = 7
64+
ConnectionType = 3,
65+
Network = 4,
66+
Ping = 5,
67+
Sent = 6,
68+
Received = 7,
69+
Subversion = 8
6970
};
7071

7172
/** @name Methods overridden from QAbstractTableModel
@@ -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)