diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-02-22 09:52:02 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-03-07 16:58:11 +0200 |
commit | 9a9f180df0d51396fee2468681df6dd935b0248e (patch) | |
tree | 635435f3f33317ee60b5741975c4d753e270bcd1 /src/qt/peertablemodel.cpp | |
parent | 778a64af209e4fa692a3aca8376ba1bd5e1af881 (diff) | |
download | bitcoin-9a9f180df0d51396fee2468681df6dd935b0248e.tar.xz |
qt, refactor: Drop no longer used PeerTableModel::sort function
Diffstat (limited to 'src/qt/peertablemodel.cpp')
-rw-r--r-- | src/qt/peertablemodel.cpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index 387f5d5b37..63bfe5f570 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -11,49 +11,15 @@ #include <utility> -#include <QDebug> #include <QList> #include <QTimer> -bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const -{ - const CNodeStats *pLeft = &(left.nodeStats); - const CNodeStats *pRight = &(right.nodeStats); - - if (order == Qt::DescendingOrder) - std::swap(pLeft, pRight); - - switch (static_cast<PeerTableModel::ColumnIndex>(column)) { - case PeerTableModel::NetNodeId: - return pLeft->nodeid < pRight->nodeid; - case PeerTableModel::Address: - return pLeft->addrName.compare(pRight->addrName) < 0; - case PeerTableModel::ConnectionType: - return pLeft->m_conn_type < pRight->m_conn_type; - case PeerTableModel::Network: - return pLeft->m_network < pRight->m_network; - case PeerTableModel::Ping: - return pLeft->m_min_ping_time < pRight->m_min_ping_time; - case PeerTableModel::Sent: - return pLeft->nSendBytes < pRight->nSendBytes; - case PeerTableModel::Received: - return pLeft->nRecvBytes < pRight->nRecvBytes; - case PeerTableModel::Subversion: - return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0; - } // no default case, so the compiler can warn about missing cases - assert(false); -} - // private implementation class PeerTablePriv { public: /** Local cache of peer information */ QList<CNodeCombinedStats> cachedNodeStats; - /** Column to sort nodes by (default to unsorted) */ - int sortColumn{-1}; - /** Order (ascending or descending) to sort nodes by */ - Qt::SortOrder sortOrder; /** Index of rows by node ID */ std::map<NodeId, int> mapNodeRows; @@ -76,10 +42,6 @@ public: } } - if (sortColumn >= 0) - // sort cacheNodeStats (use stable sort to prevent rows jumping around unnecessarily) - std::stable_sort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder)); - // build index map mapNodeRows.clear(); int row = 0; @@ -245,10 +207,3 @@ int PeerTableModel::getRowByNodeId(NodeId nodeid) return it->second; } - -void PeerTableModel::sort(int column, Qt::SortOrder order) -{ - priv->sortColumn = column; - priv->sortOrder = order; - refresh(); -} |