aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-10 17:51:29 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-10 18:56:20 +0200
commit639563d7fea6b4d65840625dc466eede32d893cf (patch)
tree3a5cf9e03f2c533353e4f086df65dc75f6b2a76c /src/qt/clientmodel.cpp
parent508e2dca5e91c1ff921f01d260fc62f629f1dc9e (diff)
downloadbitcoin-639563d7fea6b4d65840625dc466eede32d893cf.tar.xz
qt: Revamp ClientModel code to handle NumConnectionsChanged core signal
No behavior change.
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index ca08792f82..0a2af7c7f5 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -148,11 +148,6 @@ uint256 ClientModel::getBestBlockHash()
return m_cached_tip_blocks;
}
-void ClientModel::updateNumConnections(int numConnections)
-{
- Q_EMIT numConnectionsChanged(numConnections);
-}
-
void ClientModel::updateNetworkActive(bool networkActive)
{
Q_EMIT networkActiveChanged(networkActive);
@@ -236,14 +231,6 @@ void ClientModel::updateBanlist()
}
// Handlers for core signals
-static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
-{
- // Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections);
- bool invoked = QMetaObject::invokeMethod(clientmodel, "updateNumConnections", Qt::QueuedConnection,
- Q_ARG(int, newNumConnections));
- assert(invoked);
-}
-
static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
{
bool invoked = QMetaObject::invokeMethod(clientmodel, "updateNetworkActive", Qt::QueuedConnection,
@@ -301,7 +288,10 @@ void ClientModel::subscribeToCoreSignals()
[this](const std::string& title, int progress, [[maybe_unused]] bool resume_possible) {
Q_EMIT showProgress(QString::fromStdString(title), progress);
});
- m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(std::bind(NotifyNumConnectionsChanged, this, std::placeholders::_1));
+ m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(
+ [this](int new_num_connections) {
+ Q_EMIT numConnectionsChanged(new_num_connections);
+ });
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(std::bind(NotifyNetworkActiveChanged, this, std::placeholders::_1));
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));
m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));