2011-07-05 22:09:39 +02:00
|
|
|
#include "overviewpage.h"
|
|
|
|
#include "ui_overviewpage.h"
|
|
|
|
|
2011-07-11 20:42:10 +02:00
|
|
|
#include "walletmodel.h"
|
2011-07-05 22:09:39 +02:00
|
|
|
#include "guiutil.h"
|
|
|
|
|
|
|
|
OverviewPage::OverviewPage(QWidget *parent) :
|
|
|
|
QWidget(parent),
|
|
|
|
ui(new Ui::OverviewPage)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
// Balance: <balance>
|
|
|
|
ui->labelBalance->setFont(QFont("Monospace", -1, QFont::Bold));
|
|
|
|
ui->labelBalance->setToolTip(tr("Your current balance"));
|
|
|
|
ui->labelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
|
|
|
|
|
2011-07-11 20:42:10 +02:00
|
|
|
// Balance: <balance>
|
|
|
|
ui->labelUnconfirmed->setFont(QFont("Monospace", -1, QFont::Bold));
|
|
|
|
ui->labelUnconfirmed->setToolTip(tr("Balance of transactions that have yet to be confirmed"));
|
|
|
|
ui->labelUnconfirmed->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
|
|
|
|
|
|
|
|
ui->labelNumTransactions->setToolTip(tr("Total number of transactions in wallet"));
|
|
|
|
|
2011-07-05 22:09:39 +02:00
|
|
|
// Overview page should show:
|
|
|
|
// Last received transaction(s)
|
|
|
|
// Last sent transaction(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
OverviewPage::~OverviewPage()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2011-07-11 20:42:10 +02:00
|
|
|
void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance)
|
2011-07-05 22:09:39 +02:00
|
|
|
{
|
|
|
|
ui->labelBalance->setText(GUIUtil::formatMoney(balance) + QString(" BTC"));
|
2011-07-11 20:42:10 +02:00
|
|
|
ui->labelUnconfirmed->setText(GUIUtil::formatMoney(unconfirmedBalance) + QString(" BTC"));
|
2011-07-05 22:09:39 +02:00
|
|
|
}
|
2011-07-07 10:59:00 +02:00
|
|
|
|
|
|
|
void OverviewPage::setNumTransactions(int count)
|
|
|
|
{
|
|
|
|
ui->labelNumTransactions->setText(QLocale::system().toString(count));
|
|
|
|
}
|
2011-07-11 20:42:10 +02:00
|
|
|
|
|
|
|
void OverviewPage::setModel(WalletModel *model)
|
|
|
|
{
|
|
|
|
this->model = model;
|
|
|
|
|
|
|
|
// Keep up to date with wallet
|
|
|
|
setBalance(model->getBalance(), model->getUnconfirmedBalance());
|
2011-07-14 21:21:17 +02:00
|
|
|
connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64)));
|
2011-07-11 20:42:10 +02:00
|
|
|
|
|
|
|
setNumTransactions(model->getNumTransactions());
|
|
|
|
connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
|
|
|
|
|
|
|
|
}
|