Browse Source

Prevent notification balloon-spam on initial block download, const-correctness in client model

0.8
Wladimir J. van der Laan 14 years ago
parent
commit
7df70c000a
  1. 3
      src/qt/bitcoingui.cpp
  2. 15
      src/qt/clientmodel.cpp
  3. 13
      src/qt/clientmodel.h

3
src/qt/bitcoingui.cpp

@ -441,9 +441,10 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int
.data(Qt::EditRole).toULongLong(); .data(Qt::EditRole).toULongLong();
qint64 debit = ttm->index(start, TransactionTableModel::Debit, parent) qint64 debit = ttm->index(start, TransactionTableModel::Debit, parent)
.data(Qt::EditRole).toULongLong(); .data(Qt::EditRole).toULongLong();
if((credit+debit)>0) if((credit+debit)>0 && !model->inInitialBlockDownload())
{ {
// On incoming transaction, make an info balloon // 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) QString date = ttm->index(start, TransactionTableModel::Date, parent)
.data().toString(); .data().toString();
QString description = ttm->index(start, TransactionTableModel::Description, parent) QString description = ttm->index(start, TransactionTableModel::Description, parent)

15
src/qt/clientmodel.cpp

@ -22,12 +22,12 @@ ClientModel::ClientModel(QObject *parent) :
transactionTableModel = new TransactionTableModel(this); transactionTableModel = new TransactionTableModel(this);
} }
qint64 ClientModel::getBalance() qint64 ClientModel::getBalance() const
{ {
return GetBalance(); return GetBalance();
} }
QString ClientModel::getAddress() QString ClientModel::getAddress() const
{ {
std::vector<unsigned char> vchPubKey; std::vector<unsigned char> vchPubKey;
if (CWalletDB("r").ReadDefaultKey(vchPubKey)) if (CWalletDB("r").ReadDefaultKey(vchPubKey))
@ -40,17 +40,17 @@ QString ClientModel::getAddress()
} }
} }
int ClientModel::getNumConnections() int ClientModel::getNumConnections() const
{ {
return vNodes.size(); return vNodes.size();
} }
int ClientModel::getNumBlocks() int ClientModel::getNumBlocks() const
{ {
return nBestHeight; return nBestHeight;
} }
int ClientModel::getNumTransactions() int ClientModel::getNumTransactions() const
{ {
int numTransactions = 0; int numTransactions = 0;
CRITICAL_BLOCK(cs_mapWallet) CRITICAL_BLOCK(cs_mapWallet)
@ -138,6 +138,11 @@ ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payA
return OK; return OK;
} }
bool ClientModel::inInitialBlockDownload() const
{
return IsInitialBlockDownload();
}
OptionsModel *ClientModel::getOptionsModel() OptionsModel *ClientModel::getOptionsModel()
{ {
return optionsModel; return optionsModel;

13
src/qt/clientmodel.h

@ -28,11 +28,14 @@ public:
AddressTableModel *getAddressTableModel(); AddressTableModel *getAddressTableModel();
TransactionTableModel *getTransactionTableModel(); TransactionTableModel *getTransactionTableModel();
qint64 getBalance(); qint64 getBalance() const;
QString getAddress(); QString getAddress() const;
int getNumConnections(); int getNumConnections() const;
int getNumBlocks(); int getNumBlocks() const;
int getNumTransactions(); int getNumTransactions() const;
/* Return true if core is doing initial block download */
bool inInitialBlockDownload() const;
/* Set default address */ /* Set default address */
void setAddress(const QString &defaultAddress); void setAddress(const QString &defaultAddress);

Loading…
Cancel
Save