aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoingui.cpp24
-rw-r--r--src/qt/bitcoingui.h6
-rw-r--r--src/qt/bitcoinunits.cpp2
-rw-r--r--src/qt/clientmodel.cpp1
-rw-r--r--src/qt/guiutil.cpp2
-rw-r--r--src/qt/optionsmodel.cpp1
-rw-r--r--src/qt/recentrequeststablemodel.cpp2
-rw-r--r--src/qt/transactiontablemodel.cpp206
-rw-r--r--src/qt/transactiontablemodel.h10
-rw-r--r--src/qt/utilitydialog.cpp2
-rw-r--r--src/qt/walletmodel.cpp43
-rw-r--r--src/qt/walletmodel.h6
-rw-r--r--src/qt/walletview.cpp4
13 files changed, 182 insertions, 127 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index f0471c32f9..77cfdceef0 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -19,7 +19,7 @@
#ifdef ENABLE_WALLET
#include "walletframe.h"
#include "walletmodel.h"
-#endif
+#endif // ENABLE_WALLET
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
@@ -106,7 +106,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
bool enableWallet = !GetBoolArg("-disablewallet", false);
#else
bool enableWallet = false;
-#endif
+#endif // ENABLE_WALLET
if(enableWallet)
{
windowTitle += tr("Wallet");
@@ -136,7 +136,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
walletFrame = new WalletFrame(this);
setCentralWidget(walletFrame);
} else
-#endif
+#endif // ENABLE_WALLET
{
/* When compiled without wallet or -disablewallet is provided,
* the central widget is the rpc console.
@@ -268,6 +268,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
+#ifdef ENABLE_WALLET
// These showNormalIfMinimized are needed because Send Coins and Receive Coins
// can be triggered from the tray menu, and need to show the GUI to be useful.
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@@ -278,6 +279,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
+#endif // ENABLE_WALLET
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application"));
@@ -343,7 +345,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked()));
}
-#endif
+#endif // ENABLE_WALLET
}
void BitcoinGUI::createMenuBar()
@@ -433,7 +435,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
{
walletFrame->setClientModel(clientModel);
}
-#endif
+#endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(clientModel->getOptionsModel());
} else {
// Disable possibility to show main window via action
@@ -469,7 +471,7 @@ void BitcoinGUI::removeAllWallets()
setWalletActionsEnabled(false);
walletFrame->removeAllWallets();
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::setWalletActionsEnabled(bool enabled)
{
@@ -616,7 +618,7 @@ void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{
if (walletFrame) walletFrame->gotoVerifyMessageTab(addr);
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::setNumConnections(int count)
{
@@ -676,7 +678,7 @@ void BitcoinGUI::setNumBlocks(int count)
#ifdef ENABLE_WALLET
if(walletFrame)
walletFrame->showOutOfSyncWarning(false);
-#endif
+#endif // ENABLE_WALLET
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
@@ -727,7 +729,7 @@ void BitcoinGUI::setNumBlocks(int count)
#ifdef ENABLE_WALLET
if(walletFrame)
walletFrame->showOutOfSyncWarning(true);
-#endif
+#endif // ENABLE_WALLET
tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
@@ -850,7 +852,7 @@ void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmoun
.arg(type)
.arg(address), CClientUIInterface::MSG_INFORMATION);
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
@@ -924,7 +926,7 @@ void BitcoinGUI::setEncryptionStatus(int status)
break;
}
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index f65f0e9137..0ef4101127 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -63,7 +63,7 @@ public:
bool addWallet(const QString& name, WalletModel *walletModel);
bool setCurrentWallet(const QString& name);
void removeAllWallets();
-#endif
+#endif // ENABLE_WALLET
protected:
void changeEvent(QEvent *e);
@@ -163,7 +163,7 @@ public slots:
/** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address);
-#endif
+#endif // ENABLE_WALLET
private slots:
#ifdef ENABLE_WALLET
@@ -183,7 +183,7 @@ private slots:
/** Show open dialog */
void openClicked();
-#endif
+#endif // ENABLE_WALLET
/** Show configuration dialog */
void optionsClicked();
/** Show about dialog */
diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp
index 423b559bf7..c85f569fd3 100644
--- a/src/qt/bitcoinunits.cpp
+++ b/src/qt/bitcoinunits.cpp
@@ -4,7 +4,7 @@
#include "bitcoinunits.h"
-#include "core.h"
+#include "core/transaction.h"
#include <QStringList>
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 738fb48ef8..aedda49071 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -10,6 +10,7 @@
#include "alert.h"
#include "chainparams.h"
#include "checkpoints.h"
+#include "clientversion.h"
#include "main.h"
#include "net.h"
#include "ui_interface.h"
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 91bb10755a..22a1f019e9 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -9,7 +9,7 @@
#include "qvalidatedlineedit.h"
#include "walletmodel.h"
-#include "core.h"
+#include "core/transaction.h"
#include "init.h"
#include "main.h"
#include "protocol.h"
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index 6db654dff7..c941ebd4ca 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -11,6 +11,7 @@
#include "bitcoinunits.h"
#include "guiutil.h"
+#include "amount.h"
#include "init.h"
#include "main.h"
#include "net.h"
diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp
index 0e5802922c..5533adab8b 100644
--- a/src/qt/recentrequeststablemodel.cpp
+++ b/src/qt/recentrequeststablemodel.cpp
@@ -5,8 +5,10 @@
#include "recentrequeststablemodel.h"
#include "bitcoinunits.h"
+#include "clientversion.h"
#include "guiutil.h"
#include "optionsmodel.h"
+#include "streams.h"
#include <boost/foreach.hpp>
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index e34d776818..79cb4a6296 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -91,87 +91,80 @@ public:
Call with transaction that was added, removed or changed.
*/
- void updateWallet(const uint256 &hash, int status)
+ void updateWallet(const uint256 &hash, int status, bool showTransaction)
{
qDebug() << "TransactionTablePriv::updateWallet : " + QString::fromStdString(hash.ToString()) + " " + QString::number(status);
- {
- LOCK2(cs_main, wallet->cs_wallet);
- // Find transaction in wallet
- std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(hash);
- bool inWallet = mi != wallet->mapWallet.end();
+ // Find bounds of this transaction in model
+ QList<TransactionRecord>::iterator lower = qLowerBound(
+ cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
+ QList<TransactionRecord>::iterator upper = qUpperBound(
+ cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
+ int lowerIndex = (lower - cachedWallet.begin());
+ int upperIndex = (upper - cachedWallet.begin());
+ bool inModel = (lower != upper);
- // Find bounds of this transaction in model
- QList<TransactionRecord>::iterator lower = qLowerBound(
- cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
- QList<TransactionRecord>::iterator upper = qUpperBound(
- cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
- int lowerIndex = (lower - cachedWallet.begin());
- int upperIndex = (upper - cachedWallet.begin());
- bool inModel = (lower != upper);
+ if(status == CT_UPDATED)
+ {
+ if(showTransaction && !inModel)
+ status = CT_NEW; /* Not in model, but want to show, treat as new */
+ if(!showTransaction && inModel)
+ status = CT_DELETED; /* In model, but want to hide, treat as deleted */
+ }
- // Determine whether to show transaction or not
- bool showTransaction = (inWallet && TransactionRecord::showTransaction(mi->second));
+ qDebug() << " inModel=" + QString::number(inModel) +
+ " Index=" + QString::number(lowerIndex) + "-" + QString::number(upperIndex) +
+ " showTransaction=" + QString::number(showTransaction) + " derivedStatus=" + QString::number(status);
- if(status == CT_UPDATED)
+ switch(status)
+ {
+ case CT_NEW:
+ if(inModel)
{
- if(showTransaction && !inModel)
- status = CT_NEW; /* Not in model, but want to show, treat as new */
- if(!showTransaction && inModel)
- status = CT_DELETED; /* In model, but want to hide, treat as deleted */
+ qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is already in model";
+ break;
}
-
- qDebug() << " inWallet=" + QString::number(inWallet) + " inModel=" + QString::number(inModel) +
- " Index=" + QString::number(lowerIndex) + "-" + QString::number(upperIndex) +
- " showTransaction=" + QString::number(showTransaction) + " derivedStatus=" + QString::number(status);
-
- switch(status)
+ if(showTransaction)
{
- case CT_NEW:
- if(inModel)
- {
- qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is already in model";
- break;
- }
- if(!inWallet)
+ LOCK2(cs_main, wallet->cs_wallet);
+ // Find transaction in wallet
+ std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(hash);
+ if(mi == wallet->mapWallet.end())
{
qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is not in wallet";
break;
}
- if(showTransaction)
+ // Added -- insert at the right position
+ QList<TransactionRecord> toInsert =
+ TransactionRecord::decomposeTransaction(wallet, mi->second);
+ if(!toInsert.isEmpty()) /* only if something to insert */
{
- // Added -- insert at the right position
- QList<TransactionRecord> toInsert =
- TransactionRecord::decomposeTransaction(wallet, mi->second);
- if(!toInsert.isEmpty()) /* only if something to insert */
+ parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex+toInsert.size()-1);
+ int insert_idx = lowerIndex;
+ foreach(const TransactionRecord &rec, toInsert)
{
- parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex+toInsert.size()-1);
- int insert_idx = lowerIndex;
- foreach(const TransactionRecord &rec, toInsert)
- {
- cachedWallet.insert(insert_idx, rec);
- insert_idx += 1;
- }
- parent->endInsertRows();
+ cachedWallet.insert(insert_idx, rec);
+ insert_idx += 1;
}
+ parent->endInsertRows();
}
- break;
- case CT_DELETED:
- if(!inModel)
- {
- qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_DELETED, but transaction is not in model";
- break;
- }
- // Removed -- remove entire transaction from table
- parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
- cachedWallet.erase(lower, upper);
- parent->endRemoveRows();
- break;
- case CT_UPDATED:
- // Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for
- // visible transactions.
+ }
+ break;
+ case CT_DELETED:
+ if(!inModel)
+ {
+ qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_DELETED, but transaction is not in model";
break;
}
+ // Removed -- remove entire transaction from table
+ parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
+ cachedWallet.erase(lower, upper);
+ parent->endRemoveRows();
+ break;
+ case CT_UPDATED:
+ // Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for
+ // visible transactions.
+ break;
}
}
@@ -230,16 +223,20 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
QAbstractTableModel(parent),
wallet(wallet),
walletModel(parent),
- priv(new TransactionTablePriv(wallet, this))
+ priv(new TransactionTablePriv(wallet, this)),
+ fProcessingQueuedTransactions(false)
{
columns << QString() << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet();
connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
+
+ subscribeToCoreSignals();
}
TransactionTableModel::~TransactionTableModel()
{
+ unsubscribeFromCoreSignals();
delete priv;
}
@@ -250,12 +247,12 @@ void TransactionTableModel::updateAmountColumnTitle()
emit headerDataChanged(Qt::Horizontal,Amount,Amount);
}
-void TransactionTableModel::updateTransaction(const QString &hash, int status)
+void TransactionTableModel::updateTransaction(const QString &hash, int status, bool showTransaction)
{
uint256 updated;
updated.SetHex(hash.toStdString());
- priv->updateWallet(updated, status);
+ priv->updateWallet(updated, status, showTransaction);
}
void TransactionTableModel::updateConfirmations()
@@ -649,3 +646,82 @@ void TransactionTableModel::updateDisplayUnit()
updateAmountColumnTitle();
emit dataChanged(index(0, Amount), index(priv->size()-1, Amount));
}
+
+// queue notifications to show a non freezing progress dialog e.g. for rescan
+struct TransactionNotification
+{
+public:
+ TransactionNotification() {}
+ TransactionNotification(uint256 hash, ChangeType status, bool showTransaction):
+ hash(hash), status(status), showTransaction(showTransaction) {}
+
+ void invoke(QObject *ttm)
+ {
+ QString strHash = QString::fromStdString(hash.GetHex());
+ qDebug() << "NotifyTransactionChanged : " + strHash + " status= " + QString::number(status);
+ QMetaObject::invokeMethod(ttm, "updateTransaction", Qt::QueuedConnection,
+ Q_ARG(QString, strHash),
+ Q_ARG(int, status),
+ Q_ARG(bool, showTransaction));
+ }
+private:
+ uint256 hash;
+ ChangeType status;
+ bool showTransaction;
+};
+
+static bool fQueueNotifications = false;
+static std::vector< TransactionNotification > vQueueNotifications;
+
+static void NotifyTransactionChanged(TransactionTableModel *ttm, CWallet *wallet, const uint256 &hash, ChangeType status)
+{
+ // Find transaction in wallet
+ std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(hash);
+ // Determine whether to show transaction or not (determine this here so that no relocking is needed in GUI thread)
+ bool inWallet = mi != wallet->mapWallet.end();
+ bool showTransaction = (inWallet && TransactionRecord::showTransaction(mi->second));
+
+ TransactionNotification notification(hash, status, showTransaction);
+
+ if (fQueueNotifications)
+ {
+ vQueueNotifications.push_back(notification);
+ return;
+ }
+ notification.invoke(ttm);
+}
+
+static void ShowProgress(TransactionTableModel *ttm, 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(ttm, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, true));
+ for (unsigned int i = 0; i < vQueueNotifications.size(); ++i)
+ {
+ if (vQueueNotifications.size() - i <= 10)
+ QMetaObject::invokeMethod(ttm, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, false));
+
+ vQueueNotifications[i].invoke(ttm);
+ }
+ std::vector<TransactionNotification >().swap(vQueueNotifications); // clear
+ }
+}
+
+void TransactionTableModel::subscribeToCoreSignals()
+{
+ // Connect signals to wallet
+ wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
+ wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
+}
+
+void TransactionTableModel::unsubscribeFromCoreSignals()
+{
+ // Disconnect signals from wallet
+ wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
+ wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
+}
diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h
index 413f3f9bf1..bb517a969c 100644
--- a/src/qt/transactiontablemodel.h
+++ b/src/qt/transactiontablemodel.h
@@ -72,12 +72,17 @@ public:
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
+ bool processingQueuedTransactions() { return fProcessingQueuedTransactions; }
private:
CWallet* wallet;
WalletModel *walletModel;
QStringList columns;
TransactionTablePriv *priv;
+ bool fProcessingQueuedTransactions;
+
+ void subscribeToCoreSignals();
+ void unsubscribeFromCoreSignals();
QString lookupAddress(const std::string &address, bool tooltip) const;
QVariant addressColor(const TransactionRecord *wtx) const;
@@ -92,11 +97,14 @@ private:
QVariant txAddressDecoration(const TransactionRecord *wtx) const;
public slots:
- void updateTransaction(const QString &hash, int status);
+ /* New transaction, or transaction changed status */
+ void updateTransaction(const QString &hash, int status, bool showTransaction);
void updateConfirmations();
void updateDisplayUnit();
/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
void updateAmountColumnTitle();
+ /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */
+ void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; }
friend class TransactionTablePriv;
};
diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp
index 84f88dff5a..58bf040624 100644
--- a/src/qt/utilitydialog.cpp
+++ b/src/qt/utilitydialog.cpp
@@ -10,8 +10,8 @@
#include "clientmodel.h"
#include "guiutil.h"
+#include "clientversion.h"
#include "init.h"
-#include "version.h"
#include <stdio.h>
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)),
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index b1d0f28f12..fe91e9d9fa 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -133,7 +133,6 @@ public:
CAmount getWatchUnconfirmedBalance() const;
CAmount getWatchImmatureBalance() const;
EncryptionStatus getEncryptionStatus() const;
- bool processingQueuedTransactions() { return fProcessingQueuedTransactions; }
// Check address for validity
bool validateAddress(const QString &address);
@@ -197,7 +196,6 @@ public:
private:
CWallet *wallet;
- bool fProcessingQueuedTransactions;
bool fHaveWatchOnly;
bool fForceCheckBalanceChanged;
@@ -254,15 +252,13 @@ public slots:
/* Wallet status might have changed */
void updateStatus();
/* New transaction, or transaction changed status */
- void updateTransaction(const QString &hash, int status);
+ void updateTransaction();
/* New, updated or removed address book entry */
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status);
/* Watch-only added */
void updateWatchOnlyFlag(bool fHaveWatchonly);
/* Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so */
void pollBalanceChanged();
- /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */
- void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; }
};
#endif // WALLETMODEL_H
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index eff50593bd..3b8fdd7e5f 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -137,10 +137,12 @@ void WalletView::setWalletModel(WalletModel *walletModel)
void WalletView::processNewTransaction(const QModelIndex& parent, int start, int /*end*/)
{
// Prevent balloon-spam when initial block download is in progress
- if (!walletModel || walletModel->processingQueuedTransactions() || !clientModel || clientModel->inInitialBlockDownload())
+ if (!walletModel || !clientModel || clientModel->inInitialBlockDownload())
return;
TransactionTableModel *ttm = walletModel->getTransactionTableModel();
+ if (!ttm || ttm->processingQueuedTransactions())
+ return;
QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong();