diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-04-10 18:06:51 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-04-16 18:50:20 +0200 |
commit | 36b12af7eeb571efccd972b2f732a81ae7310066 (patch) | |
tree | 14870774ff1ede222023359606117556a6f92bdb /src/qt/clientmodel.cpp | |
parent | bfe5140c50d16cc995c7da458d38759b68e9cbe6 (diff) | |
download | bitcoin-36b12af7eeb571efccd972b2f732a81ae7310066.tar.xz |
qt: Revamp ClientModel code to handle AlertChanged core signal
No behavior change.
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r-- | src/qt/clientmodel.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index cce2151245..3370338bc9 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::updateAlert() -{ - Q_EMIT alertsChanged(getStatusBarWarnings()); -} - enum BlockSource ClientModel::getBlockSource() const { if (m_node.getReindex()) @@ -226,13 +221,6 @@ void ClientModel::updateBanlist() } // Handlers for core signals -static void NotifyAlertChanged(ClientModel *clientmodel) -{ - qDebug() << "NotifyAlertChanged"; - bool invoked = QMetaObject::invokeMethod(clientmodel, "updateAlert", Qt::QueuedConnection); - assert(invoked); -} - static void BannedListChanged(ClientModel *clientmodel) { qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__); @@ -284,7 +272,11 @@ void ClientModel::subscribeToCoreSignals() [this](bool network_active) { Q_EMIT networkActiveChanged(network_active); }); - m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this)); + m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged( + [this]() { + qDebug() << "ClientModel: NotifyAlertChanged"; + Q_EMIT alertsChanged(getStatusBarWarnings()); + }); 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)); m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, true)); |