Skip to content

Commit 1518883

Browse files
committed
gui: add "Type" column to Peers main window
1 parent 6fc72bd commit 1518883

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/qt/peertablemodel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine
2929
return pLeft->nodeid < pRight->nodeid;
3030
case PeerTableModel::Address:
3131
return pLeft->addrName.compare(pRight->addrName) < 0;
32+
case PeerTableModel::ConnectionType:
33+
return pLeft->m_conn_type < pRight->m_conn_type;
3234
case PeerTableModel::Network:
3335
return pLeft->m_network < pRight->m_network;
3436
case PeerTableModel::Ping:
@@ -163,6 +165,8 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
163165
case Address:
164166
// prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection
165167
return QString(rec->nodeStats.fInbound ? "" : "") + QString::fromStdString(rec->nodeStats.addrName);
168+
case ConnectionType:
169+
return GUIUtil::ConnectionTypeToQString(rec->nodeStats.m_conn_type, /* prepend_direction */ false);
166170
case Network:
167171
return GUIUtil::NetworkToQString(rec->nodeStats.m_network);
168172
case Ping:
@@ -176,6 +180,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
176180
}
177181
} else if (role == Qt::TextAlignmentRole) {
178182
switch (index.column()) {
183+
case ConnectionType:
179184
case Network:
180185
return QVariant(Qt::AlignCenter);
181186
case Ping:

src/qt/peertablemodel.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ class PeerTableModel : public QAbstractTableModel
5959

6060
enum ColumnIndex {
6161
NetNodeId = 0,
62-
Address = 1,
63-
Network = 2,
64-
Ping = 3,
65-
Sent = 4,
66-
Received = 5,
67-
Subversion = 6
62+
Address,
63+
ConnectionType,
64+
Network,
65+
Ping,
66+
Sent,
67+
Received,
68+
Subversion
6869
};
6970

7071
enum {
@@ -87,7 +88,7 @@ public Q_SLOTS:
8788

8889
private:
8990
interfaces::Node& m_node;
90-
const QStringList columns{tr("Peer Id"), tr("Address"), tr("Network"), tr("Ping"), tr("Sent"), tr("Received"), tr("User Agent")};
91+
const QStringList columns{tr("Peer Id"), tr("Address"), tr("Type"), tr("Network"), tr("Ping"), tr("Sent"), tr("Received"), tr("User Agent")};
9192
std::unique_ptr<PeerTablePriv> priv;
9293
QTimer *timer;
9394
};

0 commit comments

Comments
 (0)