diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-18 13:13:48 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-18 13:13:48 +0200 |
commit | 7df70c000a5f687953335a5ab397ab4c74a40dd4 (patch) | |
tree | db0968764275db6a04b6ce26bdc2e007b5436374 /src/qt | |
parent | 0f3981bea94cea957f0de4b128f7feffbfc2d9c6 (diff) |
Prevent notification balloon-spam on initial block download, const-correctness in client model
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoingui.cpp | 3 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 15 | ||||
-rw-r--r-- | src/qt/clientmodel.h | 13 |
3 files changed, 20 insertions, 11 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4d3efe26db..028882f49d 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -441,9 +441,10 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int .data(Qt::EditRole).toULongLong(); qint64 debit = ttm->index(start, TransactionTableModel::Debit, parent) .data(Qt::EditRole).toULongLong(); - if((credit+debit)>0) + if((credit+debit)>0 && !model->inInitialBlockDownload()) { // On incoming transaction, make an info balloon + // Unless the initial block download is in progress, to prevent balloon-spam QString date = ttm->index(start, TransactionTableModel::Date, parent) .data().toString(); QString description = ttm->index(start, TransactionTableModel::Description, parent) diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 10cafaf1af..822c03d949 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -22,12 +22,12 @@ ClientModel::ClientModel(QObject *parent) : transactionTableModel = new TransactionTableModel(this); } -qint64 ClientModel::getBalance() +qint64 ClientModel::getBalance() const { return GetBalance(); } -QString ClientModel::getAddress() +QString ClientModel::getAddress() const { std::vector<unsigned char> vchPubKey; if (CWalletDB("r").ReadDefaultKey(vchPubKey)) @@ -40,17 +40,17 @@ QString ClientModel::getAddress() } } -int ClientModel::getNumConnections() +int ClientModel::getNumConnections() const { return vNodes.size(); } -int ClientModel::getNumBlocks() +int ClientModel::getNumBlocks() const { return nBestHeight; } -int ClientModel::getNumTransactions() +int ClientModel::getNumTransactions() const { int numTransactions = 0; CRITICAL_BLOCK(cs_mapWallet) @@ -138,6 +138,11 @@ ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payA return OK; } +bool ClientModel::inInitialBlockDownload() const +{ + return IsInitialBlockDownload(); +} + OptionsModel *ClientModel::getOptionsModel() { return optionsModel; diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 09d1fc921e..f5f12fcfd9 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -28,11 +28,14 @@ public: AddressTableModel *getAddressTableModel(); TransactionTableModel *getTransactionTableModel(); - qint64 getBalance(); - QString getAddress(); - int getNumConnections(); - int getNumBlocks(); - int getNumTransactions(); + qint64 getBalance() const; + QString getAddress() const; + int getNumConnections() const; + int getNumBlocks() const; + int getNumTransactions() const; + + /* Return true if core is doing initial block download */ + bool inInitialBlockDownload() const; /* Set default address */ void setAddress(const QString &defaultAddress); |