From f9d1723f6eae7309f697adb71fbce30e2d7b7bd5 Mon Sep 17 00:00:00 2001 From: Krystie Date: Wed, 1 Jul 2026 21:32:58 -0700 Subject: [PATCH] qt: HD wallet status indicator in status bar Add a [HD] label next to the lock icon that shows whether the wallet has a BIP39 HD seed active: - Red (#f26522, TRI brand color) when HD is enabled - Grey (#555555) when wallet is non-HD (legacy key pool) Tooltip on hover explains what HD means and what the user must back up to be able to restore the wallet. Wired through a new updateHDStatus() slot that reads the public WalletModel::hdEnabled() accessor and is called when the wallet model is set. Lives in the icon cluster of the status bar; the .onion and .b32.i2p address text sits in a separate group on the right, so no crowding. Closes the visible-state gap: the wallet already supported HD seeds (BIP39/BIP32) and had a hdseeddialog, but there was no visual confirmation of HD status anywhere in the UI. --- src/qt/forms/mainwindow.ui | 17 +++++++++++++++++ src/qt/trianglesgui.cpp | 32 +++++++++++++++++++++++++++++++- src/qt/trianglesgui.h | 2 ++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/qt/forms/mainwindow.ui b/src/qt/forms/mainwindow.ui index 95ebcee..bb85023 100644 --- a/src/qt/forms/mainwindow.ui +++ b/src/qt/forms/mainwindow.ui @@ -1663,6 +1663,23 @@ QProgressBar::chunk { + + + + + 9 + 75 + true + + + + HD (BIP39) wallet seed status + + + HD + + + diff --git a/src/qt/trianglesgui.cpp b/src/qt/trianglesgui.cpp index a0b62eb..b9d8e1c 100644 --- a/src/qt/trianglesgui.cpp +++ b/src/qt/trianglesgui.cpp @@ -359,6 +359,11 @@ TrianglesGUI::TrianglesGUI(bool fIsTestnet, QWidget *parent): labelV3Icon = ui->label_v3; labelV3Icon->setVisible(false); + // HD indicator next to lock icon (always visible; color reflects state) + labelHdIcon = ui->label_hd; + labelHdIcon->setVisible(true); + updateHDStatus(); + // Tor icon next to onion address in the stacked address group (hidden until populated) labelTorIcon = ui->label_tor_icon; labelTorIcon->setVisible(false); @@ -650,6 +655,9 @@ void TrianglesGUI::setWalletModel(WalletModel *walletModel) connect(walletModel, SIGNAL(transactionSyncProgressChanged(bool,int)), this, SLOT(setWalletTransactionSyncProgress(bool,int))); setWalletTransactionSyncState(walletModel->isTransactionSyncing()); + // HD status reflects wallet capability — refresh whenever the wallet model changes + updateHDStatus(); + // Balloon pop-up for new transaction connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(incomingTransaction(QModelIndex,int,int))); @@ -1866,16 +1874,38 @@ void TrianglesGUI::updateI2PAddress() labelI2PIcon->setVisible(false); } + // I2P address text if (!hasI2P) { labelI2PAddress->setVisible(false); return; } - labelI2PAddress->setText(QString::fromStdString(i2pAddress)); labelI2PAddress->setToolTip(tr("This node's I2P .b32.i2p address. Click to copy.")); labelI2PAddress->setVisible(true); } +void TrianglesGUI::updateHDStatus() +{ + // Red (#f26522 — TRI brand color) when HD is enabled, grey when not. + // Placed next to the lock icon as a wallet-capability indicator. + if (!labelHdIcon) return; + + bool fHD = false; + if (walletModel) { + fHD = walletModel->hdEnabled(); + } + + if (fHD) { + labelHdIcon->setStyleSheet("color: #f26522; font-weight: bold;"); + labelHdIcon->setToolTip(tr("HD wallet: BIP39 seed active. Backup your seed phrase — individual keys alone will not restore this wallet.")); + } else { + labelHdIcon->setStyleSheet("color: #555555; font-weight: bold;"); + labelHdIcon->setToolTip(tr("Non-HD wallet: backup each address key separately. Use hdnew to upgrade to an HD seed.")); + } + labelHdIcon->setText(QStringLiteral("HD")); + labelHdIcon->setVisible(true); +} + void TrianglesGUI::on_bHelp_clicked() { diff --git a/src/qt/trianglesgui.h b/src/qt/trianglesgui.h index 366e2f6..566da5f 100644 --- a/src/qt/trianglesgui.h +++ b/src/qt/trianglesgui.h @@ -114,6 +114,7 @@ private: QLabel *labelV3Icon; QLabel *labelI2PIcon; QLabel *labelTorIcon; + QLabel *labelHdIcon; QLabel *progressBarLabel; QProgressBar *progressBar; @@ -182,6 +183,7 @@ public slots: void setWalletTransactionSyncProgress(bool syncing, int pendingNotifications); void updateOnionAddress(); void updateI2PAddress(); + void updateHDStatus(); /** Notify the user of an error in the network or transaction handling code. */ void error(const QString &title, const QString &message, bool modal);