Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor inbound/outbound arrow prefix when sorting peer address column #400

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/qt/peertablesortproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CNodeCombinedStats*>())->nodeStats;
const CNodeStats right_stats = Assert(sourceModel()->data(right_index, PeerTableModel::StatsRole).value<CNodeCombinedStats*>())->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<PeerTableModel::ColumnIndex>(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:
Expand Down