aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-10 17:39:59 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-10 18:56:09 +0200
commit508e2dca5e91c1ff921f01d260fc62f629f1dc9e (patch)
treeac1e4ab75f689d740536d36c88e07991f96161da /src/qt/clientmodel.cpp
parent747cdf1d652d8587e9f2e3d4436c3ecdbf56d0a5 (diff)
downloadbitcoin-508e2dca5e91c1ff921f01d260fc62f629f1dc9e.tar.xz
qt: Revamp ClientModel code to handle ShowProgress core signal
No behavior change.
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 4327d31787..ca08792f82 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -236,15 +236,6 @@ void ClientModel::updateBanlist()
}
// Handlers for core signals
-static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
-{
- // emits signal "showProgress"
- bool invoked = QMetaObject::invokeMethod(clientmodel, "showProgress", Qt::QueuedConnection,
- Q_ARG(QString, QString::fromStdString(title)),
- Q_ARG(int, nProgress));
- assert(invoked);
-}
-
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
{
// Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections);
@@ -306,7 +297,10 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_
void ClientModel::subscribeToCoreSignals()
{
// Connect signals to client
- m_handler_show_progress = m_node.handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
+ m_handler_show_progress = m_node.handleShowProgress(
+ [this](const std::string& title, int progress, [[maybe_unused]] bool resume_possible) {
+ Q_EMIT showProgress(QString::fromStdString(title), progress);
+ });
m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(std::bind(NotifyNumConnectionsChanged, this, std::placeholders::_1));
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(std::bind(NotifyNetworkActiveChanged, this, std::placeholders::_1));
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));