Move onion address to status bar, add toggle in Options

- Remove onion address label from overview page (was cutting into
  transaction list area)
- Add it to the left side of the main window status bar instead,
  opposite the sync/connection icons
- Add "Show .onion address in status bar" checkbox under Options >
  Display (enabled by default)
- Polls every 5 seconds; hidden until the address is available

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 22:31:26 -07:00
parent 94df26a0e0
commit b41d1be128
10 changed files with 117 additions and 64 deletions
+39 -2
View File
@@ -1383,7 +1383,7 @@ QLabel {
color: #f26522;
}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,1,0,1,0,0,0,0,0,0">
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0,0,1,0,1,0,0,0,0,0,0">
<property name="leftMargin">
<number>0</number>
</property>
@@ -1406,7 +1406,44 @@ QLabel {
</property>
<property name="sizeHint" stdset="0">
<size>
<width>70</width>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_onion">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>This wallet's Tor .onion address</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_onion">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
+21
View File
@@ -1506,6 +1506,27 @@ QCheckBox::indicator:checked {
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showOnionAddress">
<property name="toolTip">
<string>Whether to show this wallet's .onion address in the status bar.</string>
</property>
<property name="styleSheet">
<string notr="true">QCheckBox::indicator {
border:1px solid #f26522;
background-color: #000;
}
QCheckBox::indicator:checked {
image:url(:/icons/checkbox);
padding: 1px;
}</string>
</property>
<property name="text">
<string>Show .onion address in status &amp;bar</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_Display">
<property name="orientation">
-37
View File
@@ -678,43 +678,6 @@ QWidget#line {
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelOnionAddressText">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Wallet Onion:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="labelOnionAddress">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="toolTip">
<string>This wallet's Tor .onion address.</string>
</property>
<property name="text">
<string notr="true">Initializing Tor identity...</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
+1
View File
@@ -206,6 +206,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
mapper->addMapping(ui->showOnionAddress, OptionsModel::ShowOnionAddress);
}
void OptionsDialog::enableApplyButton()
+14
View File
@@ -51,6 +51,7 @@ void OptionsModel::Init()
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
fShowOnionAddress = settings.value("fShowOnionAddress", true).toBool();
nTransactionFee = settings.value("nTransactionFee").toLongLong();
nReserveBalance = settings.value("nReserveBalance").toLongLong();
language = settings.value("language", "").toString();
@@ -126,6 +127,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return settings.value("language", "");
case CoinControlFeatures:
return QVariant(fCoinControlFeatures);
case ShowOnionAddress:
return QVariant(fShowOnionAddress);
default:
return QVariant();
}
@@ -226,6 +229,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
emit coinControlFeaturesChanged(fCoinControlFeatures);
}
break;
case ShowOnionAddress: {
fShowOnionAddress = value.toBool();
settings.setValue("fShowOnionAddress", fShowOnionAddress);
emit showOnionAddressChanged(fShowOnionAddress);
}
break;
default:
break;
}
@@ -269,3 +278,8 @@ bool OptionsModel::getDisplayAddresses()
{
return bDisplayAddresses;
}
bool OptionsModel::getShowOnionAddress()
{
return fShowOnionAddress;
}
+4
View File
@@ -32,6 +32,7 @@ public:
DetachDatabases, // bool
Language, // QString
CoinControlFeatures, // bool
ShowOnionAddress, // bool
OptionIDRowCount,
};
@@ -52,6 +53,7 @@ public:
int getDisplayUnit();
bool getDisplayAddresses();
bool getCoinControlFeatures();
bool getShowOnionAddress();
QString getLanguage() { return language; }
private:
@@ -60,6 +62,7 @@ private:
bool fMinimizeToTray;
bool fMinimizeOnClose;
bool fCoinControlFeatures;
bool fShowOnionAddress;
QString language;
signals:
@@ -67,6 +70,7 @@ signals:
void transactionFeeChanged(qint64);
void reserveBalanceChanged(qint64);
void coinControlFeaturesChanged(bool);
void showOnionAddressChanged(bool);
};
#endif // OPTIONSMODEL_H
-23
View File
@@ -8,8 +8,6 @@
#include "transactionfilterproxy.h"
#include "guiutil.h"
#include "guiconstants.h"
#include "tor/tor_embedded.h"
#include "tor/onion_v3.h"
#include <QAbstractItemDelegate>
#include <QPainter>
@@ -117,10 +115,6 @@ OverviewPage::OverviewPage(QWidget *parent) :
// start with displaying the "out of sync" warnings
showOutOfSyncWarning(true);
QTimer *onionRefreshTimer = new QTimer(this);
connect(onionRefreshTimer, SIGNAL(timeout()), this, SLOT(updateOnionAddress()));
onionRefreshTimer->start(5000);
updateOnionAddress();
}
void OverviewPage::handleTransactionClicked(const QModelIndex &index)
@@ -137,7 +131,6 @@ OverviewPage::~OverviewPage()
void OverviewPage::setClientModel(ClientModel *clientModel)
{
this->clientModel = clientModel;
updateOnionAddress();
}
void OverviewPage::setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance, qint64 immatureBalance)
@@ -229,19 +222,3 @@ void OverviewPage::showOutOfSyncWarning(bool fShow)
ui->labelTransactionsStatus->setVisible(fShow);
}
void OverviewPage::updateOnionAddress()
{
std::string onionAddress = CTorV3Manager::GetInstance()->GetWalletOnionAddress();
if (onionAddress.empty()) {
onionAddress = CTorEmbedded::GetInstance()->GetOnionAddress();
}
if (onionAddress.empty()) {
ui->labelOnionAddress->setText(tr("Initializing Tor identity..."));
ui->labelOnionAddress->setToolTip(tr("The wallet's .onion address will appear here once Tor and the wallet identity are ready."));
return;
}
ui->labelOnionAddress->setText(QString::fromStdString(onionAddress));
ui->labelOnionAddress->setToolTip(tr("This wallet's Tor .onion address."));
}
-1
View File
@@ -31,7 +31,6 @@ public:
public slots:
void setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance, qint64 immatureBalance);
void setTransactionSyncState(bool syncing);
void updateOnionAddress();
signals:
void transactionClicked(const QModelIndex &index);
+36 -1
View File
@@ -40,6 +40,8 @@
#include "util.h"
//#include "message_box_dialog.h"
#include "wallet.h"
#include "tor/tor_embedded.h"
#include "tor/onion_v3.h"
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
@@ -336,6 +338,14 @@ TrianglesGUI::TrianglesGUI(bool fIsTestnet, QWidget *parent):
updateStakingIcon();
}
// Onion address in status bar (hidden until populated)
labelOnionAddress = ui->label_onion;
labelOnionAddress->setVisible(false);
QTimer *timerOnion = new QTimer(this);
connect(timerOnion, SIGNAL(timeout()), this, SLOT(updateOnionAddress()));
timerOnion->start(5000);
updateOnionAddress();
QTimer *timerShutdown = new QTimer(this);
connect(timerShutdown, SIGNAL(timeout()), this, SLOT(detectShutdown()));
timerShutdown->start(200);
@@ -567,9 +577,11 @@ void TrianglesGUI::setClientModel(ClientModel *clientModel)
if (rpcConsole)
rpcConsole->setClientModel(clientModel);
overviewPage->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
connect(clientModel->getOptionsModel(), SIGNAL(showOnionAddressChanged(bool)), this, SLOT(updateOnionAddress()));
updateOnionAddress();
}
}
@@ -1716,6 +1728,29 @@ void TrianglesGUI::detectShutdown()
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
}
void TrianglesGUI::updateOnionAddress()
{
// Check if user has opted out via Options > Display
if (clientModel && clientModel->getOptionsModel() &&
!clientModel->getOptionsModel()->getShowOnionAddress()) {
labelOnionAddress->setVisible(false);
return;
}
std::string onionAddress = CTorV3Manager::GetInstance()->GetWalletOnionAddress();
if (onionAddress.empty())
onionAddress = CTorEmbedded::GetInstance()->GetOnionAddress();
if (onionAddress.empty()) {
labelOnionAddress->setVisible(false);
return;
}
labelOnionAddress->setText(QString::fromStdString(onionAddress));
labelOnionAddress->setToolTip(tr("This wallet's Tor .onion address. Selectable — right-click to copy."));
labelOnionAddress->setVisible(true);
}
void TrianglesGUI::on_bHelp_clicked()
{
+2
View File
@@ -109,6 +109,7 @@ private:
QLabel *labelStakingIcon;
QLabel *labelConnectionsIcon;
QLabel *labelBlocksIcon;
QLabel *labelOnionAddress;
QLabel *progressBarLabel;
QProgressBar *progressBar;
@@ -174,6 +175,7 @@ public slots:
void setEncryptionStatus(int status);
void setWalletTransactionSyncState(bool syncing);
void setWalletTransactionSyncProgress(bool syncing, int pendingNotifications);
void updateOnionAddress();
/** Notify the user of an error in the network or transaction handling code. */
void error(const QString &title, const QString &message, bool modal);