aboutsummaryrefslogtreecommitdiff
path: root/src/qt/overviewpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r--src/qt/overviewpage.cpp24
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")