Skip to content

Commit 508e2dc

Browse files
committed
qt: Revamp ClientModel code to handle ShowProgress core signal
No behavior change.
1 parent 747cdf1 commit 508e2dc

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/qt/clientmodel.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,6 @@ void ClientModel::updateBanlist()
236236
}
237237

238238
// Handlers for core signals
239-
static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
240-
{
241-
// emits signal "showProgress"
242-
bool invoked = QMetaObject::invokeMethod(clientmodel, "showProgress", Qt::QueuedConnection,
243-
Q_ARG(QString, QString::fromStdString(title)),
244-
Q_ARG(int, nProgress));
245-
assert(invoked);
246-
}
247-
248239
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
249240
{
250241
// Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections);
@@ -306,7 +297,10 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_
306297
void ClientModel::subscribeToCoreSignals()
307298
{
308299
// Connect signals to client
309-
m_handler_show_progress = m_node.handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
300+
m_handler_show_progress = m_node.handleShowProgress(
301+
[this](const std::string& title, int progress, [[maybe_unused]] bool resume_possible) {
302+
Q_EMIT showProgress(QString::fromStdString(title), progress);
303+
});
310304
m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(std::bind(NotifyNumConnectionsChanged, this, std::placeholders::_1));
311305
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(std::bind(NotifyNetworkActiveChanged, this, std::placeholders::_1));
312306
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));

0 commit comments

Comments
 (0)