diff options
author | Cozz Lovan <cozzlovan@yahoo.com> | 2014-07-26 21:05:11 +0200 |
---|---|---|
committer | Cozz Lovan <cozzlovan@yahoo.com> | 2014-08-11 18:47:02 +0200 |
commit | 939ed97373fdea0e8ecb173f1c22eb53b9f90bb6 (patch) | |
tree | ce3d6651e29d593f422d4d199ba323e4b4ee5c10 /src/qt/overviewpage.cpp | |
parent | 8b11d3de7aa4fc3f6c4e7bf292495850034ded2c (diff) |
Add boolean HaveWatchonly and signal NotifyWatchonlyChanged
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r-- | src/qt/overviewpage.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index b5a3de48ca..8eed0856e7 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -160,18 +160,25 @@ void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 // for the non-mining users bool showImmature = immatureBalance != 0; bool showWatchOnlyImmature = watchImmatureBalance != 0; - bool showWatchOnly = (watchOnlyBalance != 0 || watchUnconfBalance != 0 || showWatchOnlyImmature); // for symmetry reasons also show immature label when the watch-only one is shown ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature); - ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active) - ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label - ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line - ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance - ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance - ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance +} + +// show/hide watch-only labels +void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly) +{ + ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active) + ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label + ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line + ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance + ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance + ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance + + if (!showWatchOnly) + ui->labelWatchImmature->hide(); } void OverviewPage::setClientModel(ClientModel *model) @@ -208,6 +215,9 @@ void OverviewPage::setWalletModel(WalletModel *model) connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64, qint64, qint64))); connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + + updateWatchOnlyLabels(model->haveWatchOnly()); + connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyLabels(bool))); } // update the display unit, to not use the default ("BTC") |