]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
always display restore dates next to restore heights
authortobtoht <tob@featherwallet.org>
Tue, 4 Mar 2025 13:54:04 +0000 (14:54 +0100)
committertobtoht <tob@featherwallet.org>
Tue, 4 Mar 2025 13:54:04 +0000 (14:54 +0100)
src/dialog/DebugInfoDialog.cpp
src/dialog/KeysDialog.cpp
src/dialog/SeedDialog.cpp
src/dialog/ViewOnlyDialog.cpp
src/utils/Utils.cpp
src/utils/Utils.h

index 3a6118e9a0610d82ae292db91355cf2c225791a2..2c99b317f31cf062a87c4b520e9c6f56474fd474 100644 (file)
@@ -53,8 +53,7 @@ void DebugInfoDialog::updateInfo() {
     ui->label_walletHeight->setText(QString::number(m_wallet->blockChainHeight()));
     ui->label_daemonHeight->setText(QString::number(m_wallet->daemonBlockChainHeight()));
     ui->label_targetHeight->setText(QString::number(m_wallet->daemonBlockChainTargetHeight()));
-    QDateTime restoreDate = appData()->restoreHeights[constants::networkType]->heightToDate(m_wallet->getWalletCreationHeight());
-    ui->label_restoreHeight->setText(QString("%1 (%2)").arg(QString::number(m_wallet->getWalletCreationHeight()), restoreDate.toString("yyyy-MM-dd")));
+    ui->label_restoreHeight->setText(Utils::formatRestoreHeight(m_wallet->getWalletCreationHeight()));
     ui->label_synchronized->setText(m_wallet->isSynchronized() ? "True" : "False");
 
     auto node = m_nodes->connection();
index 6c090d73c92e64504826c85bd268a4072e64da7d..6f8269cec49f9cb1da17a294b57e85fb311f1af2 100644 (file)
@@ -4,6 +4,8 @@
 #include "KeysDialog.h"
 #include "ui_KeysDialog.h"
 
+#include "utils/Utils.h"
+
 KeysDialog::KeysDialog(Wallet *wallet, QWidget *parent)
     : WindowModalDialog(parent)
     , ui(new Ui::KeysDialog)
@@ -12,7 +14,7 @@ KeysDialog::KeysDialog(Wallet *wallet, QWidget *parent)
 
     QString unavailable = "Unavailable: Key is stored on hardware device";
 
-    ui->label_restoreHeight->setText(QString::number(wallet->getWalletCreationHeight()));
+    ui->label_restoreHeight->setText(Utils::formatRestoreHeight(wallet->getWalletCreationHeight()));
     ui->label_primaryAddress->setText(wallet->address(0, 0));
     ui->label_secretSpendKey->setText(wallet->isHwBacked() ? unavailable : wallet->getSecretSpendKey());
     ui->label_secretViewKey->setText(wallet->getSecretViewKey());
index 552b9a595963ad02271d8e8825fdbc21a6ca1327..0f19b74ad14456da1fc43a91e139fbc941888e7d 100644 (file)
@@ -2,6 +2,8 @@
 // SPDX-FileCopyrightText: The Monero Project
 
 #include "SeedDialog.h"
+
+#include "Utils.h"
 #include "ui_SeedDialog.h"
 
 #include "constants.h"
@@ -14,7 +16,7 @@ SeedDialog::SeedDialog(Wallet *wallet, QWidget *parent)
     ui->setupUi(this);
     ui->label_seedIcon->setPixmap(QPixmap(":/assets/images/seed.png").scaledToWidth(64, Qt::SmoothTransformation));
 
-    ui->label_restoreHeight->setText(QString::number(m_wallet->getWalletCreationHeight()));
+    ui->label_restoreHeight->setText(Utils::formatRestoreHeight(m_wallet->getWalletCreationHeight()));
 
     if (m_wallet->getSeedLanguage().isEmpty()) {
         qDebug() << "No seed language set, using default";
index e6925a2b0cccf0777dc2c122765246de8354bb9d..345972b8df566f5731a8e5b347fdcf144df56152 100644 (file)
@@ -20,7 +20,7 @@ ViewOnlyDialog::ViewOnlyDialog(Wallet *wallet, QWidget *parent)
 {
     ui->setupUi(this);
 
-    ui->label_restoreHeight->setText(QString::number(m_wallet->getWalletCreationHeight()));
+    ui->label_restoreHeight->setText(Utils::formatRestoreHeight(wallet->getWalletCreationHeight()));
     ui->label_primaryAddress->setText(m_wallet->address(0, 0));
     ui->label_secretViewKey->setText(m_wallet->getSecretViewKey());
 
index 14cad6a9b0eb22c213cdd9835732020a6fc47f2c..72322ba964057afc229ba9da83cf36e8afe3fc0e 100644 (file)
@@ -21,6 +21,7 @@
 #include "config-feather.h"
 #include "constants.h"
 #include "networktype.h"
+#include "utils/AppData.h"
 #include "utils/ColorScheme.h"
 #include "utils/config.h"
 #include "utils/os/tails.h"
@@ -695,6 +696,11 @@ QString formatSyncStatus(quint64 height, quint64 target, bool daemonSync) {
     return "Synchronized";
 }
 
+QString formatRestoreHeight(quint64 height) {
+    const QDateTime restoreDate = appData()->restoreHeights[constants::networkType]->heightToDate(height);
+    return QString("%1  (%2)").arg(QString::number(height), restoreDate.toString("yyyy-MM-dd"));
+}
+
 QString getVersion() {
     QString version = QString("%1").arg(FEATHER_VERSION);
 #ifdef OFFICIAL_BUILD
index 7b6d6f43d1c2d7d6a0e235e762d6a54ba4ee273b..22bba27fd829a61c7d8497a0f8a4bce9233fddd8 100644 (file)
@@ -119,6 +119,7 @@ namespace Utils
     void clearLayout(QLayout *layout, bool deleteWidgets = true);
 
     QString formatSyncStatus(quint64 height, quint64 target, bool daemonSync = false);
+    QString formatRestoreHeight(quint64 height);
 
     QString getVersion();
 }