aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-10 17:57:10 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-10 18:56:29 +0200
commitbfe5140c50d16cc995c7da458d38759b68e9cbe6 (patch)
treea2260d708d5fd98e733805f87d2b3c750cef2fcc /src/qt/clientmodel.cpp
parent639563d7fea6b4d65840625dc466eede32d893cf (diff)
downloadbitcoin-bfe5140c50d16cc995c7da458d38759b68e9cbe6.tar.xz
qt: Revamp ClientModel code to handle NetworkActiveChanged core signal
No behavior change.
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 0a2af7c7f5..cce2151245 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::updateNetworkActive(bool networkActive)
-{
- Q_EMIT networkActiveChanged(networkActive);
-}
-
void ClientModel::updateAlert()
{
Q_EMIT alertsChanged(getStatusBarWarnings());
@@ -231,13 +226,6 @@ void ClientModel::updateBanlist()
}
// Handlers for core signals
-static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
-{
- bool invoked = QMetaObject::invokeMethod(clientmodel, "updateNetworkActive", Qt::QueuedConnection,
- Q_ARG(bool, networkActive));
- assert(invoked);
-}
-
static void NotifyAlertChanged(ClientModel *clientmodel)
{
qDebug() << "NotifyAlertChanged";
@@ -292,7 +280,10 @@ void ClientModel::subscribeToCoreSignals()
[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_network_active_changed = m_node.handleNotifyNetworkActiveChanged(
+ [this](bool network_active) {
+ Q_EMIT networkActiveChanged(network_active);
+ });
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));
m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, false));