From: tobtoht Date: Tue, 4 Mar 2025 13:54:04 +0000 (+0100) Subject: always display restore dates next to restore heights X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=e55afe94296d972e67ae3c7a8dcc2372bd95d439;p=gamesguru%2Ffeather.git always display restore dates next to restore heights --- diff --git a/src/dialog/DebugInfoDialog.cpp b/src/dialog/DebugInfoDialog.cpp index 3a6118e9..2c99b317 100644 --- a/src/dialog/DebugInfoDialog.cpp +++ b/src/dialog/DebugInfoDialog.cpp @@ -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(); diff --git a/src/dialog/KeysDialog.cpp b/src/dialog/KeysDialog.cpp index 6c090d73..6f8269ce 100644 --- a/src/dialog/KeysDialog.cpp +++ b/src/dialog/KeysDialog.cpp @@ -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()); diff --git a/src/dialog/SeedDialog.cpp b/src/dialog/SeedDialog.cpp index 552b9a59..0f19b74a 100644 --- a/src/dialog/SeedDialog.cpp +++ b/src/dialog/SeedDialog.cpp @@ -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"; diff --git a/src/dialog/ViewOnlyDialog.cpp b/src/dialog/ViewOnlyDialog.cpp index e6925a2b..345972b8 100644 --- a/src/dialog/ViewOnlyDialog.cpp +++ b/src/dialog/ViewOnlyDialog.cpp @@ -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()); diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp index 14cad6a9..72322ba9 100644 --- a/src/utils/Utils.cpp +++ b/src/utils/Utils.cpp @@ -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 diff --git a/src/utils/Utils.h b/src/utils/Utils.h index 7b6d6f43..22bba27f 100644 --- a/src/utils/Utils.h +++ b/src/utils/Utils.h @@ -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(); }