From 1748356c563923543cc8f65e60ea5c918b3a0a3e Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sat, 26 Jun 2021 18:14:11 +0200 Subject: [PATCH 1/2] gui: remove "Type" column from Peers main window as it is confusing to users and does not make sense to have a Type column without a Direction column immediately preceding it to indicate Inbound or Outbound. Several attempts to add the Direction column, as described, have seen opposition from reviewers. Therefore, remove the Type column until such time as there is rough consensus to add the Direction Inbound/Outbound column with it. --- src/qt/peertablemodel.cpp | 3 --- src/qt/peertablemodel.h | 4 ---- src/qt/peertablesortproxy.cpp | 2 -- 3 files changed, 9 deletions(-) diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index b3246936926..b370dc25072 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -74,8 +74,6 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const case Address: // prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection return QString::fromStdString((rec->nodeStats.fInbound ? "↓ " : "↑ ") + rec->nodeStats.addrName); - case ConnectionType: - return GUIUtil::ConnectionTypeToQString(rec->nodeStats.m_conn_type, /* prepend_direction */ false); case Network: return GUIUtil::NetworkToQString(rec->nodeStats.m_network); case Ping: @@ -94,7 +92,6 @@ QVariant PeerTableModel::data(const QModelIndex& index, int role) const return QVariant(Qt::AlignRight | Qt::AlignVCenter); case Address: return {}; - case ConnectionType: case Network: return QVariant(Qt::AlignCenter); case Ping: diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h index 0ff1b5dba77..249eff0034c 100644 --- a/src/qt/peertablemodel.h +++ b/src/qt/peertablemodel.h @@ -48,7 +48,6 @@ class PeerTableModel : public QAbstractTableModel enum ColumnIndex { NetNodeId = 0, Address, - ConnectionType, Network, Ping, Sent, @@ -87,9 +86,6 @@ public Q_SLOTS: /*: Title of Peers Table column which contains the IP/Onion/I2P address of the connected peer. */ tr("Address"), - /*: Title of Peers Table column which describes the type of - peer connection. The "type" describes why the connection exists. */ - tr("Type"), /*: Title of Peers Table column which states the network the peer connected through. */ tr("Network"), diff --git a/src/qt/peertablesortproxy.cpp b/src/qt/peertablesortproxy.cpp index 78932da8d48..7a1201bc4d2 100644 --- a/src/qt/peertablesortproxy.cpp +++ b/src/qt/peertablesortproxy.cpp @@ -26,8 +26,6 @@ bool PeerTableSortProxy::lessThan(const QModelIndex& left_index, const QModelInd return left_stats.nodeid < right_stats.nodeid; case PeerTableModel::Address: return left_stats.addrName.compare(right_stats.addrName) < 0; - case PeerTableModel::ConnectionType: - return left_stats.m_conn_type < right_stats.m_conn_type; case PeerTableModel::Network: return left_stats.m_network < right_stats.m_network; case PeerTableModel::Ping: From 04bbdcb84a0fd499d7a2bc14cfe33add02c388cf Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sat, 26 Jun 2021 18:23:14 +0200 Subject: [PATCH 2/2] gui: remove ConnectionTypeToQString prepend_direction param as it is no longer used. --- src/qt/guiutil.cpp | 7 ++----- src/qt/guiutil.h | 2 +- src/qt/rpcconsole.cpp | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 393dca8ccd0..c0c99fc3aad 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -669,12 +669,9 @@ QString NetworkToQString(Network net) assert(false); } -QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction) +QString ConnectionTypeToQString(ConnectionType conn_type) { - QString prefix; - if (prepend_direction) { - prefix = (conn_type == ConnectionType::INBOUND) ? QObject::tr("Inbound") : QObject::tr("Outbound") + " "; - } + QString prefix{conn_type == ConnectionType::INBOUND ? QObject::tr("Inbound") : QObject::tr("Outbound") + " "}; switch (conn_type) { case ConnectionType::INBOUND: return prefix; case ConnectionType::OUTBOUND_FULL_RELAY: return prefix + QObject::tr("Full Relay"); diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 06a3b636686..b255de5c195 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -212,7 +212,7 @@ namespace GUIUtil QString NetworkToQString(Network net); /** Convert enum ConnectionType to QString */ - QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction); + QString ConnectionTypeToQString(ConnectionType conn_type); /** Convert seconds into a QString with days, hours, mins, secs */ QString formatDurationStr(int secs); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index ff4bfb16f69..3a84aacd977 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1149,7 +1149,7 @@ void RPCConsole::updateDetailWidget() ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion)); ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer)); - ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type, /* prepend_direction */ true)); + ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type)); ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network)); if (stats->nodeStats.m_permissionFlags == NetPermissionFlags::None) { ui->peerPermissions->setText(ts.na);