[Qt] Prevent balloon-spam after rescan

This commit is contained in:
Cozz Lovan
2014-07-13 10:19:56 +02:00
parent e8d4cb8071
commit acd432b5b3
3 changed files with 16 additions and 3 deletions

View File

@@ -35,6 +35,8 @@ WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *p
cachedEncryptionStatus(Unencrypted),
cachedNumBlocks(0)
{
fProcessingQueuedTransactions = false;
addressTableModel = new AddressTableModel(wallet, this);
transactionTableModel = new TransactionTableModel(wallet, this);
recentRequestsTableModel = new RecentRequestsTableModel(wallet, this);
@@ -492,8 +494,15 @@ static void ShowProgress(WalletModel *walletmodel, const std::string &title, int
if (nProgress == 100)
{
fQueueNotifications = false;
BOOST_FOREACH(const PAIRTYPE(uint256, ChangeType)& notification, vQueueNotifications)
NotifyTransactionChanged(walletmodel, NULL, notification.first, notification.second);
if (vQueueNotifications.size() > 10) // prevent balloon spam, show maximum 10 balloons
QMetaObject::invokeMethod(walletmodel, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, true));
for (unsigned int i = 0; i < vQueueNotifications.size(); ++i)
{
if (vQueueNotifications.size() - i <= 10)
QMetaObject::invokeMethod(walletmodel, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, false));
NotifyTransactionChanged(walletmodel, NULL, vQueueNotifications[i].first, vQueueNotifications[i].second);
}
std::vector<std::pair<uint256, ChangeType> >().swap(vQueueNotifications); // clear
}
}