Skip to content

Commit 5d7463a

Browse files
jonatackjarolrod
andcommitted
gui: add Direction column to peers tab
Co-authored-by: Jarol Rodriguez <jarolrod@tutanota.com>
1 parent 790f006 commit 5d7463a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/qt/peertablemodel.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,13 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
113113
case NetNodeId:
114114
return (qint64)rec->nodeStats.nodeid;
115115
case Address:
116-
// prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection
117-
return QString(rec->nodeStats.fInbound ? "" : "") + QString::fromStdString(rec->nodeStats.addrName);
116+
return QString::fromStdString(rec->nodeStats.addrName);
117+
case Direction:
118+
return QString(rec->nodeStats.fInbound ?
119+
//: An Inbound Connection from a Peer.
120+
tr("Inbound") :
121+
//: An Outbound Connection to a Peer.
122+
tr("Outbound"));
118123
case ConnectionType:
119124
return GUIUtil::ConnectionTypeToQString(rec->nodeStats.m_conn_type, /* prepend_direction */ false);
120125
case Network:
@@ -134,6 +139,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
134139
case NetNodeId:
135140
case Address:
136141
return {};
142+
case Direction:
137143
case ConnectionType:
138144
case Network:
139145
return QVariant(Qt::AlignCenter);

src/qt/peertablemodel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class PeerTableModel : public QAbstractTableModel
4747
enum ColumnIndex {
4848
NetNodeId = 0,
4949
Address,
50+
Direction,
5051
ConnectionType,
5152
Network,
5253
Ping,
@@ -81,6 +82,9 @@ public Q_SLOTS:
8182
/*: Title of Peers Table column which contains the
8283
IP/Onion/I2P address of the connected peer. */
8384
tr("Address"),
85+
/*: Title of Peers Table column which indicates the direction
86+
the peer connection was initiated from. */
87+
tr("Direction"),
8488
/*: Title of Peers Table column which describes the type of
8589
peer connection. The "type" describes why the connection exists. */
8690
tr("Type"),

src/qt/peertablesortproxy.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd
2626
return left_stats.nodeid < right_stats.nodeid;
2727
case PeerTableModel::Address:
2828
return left_stats.addrName.compare(right_stats.addrName) < 0;
29+
case PeerTableModel::Direction:
30+
return left_stats.fInbound > right_stats.fInbound;
2931
case PeerTableModel::ConnectionType:
3032
return left_stats.m_conn_type < right_stats.m_conn_type;
3133
case PeerTableModel::Network:

0 commit comments

Comments
 (0)