Skip to content

Commit bfe5140

Browse files
committed
qt: Revamp ClientModel code to handle NetworkActiveChanged core signal
No behavior change.
1 parent 639563d commit bfe5140

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/qt/clientmodel.cpp

Lines changed: 4 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::updateNetworkActive(bool networkActive)
152-
{
153-
Q_EMIT networkActiveChanged(networkActive);
154-
}
155-
156151
void ClientModel::updateAlert()
157152
{
158153
Q_EMIT alertsChanged(getStatusBarWarnings());
@@ -231,13 +226,6 @@ void ClientModel::updateBanlist()
231226
}
232227

233228
// Handlers for core signals
234-
static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
235-
{
236-
bool invoked = QMetaObject::invokeMethod(clientmodel, "updateNetworkActive", Qt::QueuedConnection,
237-
Q_ARG(bool, networkActive));
238-
assert(invoked);
239-
}
240-
241229
static void NotifyAlertChanged(ClientModel *clientmodel)
242230
{
243231
qDebug() << "NotifyAlertChanged";
@@ -292,7 +280,10 @@ void ClientModel::subscribeToCoreSignals()
292280
[this](int new_num_connections) {
293281
Q_EMIT numConnectionsChanged(new_num_connections);
294282
});
295-
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(std::bind(NotifyNetworkActiveChanged, this, std::placeholders::_1));
283+
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(
284+
[this](bool network_active) {
285+
Q_EMIT networkActiveChanged(network_active);
286+
});
296287
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));
297288
m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));
298289
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, false));

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 updateNetworkActive(bool networkActive);
126125
void updateAlert();
127126
void updateBanlist();
128127
};

0 commit comments

Comments
 (0)