diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index f85de0811aa..27aa953295e 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -168,14 +168,40 @@ - + + + + Used: + + + + + + + IBeamCursor + + + Your current used balance + + + 21 000 000.00000000 BTC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + Qt::Horizontal - + @@ -194,7 +220,7 @@ - + Total: @@ -240,7 +266,7 @@ - + IBeamCursor @@ -259,7 +285,7 @@ - + IBeamCursor diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 0f00d167f76..6b785da3ccf 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -226,6 +226,15 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances) ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature); ui->labelWatchImmature->setVisible(!walletModel->wallet().privateKeysDisabled() && showWatchOnlyImmature); // show watch-only immature balance + + // only show used balance when on wallet with 'avoid_reuse' flag + bool showUsed = walletModel->isAvoidReuseEnabled(); + + if (showUsed) { + ui->labelUsed->setText(BitcoinUnits::formatWithPrivacy(unit, balances.used, BitcoinUnits::SeparatorStyle::ALWAYS, m_privacy)); + } + ui->labelUsedText->setVisible(showUsed); + ui->labelUsed->setVisible(showUsed); } // show/hide watch-only labels @@ -352,4 +361,5 @@ void OverviewPage::setMonospacedFont(bool use_embedded_font) ui->labelWatchPending->setFont(f); ui->labelWatchImmature->setFont(f); ui->labelWatchTotal->setFont(f); + ui->labelUsed->setFont(f); } diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index a45579fa0d0..74124ddd14a 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -599,6 +599,11 @@ bool WalletModel::isMultiwallet() const return m_node.walletLoader().getWallets().size() > 1; } +bool WalletModel::isAvoidReuseEnabled() const +{ + return m_wallet->isAvoidReuseEnabled(); +} + void WalletModel::refresh(bool pk_hash_only) { addressTableModel = new AddressTableModel(this, pk_hash_only); diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 68218b0c1b3..6f9c38b3350 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -148,6 +148,8 @@ class WalletModel : public QObject bool isMultiwallet() const; + bool isAvoidReuseEnabled() const; + void refresh(bool pk_hash_only = false); uint256 getLastBlockProcessed() const;