mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
qt: Revamp ClientModel code to handle BannedListChanged core signal
No behavior change.
This commit is contained in:
parent
36b12af7ee
commit
48f6d39659
2 changed files with 6 additions and 16 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <functional>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMetaObject>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
|
@ -215,19 +216,7 @@ QString ClientModel::blocksDir() const
|
|||
return GUIUtil::PathToQString(gArgs.GetBlocksDirPath());
|
||||
}
|
||||
|
||||
void ClientModel::updateBanlist()
|
||||
{
|
||||
banTableModel->refresh();
|
||||
}
|
||||
|
||||
// Handlers for core signals
|
||||
static void BannedListChanged(ClientModel *clientmodel)
|
||||
{
|
||||
qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__);
|
||||
bool invoked = QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection);
|
||||
assert(invoked);
|
||||
}
|
||||
|
||||
static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_state, interfaces::BlockTip tip, double verificationProgress, bool fHeader)
|
||||
{
|
||||
if (fHeader) {
|
||||
|
@ -277,7 +266,11 @@ void ClientModel::subscribeToCoreSignals()
|
|||
qDebug() << "ClientModel: NotifyAlertChanged";
|
||||
Q_EMIT alertsChanged(getStatusBarWarnings());
|
||||
});
|
||||
m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));
|
||||
m_handler_banned_list_changed = m_node.handleBannedListChanged(
|
||||
[this]() {
|
||||
qDebug() << "ClienModel: Requesting update for peer banlist";
|
||||
QMetaObject::invokeMethod(banTableModel, [this] { banTableModel->refresh(); });
|
||||
});
|
||||
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, false));
|
||||
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, true));
|
||||
}
|
||||
|
|
|
@ -120,9 +120,6 @@ Q_SIGNALS:
|
|||
|
||||
// Show progress dialog e.g. for verifychain
|
||||
void showProgress(const QString &title, int nProgress);
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateBanlist();
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_CLIENTMODEL_H
|
||||
|
|
Loading…
Add table
Reference in a new issue