Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
peertablesortproxy.cpp
Go to the documentation of this file.
1// Copyright (c) 2020-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
6
7#include <qt/peertablemodel.h>
8#include <util/check.h>
9
10#include <QModelIndex>
11#include <QString>
12#include <QVariant>
13
15 : QSortFilterProxyModel(parent)
16{
17}
18
20{
23
24 switch (static_cast<PeerTableModel::ColumnIndex>(left_index.column())) {
26 return left_stats.nodeid < right_stats.nodeid;
28 return left_stats.m_connected > right_stats.m_connected;
30 return left_stats.m_addr_name.compare(right_stats.m_addr_name) < 0;
32 return left_stats.fInbound > right_stats.fInbound; // default sort Inbound, then Outbound
34 return left_stats.m_conn_type < right_stats.m_conn_type;
36 return left_stats.m_network < right_stats.m_network;
38 return left_stats.m_min_ping_time < right_stats.m_min_ping_time;
40 return left_stats.nSendBytes < right_stats.nSendBytes;
42 return left_stats.nRecvBytes < right_stats.nRecvBytes;
44 return left_stats.cleanSubVer.compare(right_stats.cleanSubVer) < 0;
45 } // no default case, so the compiler can warn about missing cases
46 assert(false);
47}
#define Assert(val)
Identity function.
Definition check.h:113
NodeId nodeid
Definition net.h:194
PeerTableSortProxy(QObject *parent=nullptr)
bool lessThan(const QModelIndex &left_index, const QModelIndex &right_index) const override
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:73
assert(!tx.IsCoinBase())