From f27544d5f3a3830a97dda32c98e8cbb59c1bdbfb Mon Sep 17 00:00:00 2001 From: div72 <60045611+div72@users.noreply.github.com> Date: Thu, 14 May 2020 00:03:39 +0300 Subject: [PATCH 1/3] Remove slashes from peers tab --- src/qt/peertablemodel.cpp | 4 +++- src/qt/rpcconsole.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index c6e3b6b8fa..a6075b9a75 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -163,7 +163,9 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const // prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection return QString(rec->nodeStats.fInbound ? "↓ " : "↑ ") + QString::fromStdString(rec->nodeStats.addrName); case Subversion: - return QString::fromStdString(rec->nodeStats.strSubVer); + // remove leading and trailing slash + std::string strSubVer = rec->nodeStats.strSubVer; + return QString::fromStdString(strSubVer.substr(1, strSubVer.length() - 2)); case Ping: return GUIUtil::formatPingTime(rec->nodeStats.dPingTime); case Sent: diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index cd9bf12527..389a6d6219 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -725,7 +725,8 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats) ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.dMinPing)); ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->peerVersion->setText(QString("%1").arg(QString::number(stats->nodeStats.nVersion))); - ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.strSubVer)); + std::string strSubVer = stats->nodeStats.strSubVer; + ui->peerSubversion->setText(QString::fromStdString(strSubVer.substr(1, strSubVer.length() - 2))); ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound")); ui->peerHeight->setText(QString("%1").arg(QString::number(stats->nodeStats.nStartingHeight))); // ui->peerWhitelisted->setText(stats->nodeStats.fWhitelisted ? tr("Yes") : tr("No")); From 755602953deee27ab787a8df539651beab1379ec Mon Sep 17 00:00:00 2001 From: div72 <60045611+div72@users.noreply.github.com> Date: Thu, 14 May 2020 00:32:13 +0300 Subject: [PATCH 2/3] fix an error --- src/qt/peertablemodel.cpp | 3 +-- src/qt/rpcconsole.cpp | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index a6075b9a75..68e9935502 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -164,8 +164,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const return QString(rec->nodeStats.fInbound ? "↓ " : "↑ ") + QString::fromStdString(rec->nodeStats.addrName); case Subversion: // remove leading and trailing slash - std::string strSubVer = rec->nodeStats.strSubVer; - return QString::fromStdString(strSubVer.substr(1, strSubVer.length() - 2)); + return QString::fromStdString(rec->nodeStats.strSubVer.substr(1, rec->nodeStats.strSubVer.length() - 2)); case Ping: return GUIUtil::formatPingTime(rec->nodeStats.dPingTime); case Sent: diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 389a6d6219..47ca5a0a16 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -725,6 +725,7 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats) ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.dMinPing)); ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->peerVersion->setText(QString("%1").arg(QString::number(stats->nodeStats.nVersion))); + // remove leading and trailing slash std::string strSubVer = stats->nodeStats.strSubVer; ui->peerSubversion->setText(QString::fromStdString(strSubVer.substr(1, strSubVer.length() - 2))); ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound")); From 40e86b97e7e3c61c4ed1c57d40942b1db02f09a0 Mon Sep 17 00:00:00 2001 From: div72 <60045611+div72@users.noreply.github.com> Date: Thu, 14 May 2020 01:06:02 +0300 Subject: [PATCH 3/3] consistency with the other fix --- src/qt/rpcconsole.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 47ca5a0a16..2f83fdec73 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -726,8 +726,7 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats) ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->peerVersion->setText(QString("%1").arg(QString::number(stats->nodeStats.nVersion))); // remove leading and trailing slash - std::string strSubVer = stats->nodeStats.strSubVer; - ui->peerSubversion->setText(QString::fromStdString(strSubVer.substr(1, strSubVer.length() - 2))); + ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.strSubVer.substr(1, stats->nodeStats.strSubVer.length() - 2))); ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound")); ui->peerHeight->setText(QString("%1").arg(QString::number(stats->nodeStats.nStartingHeight))); // ui->peerWhitelisted->setText(stats->nodeStats.fWhitelisted ? tr("Yes") : tr("No"));