mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
gui: add Age column to peers tab
Co-authored-by: Jon Atack <jon@atack.com>
This commit is contained in:
@@ -71,6 +71,8 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const
|
||||
switch (column) {
|
||||
case NetNodeId:
|
||||
return (qint64)rec->nodeStats.nodeid;
|
||||
case Age:
|
||||
return GUIUtil::FormatPeerAge(rec->nodeStats.m_connected);
|
||||
case Address:
|
||||
return QString::fromStdString(rec->nodeStats.m_addr_name);
|
||||
case Direction:
|
||||
@@ -96,6 +98,7 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const
|
||||
} else if (role == Qt::TextAlignmentRole) {
|
||||
switch (column) {
|
||||
case NetNodeId:
|
||||
case Age:
|
||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||
case Address:
|
||||
return {};
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
|
||||
enum ColumnIndex {
|
||||
NetNodeId = 0,
|
||||
Age,
|
||||
Address,
|
||||
Direction,
|
||||
ConnectionType,
|
||||
@@ -82,6 +83,9 @@ private:
|
||||
/*: Title of Peers Table column which contains a
|
||||
unique number used to identify a connection. */
|
||||
tr("Peer"),
|
||||
/*: Title of Peers Table column which indicates the duration (length of time)
|
||||
since the peer connection started. */
|
||||
tr("Age"),
|
||||
/*: Title of Peers Table column which contains the
|
||||
IP/Onion/I2P address of the connected peer. */
|
||||
tr("Address"),
|
||||
|
||||
@@ -24,6 +24,8 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd
|
||||
switch (static_cast<PeerTableModel::ColumnIndex>(left_index.column())) {
|
||||
case PeerTableModel::NetNodeId:
|
||||
return left_stats.nodeid < right_stats.nodeid;
|
||||
case PeerTableModel::Age:
|
||||
return left_stats.m_connected > right_stats.m_connected;
|
||||
case PeerTableModel::Address:
|
||||
return left_stats.m_addr_name.compare(right_stats.m_addr_name) < 0;
|
||||
case PeerTableModel::Direction:
|
||||
|
||||
Reference in New Issue
Block a user