diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-29 14:36:35 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-29 14:36:35 +0200 |
commit | ee014e5b10f5f65820ff056311051ff49813b294 (patch) | |
tree | d9c0dd04b021c2c828bf55ba6ff33d93d07b5276 /src/qt/overviewpage.cpp | |
parent | b5b1d1a66b9f418c9fb293cb1cc3eac09a711c4e (diff) |
Full support for other units, add configuration option for default unit (used when displaying amounts)
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r-- | src/qt/overviewpage.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 9515117c21..c04bbf6008 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -3,10 +3,15 @@ #include "walletmodel.h" #include "bitcoinunits.h" +#include "optionsmodel.h" + +#include <QDebug> OverviewPage::OverviewPage(QWidget *parent) : QWidget(parent), - ui(new Ui::OverviewPage) + ui(new Ui::OverviewPage), + currentBalance(-1), + currentUnconfirmedBalance(-1) { ui->setupUi(this); @@ -34,8 +39,11 @@ OverviewPage::~OverviewPage() void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance) { - ui->labelBalance->setText(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, balance)); - ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, unconfirmedBalance)); + int unit = model->getOptionsModel()->getDisplayUnit(); + currentBalance = balance; + currentUnconfirmedBalance = unconfirmedBalance; + ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance)); + ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, unconfirmedBalance)); } void OverviewPage::setNumTransactions(int count) @@ -54,4 +62,11 @@ void OverviewPage::setModel(WalletModel *model) setNumTransactions(model->getNumTransactions()); connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int))); + connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(displayUnitChanged())); +} + +void OverviewPage::displayUnitChanged() +{ + if(currentBalance != -1) + setBalance(currentBalance, currentUnconfirmedBalance); } |