qt: stack I2P address above Tor address in status bar; click-to-copy each
Replaces the single label_onion item inside the wStatusBar layout with a vertical group (wAddressStack) containing two rows: row 1: [I2P] <.b32.i2p address> row 2: [Tor] <.onion address> Both address labels now copy their text to the clipboard on click via the existing eventFilter pattern (extended to handle labelI2PAddress in addition to labelOnionAddress). The label_i2p, label_i2p_icon, and new label_tor_icon widgets live in mainwindow.ui so they share the same layout stretch and ordering as the rest of the status bar; the QWidget/QVBoxLayout/QHBoxLayout nesting keeps the stack compact and centered on the existing 37px -> 52px status bar height bump. Tooltips updated to "Click to copy" for both addresses (no longer "Selectable - right-click to copy") to match the actual behaviour. Tooltip wording for [Tor] chip matches the existing [V3] chip.
This commit is contained in:
+142
-22
@@ -1366,13 +1366,13 @@ QPushButton:hover {
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>37</height>
|
||||
<height>52</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>37</height>
|
||||
<height>52</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@@ -1413,26 +1413,146 @@ QLabel {
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_onion">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Click to copy .onion address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="wAddressStack" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="wI2PRow" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_i2p">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_i2p_icon">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>I2P router status</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">[I2P]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_i2p">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Click to copy .b32.i2p address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="wTorRow" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_tor">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_tor_icon">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Tor V3 hidden service status</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">[Tor]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_onion">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Click to copy .onion address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
+29
-11
@@ -353,24 +353,23 @@ TrianglesGUI::TrianglesGUI(bool fIsTestnet, QWidget *parent):
|
||||
labelV3Icon = ui->label_v3;
|
||||
labelV3Icon->setVisible(false);
|
||||
|
||||
// Tor icon next to onion address in the stacked address group (hidden until populated)
|
||||
labelTorIcon = ui->label_tor_icon;
|
||||
labelTorIcon->setVisible(false);
|
||||
|
||||
QTimer *timerOnion = new QTimer(this);
|
||||
connect(timerOnion, SIGNAL(timeout()), this, SLOT(updateOnionAddress()));
|
||||
timerOnion->start(5000);
|
||||
updateOnionAddress();
|
||||
|
||||
// I2P address in status bar (hidden until populated)
|
||||
labelI2PAddress = new QLabel(this);
|
||||
labelI2PAddress->setObjectName("label_i2p");
|
||||
labelI2PAddress->setStyleSheet("color: #6a4cff; padding-left: 4px;");
|
||||
// I2P address in status bar (hidden until populated, click to copy)
|
||||
labelI2PAddress = ui->label_i2p;
|
||||
labelI2PAddress->setVisible(false);
|
||||
labelI2PAddress->setCursor(Qt::PointingHandCursor);
|
||||
statusBar()->addPermanentWidget(labelI2PAddress);
|
||||
labelI2PAddress->installEventFilter(this);
|
||||
|
||||
labelI2PIcon = new QLabel(this);
|
||||
labelI2PIcon->setObjectName("label_i2p_icon");
|
||||
labelI2PIcon->setText("[I2P]");
|
||||
labelI2PIcon = ui->label_i2p_icon;
|
||||
labelI2PIcon->setVisible(false);
|
||||
statusBar()->addPermanentWidget(labelI2PIcon);
|
||||
|
||||
QTimer *timerI2P = new QTimer(this);
|
||||
connect(timerI2P, SIGNAL(timeout()), this, SLOT(updateI2PAddress()));
|
||||
@@ -1347,6 +1346,16 @@ bool TrianglesGUI::eventFilter(QObject *object, QEvent *event)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (object == labelI2PAddress && event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
QString addr = labelI2PAddress->text();
|
||||
if (!addr.isEmpty())
|
||||
{
|
||||
QApplication::clipboard()->setText(addr);
|
||||
QToolTip::showText(QCursor::pos(), tr("Copied!"), labelI2PAddress);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return QMainWindow::eventFilter(object, event);
|
||||
}
|
||||
|
||||
@@ -1806,6 +1815,15 @@ void TrianglesGUI::updateOnionAddress()
|
||||
labelV3Icon->setVisible(true);
|
||||
}
|
||||
|
||||
// Tor icon in the stacked address group — green when onion present, hidden otherwise
|
||||
if (hasOnion) {
|
||||
labelTorIcon->setStyleSheet("color: #7eb6ff; font-weight: bold;");
|
||||
labelTorIcon->setToolTip(tr("Tor V3 hidden service active"));
|
||||
labelTorIcon->setVisible(true);
|
||||
} else {
|
||||
labelTorIcon->setVisible(false);
|
||||
}
|
||||
|
||||
// Onion address text — respects user preference
|
||||
if (clientModel && clientModel->getOptionsModel() &&
|
||||
!clientModel->getOptionsModel()->getShowOnionAddress()) {
|
||||
@@ -1819,7 +1837,7 @@ void TrianglesGUI::updateOnionAddress()
|
||||
}
|
||||
|
||||
labelOnionAddress->setText(QString::fromStdString(onionAddress));
|
||||
labelOnionAddress->setToolTip(tr("This wallet's Tor .onion address. Selectable — right-click to copy."));
|
||||
labelOnionAddress->setToolTip(tr("This wallet's Tor .onion address. Click to copy."));
|
||||
labelOnionAddress->setVisible(true);
|
||||
}
|
||||
|
||||
@@ -1849,7 +1867,7 @@ void TrianglesGUI::updateI2PAddress()
|
||||
}
|
||||
|
||||
labelI2PAddress->setText(QString::fromStdString(i2pAddress));
|
||||
labelI2PAddress->setToolTip(tr("This node's I2P .b32.i2p address. Selectable — right-click to copy."));
|
||||
labelI2PAddress->setToolTip(tr("This node's I2P .b32.i2p address. Click to copy."));
|
||||
labelI2PAddress->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ private:
|
||||
QLabel *labelV3Icon;
|
||||
QLabel *labelI2PAddress;
|
||||
QLabel *labelI2PIcon;
|
||||
QLabel *labelTorIcon;
|
||||
QLabel *progressBarLabel;
|
||||
QProgressBar *progressBar;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user