@@ -96,13 +96,14 @@ class TransactionTablePriv
96
96
*/
97
97
QList<TransactionRecord> cachedWallet;
98
98
99
- bool fQueueNotifications = false ;
100
99
/* * True when model finishes loading all wallet transactions on start */
101
100
bool m_loaded = false ;
101
+ /* * True when transactions are being notified, for instance when scanning */
102
+ bool m_loading = false ;
102
103
std::vector< TransactionNotification > vQueueNotifications;
103
104
104
105
void NotifyTransactionChanged (const uint256 &hash, ChangeType status);
105
- void ShowProgress ( const std::string &title, int nProgress );
106
+ void DispatchNotifications ( );
106
107
107
108
/* Query entire wallet anew from core.
108
109
*/
@@ -721,22 +722,19 @@ void TransactionTablePriv::NotifyTransactionChanged(const uint256 &hash, ChangeT
721
722
722
723
TransactionNotification notification (hash, status, showTransaction);
723
724
724
- if (fQueueNotifications )
725
+ if (m_loading )
725
726
{
726
727
vQueueNotifications.push_back (notification);
727
728
return ;
728
729
}
729
730
notification.invoke (parent);
730
731
}
731
732
732
- void TransactionTablePriv::ShowProgress ( const std::string &title, int nProgress )
733
+ void TransactionTablePriv::DispatchNotifications ( )
733
734
{
734
- if (nProgress == 0 )
735
- fQueueNotifications = true ;
735
+ if (m_loading) return ;
736
736
737
- if (nProgress == 100 )
738
737
{
739
- fQueueNotifications = false ;
740
738
if (vQueueNotifications.size () > 10 ) { // prevent balloon spam, show maximum 10 balloons
741
739
bool invoked = QMetaObject::invokeMethod (parent, " setProcessingQueuedTransactions" , Qt::QueuedConnection, Q_ARG (bool , true ));
742
740
assert (invoked);
@@ -758,7 +756,10 @@ void TransactionTableModel::subscribeToCoreSignals()
758
756
{
759
757
// Connect signals to wallet
760
758
m_handler_transaction_changed = walletModel->wallet ().handleTransactionChanged (std::bind (&TransactionTablePriv::NotifyTransactionChanged, priv, std::placeholders::_1, std::placeholders::_2));
761
- m_handler_show_progress = walletModel->wallet ().handleShowProgress (std::bind (&TransactionTablePriv::ShowProgress, priv, std::placeholders::_1, std::placeholders::_2));
759
+ m_handler_show_progress = walletModel->wallet ().handleShowProgress ([this ](const std::string&, int progress) {
760
+ priv->m_loading = progress < 100 ;
761
+ priv->DispatchNotifications ();
762
+ });
762
763
}
763
764
764
765
void TransactionTableModel::unsubscribeFromCoreSignals ()
0 commit comments