diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-10-31 10:45:55 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-10-31 10:46:05 +0100 |
commit | 7bb681d4075ff02b28bda3f60b8c1243817b9bfe (patch) | |
tree | c112dbf4216b77bb3d27399adcb06b9d93c9226f /src/qt/walletmodel.cpp | |
parent | 8d2396c9c41cbd5b8746f48f41180697f58b0681 (diff) | |
parent | 023e63df78b847812040bf6958c97476606dfbfd (diff) | |
download | bitcoin-7bb681d4075ff02b28bda3f60b8c1243817b9bfe.tar.xz |
Merge pull request #5168
023e63d qt: Move transaction notification to transaction table model (Wladimir J. van der Laan)
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r-- | src/qt/walletmodel.cpp | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index b4733d369e..f7b1552f3e 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -34,7 +34,6 @@ WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *p cachedEncryptionStatus(Unencrypted), cachedNumBlocks(0) { - fProcessingQueuedTransactions = false; fHaveWatchOnly = wallet->HaveWatchOnly(); fForceCheckBalanceChanged = false; @@ -164,11 +163,8 @@ void WalletModel::checkBalanceChanged() } } -void WalletModel::updateTransaction(const QString &hash, int status) +void WalletModel::updateTransaction() { - if(transactionTableModel) - transactionTableModel->updateTransaction(hash, status); - // Balance and number of transactions might have changed fForceCheckBalanceChanged = true; } @@ -455,45 +451,16 @@ static void NotifyAddressBookChanged(WalletModel *walletmodel, CWallet *wallet, Q_ARG(int, status)); } -// queue notifications to show a non freezing progress dialog e.g. for rescan -static bool fQueueNotifications = false; -static std::vector<std::pair<uint256, ChangeType> > vQueueNotifications; static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet, const uint256 &hash, ChangeType status) { - if (fQueueNotifications) - { - vQueueNotifications.push_back(make_pair(hash, status)); - return; - } - - QString strHash = QString::fromStdString(hash.GetHex()); - - qDebug() << "NotifyTransactionChanged : " + strHash + " status= " + QString::number(status); - QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection, - Q_ARG(QString, strHash), - Q_ARG(int, status)); + Q_UNUSED(wallet); + Q_UNUSED(hash); + Q_UNUSED(status); + QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection); } static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress) { - if (nProgress == 0) - fQueueNotifications = true; - - if (nProgress == 100) - { - fQueueNotifications = false; - 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 - } - // emits signal "showProgress" QMetaObject::invokeMethod(walletmodel, "showProgress", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(title)), |