mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 11:44:14 +01:00
Add boolean HaveWatchonly and signal NotifyWatchonlyChanged
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user