diff options
| author | chromatic <[email protected]> | 2021-06-03 18:37:38 -0700 |
|---|---|---|
| committer | chromatic <[email protected]> | 2021-06-08 10:13:37 -0700 |
| commit | c5165e9b8311d07df0ea9914a04596e145a2a552 (patch) | |
| tree | 4f53c55ae76822ebaabbffe456c6f26c365d0832 /src/qt/peertablemodel.cpp | |
| parent | Merge pull request #2111 from rnicoll/contributing (diff) | |
| download | discoin-c5165e9b8311d07df0ea9914a04596e145a2a552.tar.xz discoin-c5165e9b8311d07df0ea9914a04596e145a2a552.zip | |
Add sortable sent/recv bytes to Peers debug table
See GH #2240.
Diffstat (limited to 'src/qt/peertablemodel.cpp')
| -rw-r--r-- | src/qt/peertablemodel.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index fff072fd4..f55564890 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2011-2016 The Bitcoin Core developers +// Copyright (c) 2021 The Dogecoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -33,6 +34,10 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0; case PeerTableModel::Ping: return pLeft->dMinPing < pRight->dMinPing; + case PeerTableModel::BytesSent: + return pLeft->nSendBytes < pRight->nSendBytes; + case PeerTableModel::BytesReceived: + return pLeft->nRecvBytes < pRight->nRecvBytes; } return false; @@ -114,7 +119,7 @@ PeerTableModel::PeerTableModel(ClientModel *parent) : clientModel(parent), timer(0) { - columns << tr("NodeId") << tr("Node/Service") << tr("User Agent") << tr("Ping"); + columns << tr("NodeId") << tr("Node/Service") << tr("User Agent") << tr("Ping") << tr("Bytes Sent") << tr("Bytes Received"); priv.reset(new PeerTablePriv()); // default to unsorted priv->sortColumn = -1; @@ -173,6 +178,10 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const return QString::fromStdString(rec->nodeStats.cleanSubVer); case Ping: return GUIUtil::formatPingTime(rec->nodeStats.dMinPing); + case BytesSent: + return GUIUtil::formatDataSizeValue(rec->nodeStats.nSendBytes); + case BytesReceived: + return GUIUtil::formatDataSizeValue(rec->nodeStats.nRecvBytes); } } else if (role == Qt::TextAlignmentRole) { if (index.column() == Ping) |