fix balance display, display number of transactions
This commit is contained in:
parent
f79efbab6f
commit
dd8e82f797
@ -52,7 +52,7 @@ private:
|
|||||||
void createTrayIcon();
|
void createTrayIcon();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setBalance(double balance);
|
void setBalance(qint64 balance);
|
||||||
void setAddress(const QString &address);
|
void setAddress(const QString &address);
|
||||||
void setNumConnections(int count);
|
void setNumConnections(int count);
|
||||||
void setNumBlocks(int count);
|
void setNumBlocks(int count);
|
||||||
|
@ -9,14 +9,14 @@ class ClientModel : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit ClientModel(QObject *parent = 0);
|
explicit ClientModel(QObject *parent = 0);
|
||||||
|
|
||||||
double getBalance();
|
qint64 getBalance();
|
||||||
QString getAddress();
|
QString getAddress();
|
||||||
int getNumConnections();
|
int getNumConnections();
|
||||||
int getNumBlocks();
|
int getNumBlocks();
|
||||||
int getNumTransactions();
|
int getNumTransactions();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void balanceChanged(double balance);
|
void balanceChanged(qint64 balance);
|
||||||
void addressChanged(const QString &address);
|
void addressChanged(const QString &address);
|
||||||
void numConnectionsChanged(int count);
|
void numConnectionsChanged(int count);
|
||||||
void numBlocksChanged(int count);
|
void numBlocksChanged(int count);
|
||||||
|
@ -37,6 +37,8 @@ public:
|
|||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
|
QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
|
||||||
|
public slots:
|
||||||
|
void updateWallet();
|
||||||
private:
|
private:
|
||||||
QStringList columns;
|
QStringList columns;
|
||||||
TransactionTableImpl *impl;
|
TransactionTableImpl *impl;
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "aboutdialog.h"
|
#include "aboutdialog.h"
|
||||||
#include "clientmodel.h"
|
#include "clientmodel.h"
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
@ -268,9 +270,9 @@ void BitcoinGUI::copyClipboardClicked()
|
|||||||
QApplication::clipboard()->setText(address->text());
|
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)
|
void BitcoinGUI::setAddress(const QString &addr)
|
||||||
@ -280,15 +282,15 @@ void BitcoinGUI::setAddress(const QString &addr)
|
|||||||
|
|
||||||
void BitcoinGUI::setNumConnections(int count)
|
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)
|
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)
|
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);
|
timer->start(MODEL_UPDATE_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ClientModel::getBalance()
|
qint64 ClientModel::getBalance()
|
||||||
{
|
{
|
||||||
return GetBalance();
|
return GetBalance();
|
||||||
}
|
}
|
||||||
@ -45,7 +45,12 @@ int ClientModel::getNumBlocks()
|
|||||||
|
|
||||||
int ClientModel::getNumTransactions()
|
int ClientModel::getNumTransactions()
|
||||||
{
|
{
|
||||||
return 0;
|
int numTransactions = 0;
|
||||||
|
CRITICAL_BLOCK(cs_mapWallet)
|
||||||
|
{
|
||||||
|
numTransactions = mapWallet.size();
|
||||||
|
}
|
||||||
|
return numTransactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientModel::update()
|
void ClientModel::update()
|
||||||
|
@ -85,6 +85,12 @@ TransactionTableModel::~TransactionTableModel()
|
|||||||
delete impl;
|
delete impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TransactionTableModel::updateWallet()
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
impl->updateWallet();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user