diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-11 20:42:10 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-11 20:42:10 +0200 |
commit | df5ccbd2b2c72039f1e0e69fc51957f7c2d6068d (patch) | |
tree | 9aaf5b94f95172365a44be8b78eae7b2ba382a27 /src/qt/overviewpage.cpp | |
parent | eee0d2391cb9d2c72d75c9912363392f87c7b976 (diff) |
Show unconfirmed balance on overview page
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r-- | src/qt/overviewpage.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 87f95fddf3..c620200b49 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -1,6 +1,7 @@ #include "overviewpage.h" #include "ui_overviewpage.h" +#include "walletmodel.h" #include "guiutil.h" OverviewPage::OverviewPage(QWidget *parent) : @@ -14,9 +15,14 @@ OverviewPage::OverviewPage(QWidget *parent) : ui->labelBalance->setToolTip(tr("Your current balance")); ui->labelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard); + // 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")); + // Overview page should show: - // Balance - // Unconfirmed balance // Last received transaction(s) // Last sent transaction(s) } @@ -26,12 +32,26 @@ OverviewPage::~OverviewPage() delete ui; } -void OverviewPage::setBalance(qint64 balance) +void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance) { ui->labelBalance->setText(GUIUtil::formatMoney(balance) + QString(" BTC")); + ui->labelUnconfirmed->setText(GUIUtil::formatMoney(unconfirmedBalance) + QString(" BTC")); } void OverviewPage::setNumTransactions(int count) { ui->labelNumTransactions->setText(QLocale::system().toString(count)); } + +void OverviewPage::setModel(WalletModel *model) +{ + this->model = model; + + // Keep up to date with wallet + setBalance(model->getBalance(), model->getUnconfirmedBalance()); + connect(model, SIGNAL(balanceChanged(qint64)), this, SLOT(setBalance(qint64))); + + setNumTransactions(model->getNumTransactions()); + connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int))); + +} |