aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r--src/qt/rpcconsole.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index edf417a7cb..018c22a4a8 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <config/bitcoin-config.h> // IWYU pragma: keep
+#include <bitcoin-build-config.h> // IWYU pragma: keep
#include <qt/rpcconsole.h>
#include <qt/forms/ui_debugwindow.h>
@@ -16,7 +16,9 @@
#include <qt/guiutil.h>
#include <qt/peertablesortproxy.h>
#include <qt/platformstyle.h>
+#ifdef ENABLE_WALLET
#include <qt/walletmodel.h>
+#endif // ENABLE_WALLET
#include <rpc/client.h>
#include <rpc/server.h>
#include <util/strencodings.h>
@@ -560,6 +562,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
ui->lineEdit->setMaxLength(16 * 1024 * 1024);
ui->messagesWidget->installEventFilter(this);
+ connect(ui->hidePeersDetailButton, &QAbstractButton::clicked, this, &RPCConsole::clearSelectedNode);
connect(ui->clearButton, &QAbstractButton::clicked, [this] { clear(); });
connect(ui->fontBiggerButton, &QAbstractButton::clicked, this, &RPCConsole::fontBigger);
connect(ui->fontSmallerButton, &QAbstractButton::clicked, this, &RPCConsole::fontSmaller);
@@ -977,6 +980,18 @@ void RPCConsole::updateNetworkState()
}
ui->numberOfConnections->setText(connections);
+
+ QString local_addresses;
+ std::map<CNetAddr, LocalServiceInfo> hosts = clientModel->getNetLocalAddresses();
+ for (const auto& [addr, info] : hosts) {
+ local_addresses += QString::fromStdString(addr.ToStringAddr());
+ if (!addr.IsI2P()) local_addresses += ":" + QString::number(info.nPort);
+ local_addresses += ", ";
+ }
+ local_addresses.chop(2); // remove last ", "
+ if (local_addresses.isEmpty()) local_addresses = tr("None");
+
+ ui->localAddresses->setText(local_addresses);
}
void RPCConsole::setNumConnections(int count)
@@ -1000,15 +1015,16 @@ void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, double nVer
}
}
-void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage)
+void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage, size_t maxUsage)
{
ui->mempoolNumberTxs->setText(QString::number(numberOfTxs));
- if (dynUsage < 1000000) {
- ui->mempoolSize->setText(QObject::tr("%1 kB").arg(dynUsage / 1000.0, 0, 'f', 2));
- } else {
- ui->mempoolSize->setText(QObject::tr("%1 MB").arg(dynUsage / 1000000.0, 0, 'f', 2));
- }
+ const auto cur_usage_str = dynUsage < 1000000 ?
+ QObject::tr("%1 kB").arg(dynUsage / 1000.0, 0, 'f', 2) :
+ QObject::tr("%1 MB").arg(dynUsage / 1000000.0, 0, 'f', 2);
+ const auto max_usage_str = QObject::tr("%1 MB").arg(maxUsage / 1000000.0, 0, 'f', 2);
+
+ ui->mempoolSize->setText(cur_usage_str + " / " + max_usage_str);
}
void RPCConsole::on_lineEdit_returnPressed()
@@ -1250,6 +1266,7 @@ void RPCConsole::updateDetailWidget()
ui->peerRelayTxes->setText(stats->nodeStateStats.m_relay_txs ? ts.yes : ts.no);
}
+ ui->hidePeersDetailButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/remove")));
ui->peersTabRightPanel->show();
}
@@ -1400,4 +1417,4 @@ void RPCConsole::updateWindowTitle()
const QString chainType = QString::fromStdString(Params().GetChainTypeString());
const QString title = tr("Node window - [%1]").arg(chainType);
this->setWindowTitle(title);
-} \ No newline at end of file
+}