fix balance display, display number of transactions
This commit is contained in:
parent
f79efbab6f
commit
dd8e82f797
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
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));
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -85,6 +85,12 @@ TransactionTableModel::~TransactionTableModel()
|
||||
delete impl;
|
||||
}
|
||||
|
||||
void TransactionTableModel::updateWallet()
|
||||
{
|
||||
beginResetModel();
|
||||
impl->updateWallet();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user