aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactiontablemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/transactiontablemodel.cpp')
-rw-r--r--src/qt/transactiontablemodel.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index 9e2cccf33c..903a97a59d 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -96,13 +96,14 @@ public:
*/
QList<TransactionRecord> cachedWallet;
- bool fQueueNotifications = false;
/** True when model finishes loading all wallet transactions on start */
bool m_loaded = false;
+ /** True when transactions are being notified, for instance when scanning */
+ bool m_loading = false;
std::vector< TransactionNotification > vQueueNotifications;
void NotifyTransactionChanged(const uint256 &hash, ChangeType status);
- void ShowProgress(const std::string &title, int nProgress);
+ void DispatchNotifications();
/* Query entire wallet anew from core.
*/
@@ -721,7 +722,7 @@ void TransactionTablePriv::NotifyTransactionChanged(const uint256 &hash, ChangeT
TransactionNotification notification(hash, status, showTransaction);
- if (fQueueNotifications)
+ if (m_loading)
{
vQueueNotifications.push_back(notification);
return;
@@ -729,14 +730,11 @@ void TransactionTablePriv::NotifyTransactionChanged(const uint256 &hash, ChangeT
notification.invoke(parent);
}
-void TransactionTablePriv::ShowProgress(const std::string &title, int nProgress)
+void TransactionTablePriv::DispatchNotifications()
{
- if (nProgress == 0)
- fQueueNotifications = true;
+ if (m_loading) return;
- if (nProgress == 100)
{
- fQueueNotifications = false;
if (vQueueNotifications.size() > 10) { // prevent balloon spam, show maximum 10 balloons
bool invoked = QMetaObject::invokeMethod(parent, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, true));
assert(invoked);
@@ -758,7 +756,10 @@ void TransactionTableModel::subscribeToCoreSignals()
{
// Connect signals to wallet
m_handler_transaction_changed = walletModel->wallet().handleTransactionChanged(std::bind(&TransactionTablePriv::NotifyTransactionChanged, priv, std::placeholders::_1, std::placeholders::_2));
- m_handler_show_progress = walletModel->wallet().handleShowProgress(std::bind(&TransactionTablePriv::ShowProgress, priv, std::placeholders::_1, std::placeholders::_2));
+ m_handler_show_progress = walletModel->wallet().handleShowProgress([this](const std::string&, int progress) {
+ priv->m_loading = progress < 100;
+ priv->DispatchNotifications();
+ });
}
void TransactionTableModel::unsubscribeFromCoreSignals()