]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
go back to one label only for balance; debug log it
authorgg <chown_tee@proton.me>
Wed, 14 Jan 2026 08:04:11 +0000 (03:04 -0500)
committergg <chown_tee@proton.me>
Wed, 14 Jan 2026 08:04:57 +0000 (03:04 -0500)
src/MainWindow.cpp
src/MainWindow.h

index a4cea606540e713d77fb765457ea4da8dd50eef9..db5a2300e6311631782160568d7f73f543de24f5 100644 (file)
@@ -159,28 +159,18 @@ void MainWindow::initStatusBar() {
     m_statusUpdateAvailable->hide();
     this->statusBar()->addPermanentWidget(m_statusUpdateAvailable);
 
-    QWidget *balanceContainer = new QWidget(this);
-    balanceContainer->setAttribute(Qt::WA_TranslucentBackground);
-    QHBoxLayout *balanceLayout = new QHBoxLayout(balanceContainer);
-    balanceLayout->setContentsMargins(0, 0, 0, 0);
-    balanceLayout->setSpacing(0);
-
-    QLabel *balancePrefix = new QLabel("Balance:", this);
-    balanceLayout->addWidget(balancePrefix);
-
-    m_statusLabelBalance = new QLabel(this);
-    m_statusLabelBalance->setText("0");
+    m_statusLabelBalance = new ClickableLabel(this);
+    m_statusLabelBalance->setText("Balance: 0 XMR");
+    m_statusLabelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse);
+    m_statusLabelBalance->setCursor(Qt::PointingHandCursor);
     m_statusLabelBalance->setContextMenuPolicy(Qt::ActionsContextMenu);
-    balanceLayout->addWidget(m_statusLabelBalance);
-
-    m_statusLabelBalanceSuffix = new QLabel("XMR", this);
-    balanceLayout->addWidget(m_statusLabelBalanceSuffix);
+    this->statusBar()->addPermanentWidget(m_statusLabelBalance);
 
-    this->statusBar()->addPermanentWidget(balanceContainer);
+    connect(m_statusLabelBalance, &ClickableLabel::clicked, this, &MainWindow::showBalanceDialog);
 
-    QAction *copyBalanceAction = new QAction(tr("Copy Amount"), this);
+    QAction *copyBalanceAction = new QAction(tr("Copy amount"), this);
     connect(copyBalanceAction, &QAction::triggered, this, [this](){
-        QApplication::clipboard()->setText(m_statusLabelBalance->text());
+        QApplication::clipboard()->setText(m_statusLabelBalance->property("copyableValue").toString());
     });
     m_statusLabelBalance->addAction(copyBalanceAction);
 
@@ -916,6 +906,7 @@ void MainWindow::onBalanceUpdated(quint64 balance, quint64 spendable) {
         }
     }
 
+    // Show fiat currency if configured and balance is not hidden or spendable only.
     if (conf()->get(Config::balanceShowFiat).toBool() && !hide) {
         QString fiatCurrency = conf()->get(Config::preferredFiatCurrency).toString();
         double balanceFiatAmount = appData()->prices.convert("XMR", fiatCurrency, balance / constants::cdiv);
@@ -940,9 +931,12 @@ void MainWindow::onBalanceUpdated(quint64 balance, quint64 spendable) {
         toolTip += QString("\nLast updated: %1").arg(Utils::timeAgo(appData()->prices.lastUpdateTime));
     }
     m_statusLabelBalance->setToolTip(toolTip);
-    m_statusLabelBalance->setText(valueStr);
-    m_statusLabelBalanceSuffix->setToolTip(toolTip);
-    m_statusLabelBalanceSuffix->setText(suffixStr);
+
+    QString finalText = "Balance: " + valueStr + suffixStr;
+    qDebug() << "Setting balance label text:" << finalText;
+
+    m_statusLabelBalance->setText(finalText);
+    m_statusLabelBalance->setProperty("copyableValue", valueStr);
 }
 
 void MainWindow::setPausedSyncStatus() {
index d30dfd1aa1d170fa5735407774de1edadd84a7e3..2392392469d9c73db6ed0ed4e2ba9ed3c31984ba 100644 (file)
@@ -242,8 +242,7 @@ private:
 
     // lower status bar
     QPushButton *m_statusUpdateAvailable;
-    QLabel *m_statusLabelBalance;
-    QLabel *m_statusLabelBalanceSuffix;
+    ClickableLabel *m_statusLabelBalance;
     QLabel *m_statusLabelStatus;
     QLabel *m_statusLabelNetStats;
     StatusBarButton *m_statusAccountSwitcher;