mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
qt: Revamp ClientModel code to handle ShowProgress core signal
No behavior change.
This commit is contained in:
@@ -236,15 +236,6 @@ void ClientModel::updateBanlist()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handlers for core signals
|
// 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)
|
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
|
||||||
{
|
{
|
||||||
// Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections);
|
// Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections);
|
||||||
@@ -306,7 +297,10 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_
|
|||||||
void ClientModel::subscribeToCoreSignals()
|
void ClientModel::subscribeToCoreSignals()
|
||||||
{
|
{
|
||||||
// Connect signals to client
|
// 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_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_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));
|
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));
|
||||||
|
|||||||
Reference in New Issue
Block a user