Browse Source

fix balance display, display number of transactions

miguelfreitas
Wladimir J. van der Laan 14 years ago
parent
commit
dd8e82f797
  1. 2
      gui/include/bitcoingui.h
  2. 4
      gui/include/clientmodel.h
  3. 2
      gui/include/transactiontablemodel.h
  4. 12
      gui/src/bitcoingui.cpp
  5. 9
      gui/src/clientmodel.cpp
  6. 6
      gui/src/transactiontablemodel.cpp

2
gui/include/bitcoingui.h

@ -52,7 +52,7 @@ private: @@ -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);

4
gui/include/clientmodel.h

@ -9,14 +9,14 @@ class ClientModel : public QObject @@ -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);

2
gui/include/transactiontablemodel.h

@ -37,6 +37,8 @@ public: @@ -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;

12
gui/src/bitcoingui.cpp

@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
#include "aboutdialog.h"
#include "clientmodel.h"
#include "main.h"
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>
@ -268,9 +270,9 @@ void BitcoinGUI::copyClipboardClicked() @@ -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) @@ -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));
}

9
gui/src/clientmodel.cpp

@ -17,7 +17,7 @@ ClientModel::ClientModel(QObject *parent) : @@ -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() @@ -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()

6
gui/src/transactiontablemodel.cpp

@ -85,6 +85,12 @@ TransactionTableModel::~TransactionTableModel() @@ -85,6 +85,12 @@ TransactionTableModel::~TransactionTableModel()
delete impl;
}
void TransactionTableModel::updateWallet()
{
beginResetModel();
impl->updateWallet();
endResetModel();
}
int TransactionTableModel::rowCount(const QModelIndex &parent) const
{

Loading…
Cancel
Save