mirror of
https://git.wownero.com/wowlet/wowlet.git
synced 2024-08-15 01:03:14 +00:00
SeedDialog: add 25 word seed toggle
This commit is contained in:
parent
b66aceccc8
commit
0f3c005b60
4 changed files with 41 additions and 20 deletions
|
@ -4,27 +4,43 @@
|
||||||
#include "ui_seeddialog.h"
|
#include "ui_seeddialog.h"
|
||||||
#include "seeddialog.h"
|
#include "seeddialog.h"
|
||||||
|
|
||||||
SeedDialog::SeedDialog(const QString &seed, QWidget *parent)
|
SeedDialog::SeedDialog(Wallet *wallet, QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, ui(new Ui::SeedDialog)
|
, ui(new Ui::SeedDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->label_seedIcon->setPixmap(QPixmap(":/assets/images/seed.png").scaledToWidth(64, Qt::SmoothTransformation));
|
ui->label_seedIcon->setPixmap(QPixmap(":/assets/images/seed.png").scaledToWidth(64, Qt::SmoothTransformation));
|
||||||
|
|
||||||
|
QString seed_14_words = wallet->getCacheAttribute("feather.seed");
|
||||||
|
QString seed_25_words = wallet->getSeed();
|
||||||
|
|
||||||
|
if (seed_14_words.isEmpty()) {
|
||||||
|
ui->check_toggleSeedType->hide();
|
||||||
|
this->setSeed(seed_25_words);
|
||||||
|
} else {
|
||||||
|
this->setSeed(seed_14_words);
|
||||||
|
connect(ui->check_toggleSeedType, &QCheckBox::toggled, [this, seed_25_words, seed_14_words](bool toggled){
|
||||||
|
this->setSeed(toggled ? seed_25_words : seed_14_words);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this->adjustSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SeedDialog::setSeed(const QString &seed) {
|
||||||
ui->seed->setPlainText(seed);
|
ui->seed->setPlainText(seed);
|
||||||
|
|
||||||
int words = seed.split(" ").size();
|
int words = seed.split(" ").size();
|
||||||
ui->label_warning->setText(QString("<p>Please save these %1 words on paper (order is important). "
|
ui->label_warning->setText(QString("<p>Please save these %1 words on paper (order is important). "
|
||||||
"This seed will allow you to recover your wallet in case "
|
"This seed will allow you to recover your wallet in case "
|
||||||
"of computer failure."
|
"of computer failure."
|
||||||
"</p>"
|
"</p>"
|
||||||
"<b>WARNING:</b>"
|
"<b>WARNING:</b>"
|
||||||
"<ul>"
|
"<ul>"
|
||||||
"<li>Never disclose your seed.</li>"
|
"<li>Never disclose your seed.</li>"
|
||||||
"<li>Never type it on a website</li>"
|
"<li>Never type it on a website</li>"
|
||||||
"<li>Do not store it electronically</li>"
|
"<li>Do not store it electronically</li>"
|
||||||
"</ul>").arg(words));
|
"</ul>").arg(words));
|
||||||
|
|
||||||
this->adjustSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SeedDialog::~SeedDialog()
|
SeedDialog::~SeedDialog()
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#define FEATHER_SEEDDIALOG_H
|
#define FEATHER_SEEDDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include "libwalletqt/Wallet.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SeedDialog;
|
class SeedDialog;
|
||||||
|
@ -15,10 +16,12 @@ class SeedDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SeedDialog(const QString& seed, QWidget *parent = nullptr);
|
explicit SeedDialog(Wallet *wallet, QWidget *parent = nullptr);
|
||||||
~SeedDialog() override;
|
~SeedDialog() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setSeed(const QString &seed);
|
||||||
|
|
||||||
Ui::SeedDialog *ui;
|
Ui::SeedDialog *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>542</width>
|
<width>542</width>
|
||||||
<height>244</height>
|
<height>259</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -57,6 +57,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="check_toggleSeedType">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show 25 word seed</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_warning">
|
<widget class="QLabel" name="label_warning">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -851,12 +851,7 @@ void MainWindow::showWalletInfoDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showSeedDialog() {
|
void MainWindow::showSeedDialog() {
|
||||||
QString seed = m_ctx->currentWallet->getCacheAttribute("feather.seed");
|
auto *dialog = new SeedDialog(m_ctx->currentWallet, this);
|
||||||
if (seed.isEmpty()) {
|
|
||||||
seed = m_ctx->currentWallet->getSeed();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto *dialog = new SeedDialog(seed, this);
|
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
dialog->deleteLater();
|
dialog->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue