mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +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) {
|
switch (column) {
|
||||||
case NetNodeId:
|
case NetNodeId:
|
||||||
return (qint64)rec->nodeStats.nodeid;
|
return (qint64)rec->nodeStats.nodeid;
|
||||||
|
case Age:
|
||||||
|
return GUIUtil::FormatPeerAge(rec->nodeStats.m_connected);
|
||||||
case Address:
|
case Address:
|
||||||
return QString::fromStdString(rec->nodeStats.m_addr_name);
|
return QString::fromStdString(rec->nodeStats.m_addr_name);
|
||||||
case Direction:
|
case Direction:
|
||||||
@@ -96,6 +98,7 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const
|
|||||||
} else if (role == Qt::TextAlignmentRole) {
|
} else if (role == Qt::TextAlignmentRole) {
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case NetNodeId:
|
case NetNodeId:
|
||||||
|
case Age:
|
||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
case Address:
|
case Address:
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
|
|
||||||
enum ColumnIndex {
|
enum ColumnIndex {
|
||||||
NetNodeId = 0,
|
NetNodeId = 0,
|
||||||
|
Age,
|
||||||
Address,
|
Address,
|
||||||
Direction,
|
Direction,
|
||||||
ConnectionType,
|
ConnectionType,
|
||||||
@@ -82,6 +83,9 @@ private:
|
|||||||
/*: Title of Peers Table column which contains a
|
/*: Title of Peers Table column which contains a
|
||||||
unique number used to identify a connection. */
|
unique number used to identify a connection. */
|
||||||
tr("Peer"),
|
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
|
/*: Title of Peers Table column which contains the
|
||||||
IP/Onion/I2P address of the connected peer. */
|
IP/Onion/I2P address of the connected peer. */
|
||||||
tr("Address"),
|
tr("Address"),
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd
|
|||||||
switch (static_cast<PeerTableModel::ColumnIndex>(left_index.column())) {
|
switch (static_cast<PeerTableModel::ColumnIndex>(left_index.column())) {
|
||||||
case PeerTableModel::NetNodeId:
|
case PeerTableModel::NetNodeId:
|
||||||
return left_stats.nodeid < right_stats.nodeid;
|
return left_stats.nodeid < right_stats.nodeid;
|
||||||
|
case PeerTableModel::Age:
|
||||||
|
return left_stats.m_connected > right_stats.m_connected;
|
||||||
case PeerTableModel::Address:
|
case PeerTableModel::Address:
|
||||||
return left_stats.m_addr_name.compare(right_stats.m_addr_name) < 0;
|
return left_stats.m_addr_name.compare(right_stats.m_addr_name) < 0;
|
||||||
case PeerTableModel::Direction:
|
case PeerTableModel::Direction:
|
||||||
|
|||||||
Reference in New Issue
Block a user