From fb6bc6b5e15316fd07310f2b1c9fde876176ff23 Mon Sep 17 00:00:00 2001 From: wodry Date: Sun, 8 Aug 2021 08:51:04 +0200 Subject: [PATCH] Add inbound/outbound arrow prefix to addrName to include it in sorting --- src/qt/peertablesortproxy.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qt/peertablesortproxy.cpp b/src/qt/peertablesortproxy.cpp index 78932da8d48..aec7b63e160 100644 --- a/src/qt/peertablesortproxy.cpp +++ b/src/qt/peertablesortproxy.cpp @@ -21,11 +21,15 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd const CNodeStats left_stats = Assert(sourceModel()->data(left_index, PeerTableModel::StatsRole).value())->nodeStats; const CNodeStats right_stats = Assert(sourceModel()->data(right_index, PeerTableModel::StatsRole).value())->nodeStats; + // Add inbound/outbound arrow prefix to include it in sorting Address + const std::string left_arrowAddrName = (left_stats.fInbound ? "↓ " : "↑ ") + left_stats.addrName; + const std::string right_arrowAddrName = (right_stats.fInbound ? "↓ " : "↑ ") + right_stats.addrName; + switch (static_cast(left_index.column())) { case PeerTableModel::NetNodeId: return left_stats.nodeid < right_stats.nodeid; case PeerTableModel::Address: - return left_stats.addrName.compare(right_stats.addrName) < 0; + return left_arrowAddrName.compare(right_arrowAddrName) < 0; case PeerTableModel::ConnectionType: return left_stats.m_conn_type < right_stats.m_conn_type; case PeerTableModel::Network: