diff --git a/gui/include/bitcoingui.h b/gui/include/bitcoingui.h index 3b722fcca4..80c24a3733 100644 --- a/gui/include/bitcoingui.h +++ b/gui/include/bitcoingui.h @@ -52,7 +52,7 @@ private: void createTrayIcon(); public slots: - void setBalance(double balance); + void setBalance(qint64 balance); void setAddress(const QString &address); void setNumConnections(int count); void setNumBlocks(int count); diff --git a/gui/include/clientmodel.h b/gui/include/clientmodel.h index fb1a5edebc..a5613e34b6 100644 --- a/gui/include/clientmodel.h +++ b/gui/include/clientmodel.h @@ -9,14 +9,14 @@ class ClientModel : public QObject public: explicit ClientModel(QObject *parent = 0); - double getBalance(); + qint64 getBalance(); QString getAddress(); int getNumConnections(); int getNumBlocks(); int getNumTransactions(); signals: - void balanceChanged(double balance); + void balanceChanged(qint64 balance); void addressChanged(const QString &address); void numConnectionsChanged(int count); void numBlocksChanged(int count); diff --git a/gui/include/transactiontablemodel.h b/gui/include/transactiontablemodel.h index 2ff3b0cbe1..1ea749d86a 100644 --- a/gui/include/transactiontablemodel.h +++ b/gui/include/transactiontablemodel.h @@ -37,6 +37,8 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role) const; Qt::ItemFlags flags(const QModelIndex &index) const; QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const; +public slots: + void updateWallet(); private: QStringList columns; TransactionTableImpl *impl; diff --git a/gui/src/bitcoingui.cpp b/gui/src/bitcoingui.cpp index d7a71fc56c..831bef3f20 100644 --- a/gui/src/bitcoingui.cpp +++ b/gui/src/bitcoingui.cpp @@ -11,6 +11,8 @@ #include "aboutdialog.h" #include "clientmodel.h" +#include "main.h" + #include #include #include @@ -268,9 +270,9 @@ void BitcoinGUI::copyClipboardClicked() QApplication::clipboard()->setText(address->text()); } -void BitcoinGUI::setBalance(double balance) +void BitcoinGUI::setBalance(qint64 balance) { - labelBalance->setText(QLocale::system().toString(balance, 8)); + labelBalance->setText(QString::fromStdString(FormatMoney(balance))); } void BitcoinGUI::setAddress(const QString &addr) @@ -280,15 +282,15 @@ void BitcoinGUI::setAddress(const QString &addr) void BitcoinGUI::setNumConnections(int count) { - labelConnections->setText(QLocale::system().toString(count)+" "+tr("connections")); + labelConnections->setText(QLocale::system().toString(count)+" "+tr("connections(s)", "", count)); } void BitcoinGUI::setNumBlocks(int count) { - labelBlocks->setText(QLocale::system().toString(count)+" "+tr("blocks")); + labelBlocks->setText(QLocale::system().toString(count)+" "+tr("block(s)", "", count)); } void BitcoinGUI::setNumTransactions(int count) { - labelTransactions->setText(QLocale::system().toString(count)+" "+tr("transactions")); + labelTransactions->setText(QLocale::system().toString(count)+" "+tr("transaction(s)", "", count)); } diff --git a/gui/src/clientmodel.cpp b/gui/src/clientmodel.cpp index 0f191023b7..cc52df4123 100644 --- a/gui/src/clientmodel.cpp +++ b/gui/src/clientmodel.cpp @@ -17,7 +17,7 @@ ClientModel::ClientModel(QObject *parent) : timer->start(MODEL_UPDATE_DELAY); } -double ClientModel::getBalance() +qint64 ClientModel::getBalance() { return GetBalance(); } @@ -45,7 +45,12 @@ int ClientModel::getNumBlocks() int ClientModel::getNumTransactions() { - return 0; + int numTransactions = 0; + CRITICAL_BLOCK(cs_mapWallet) + { + numTransactions = mapWallet.size(); + } + return numTransactions; } void ClientModel::update() diff --git a/gui/src/transactiontablemodel.cpp b/gui/src/transactiontablemodel.cpp index ffc2472f2f..900cb6daa8 100644 --- a/gui/src/transactiontablemodel.cpp +++ b/gui/src/transactiontablemodel.cpp @@ -85,6 +85,12 @@ TransactionTableModel::~TransactionTableModel() delete impl; } +void TransactionTableModel::updateWallet() +{ + beginResetModel(); + impl->updateWallet(); + endResetModel(); +} int TransactionTableModel::rowCount(const QModelIndex &parent) const {