diff options
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r-- | src/qt/overviewpage.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index d7bcc6f45e..35d48581e3 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -94,7 +94,9 @@ OverviewPage::OverviewPage(QWidget *parent) : ui(new Ui::OverviewPage), currentBalance(-1), currentUnconfirmedBalance(-1), - txdelegate(new TxViewDelegate()), filter(0) + currentImmatureBalance(-1), + txdelegate(new TxViewDelegate()), + filter(0) { ui->setupUi(this); @@ -125,13 +127,21 @@ OverviewPage::~OverviewPage() delete ui; } -void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance) +void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance) { int unit = model->getOptionsModel()->getDisplayUnit(); currentBalance = balance; currentUnconfirmedBalance = unconfirmedBalance; + currentImmatureBalance = immatureBalance; ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance)); ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, unconfirmedBalance)); + ui->labelImmature->setText(BitcoinUnits::formatWithUnit(unit, immatureBalance)); + + // only show immature (newly mined) balance if it's non-zero, so as not to complicate things + // for the non-mining users + bool showImmature = immatureBalance != 0; + ui->labelImmature->setVisible(showImmature); + ui->labelImmatureText->setVisible(showImmature); } void OverviewPage::setNumTransactions(int count) @@ -156,8 +166,8 @@ void OverviewPage::setModel(WalletModel *model) ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); // Keep up to date with wallet - setBalance(model->getBalance(), model->getUnconfirmedBalance()); - connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); + setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance()); + connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64))); setNumTransactions(model->getNumTransactions()); connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int))); @@ -171,7 +181,7 @@ void OverviewPage::displayUnitChanged() if(!model || !model->getOptionsModel()) return; if(currentBalance != -1) - setBalance(currentBalance, currentUnconfirmedBalance); + setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance); txdelegate->unit = model->getOptionsModel()->getDisplayUnit(); ui->listTransactions->update(); |