Skip to content

Commit 36b12af

Browse files
committed
qt: Revamp ClientModel code to handle AlertChanged core signal
No behavior change.
1 parent bfe5140 commit 36b12af

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/qt/clientmodel.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ uint256 ClientModel::getBestBlockHash()
148148
return m_cached_tip_blocks;
149149
}
150150

151-
void ClientModel::updateAlert()
152-
{
153-
Q_EMIT alertsChanged(getStatusBarWarnings());
154-
}
155-
156151
enum BlockSource ClientModel::getBlockSource() const
157152
{
158153
if (m_node.getReindex())
@@ -226,13 +221,6 @@ void ClientModel::updateBanlist()
226221
}
227222

228223
// Handlers for core signals
229-
static void NotifyAlertChanged(ClientModel *clientmodel)
230-
{
231-
qDebug() << "NotifyAlertChanged";
232-
bool invoked = QMetaObject::invokeMethod(clientmodel, "updateAlert", Qt::QueuedConnection);
233-
assert(invoked);
234-
}
235-
236224
static void BannedListChanged(ClientModel *clientmodel)
237225
{
238226
qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__);
@@ -284,7 +272,11 @@ void ClientModel::subscribeToCoreSignals()
284272
[this](bool network_active) {
285273
Q_EMIT networkActiveChanged(network_active);
286274
});
287-
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));
275+
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(
276+
[this]() {
277+
qDebug() << "ClientModel: NotifyAlertChanged";
278+
Q_EMIT alertsChanged(getStatusBarWarnings());
279+
});
288280
m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));
289281
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, false));
290282
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, true));

src/qt/clientmodel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ class ClientModel : public QObject
122122
void showProgress(const QString &title, int nProgress);
123123

124124
public Q_SLOTS:
125-
void updateAlert();
126125
void updateBanlist();
127126
};
128127

0 commit comments

Comments
 (0)