diff --git a/src/wizard/createwalletseed.cpp b/src/wizard/createwalletseed.cpp index 1375529..1e538b5 100644 --- a/src/wizard/createwalletseed.cpp +++ b/src/wizard/createwalletseed.cpp @@ -27,26 +27,36 @@ CreateWalletSeedPage::CreateWalletSeedPage(AppContext *ctx, QWidget *parent) : connect(ui->btnRoulette, &QPushButton::clicked, [=]{ this->seedRoulette(0); }); + connect(ui->btnCopy, &QPushButton::clicked, [this]{ + Utils::copyToClipboard(m_mnemonic); + }); this->setButtonText(QWizard::FinishButton, "Create/Open wallet"); +} - // generate new seed - this->seedRoulette(m_rouletteSpin - 1); +void CreateWalletSeedPage::initializePage() { + this->generateSeed(); } void CreateWalletSeedPage::seedRoulette(int count) { count += 1; - if(count > m_rouletteSpin) return; - FeatherSeed seed = FeatherSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName, m_ctx->seedLanguage); - m_mnemonic = seed.mnemonic.join(" "); - m_restoreHeight = seed.restoreHeight; + if (count > m_rouletteSpin) + return; + + this->generateSeed(); - this->displaySeed(m_mnemonic); QTimer::singleShot(10, [=] { this->seedRoulette(count); }); } +void CreateWalletSeedPage::generateSeed() { + FeatherSeed seed = FeatherSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName, m_ctx->seedLanguage); + m_mnemonic = seed.mnemonic.join(" "); + m_restoreHeight = seed.restoreHeight; + this->displaySeed(m_mnemonic); +} + void CreateWalletSeedPage::displaySeed(const QString &seed){ QStringList seedSplit = seed.split(" "); diff --git a/src/wizard/createwalletseed.h b/src/wizard/createwalletseed.h index 7f4f9a5..986068d 100644 --- a/src/wizard/createwalletseed.h +++ b/src/wizard/createwalletseed.h @@ -21,6 +21,7 @@ class CreateWalletSeedPage : public QWizardPage public: explicit CreateWalletSeedPage(AppContext *ctx, QWidget *parent = nullptr); + void initializePage() override; bool validatePage() override; int nextId() const override; @@ -29,6 +30,7 @@ public slots: private: void seedRoulette(int count); + void generateSeed(); signals: void createWallet(); diff --git a/src/wizard/createwalletseed.ui b/src/wizard/createwalletseed.ui index ec98325..7ab57fb 100644 --- a/src/wizard/createwalletseed.ui +++ b/src/wizard/createwalletseed.ui @@ -7,371 +7,145 @@ 0 0 775 - 571 + 529 WizardPage + + 0 + - - - - - 1 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 2 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 3 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 4 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - - - - - 5 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 6 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 7 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 8 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - - - - - 9 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 10 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - - - - - 11 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - - + + + 2 + - - - 12 - - - - 5 - - - 6 - - - 5 - - - 5 - - - - - TextLabel - - - - - + + + + + 1 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 2 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 3 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 4 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + - - - - - + - + - 13 + 5 - + 5 @@ -385,7 +159,7 @@ 5 - + TextLabel @@ -395,11 +169,11 @@ - + - 14 + 6 - + 5 @@ -413,7 +187,63 @@ 5 - + + + TextLabel + + + + + + + + + + 7 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 8 + + + + 5 + + + 6 + + + 5 + + + 5 + + + TextLabel @@ -425,39 +255,189 @@ - + + + + + 9 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 10 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 11 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + - - - + + + 12 + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + - + - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 0 - + + + 13 - + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + - - - Qt::NoFocus + + + 14 + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + + + - Generate + @@ -467,13 +447,6 @@ - - - - Qt::NoFocus - - - @@ -489,8 +462,35 @@ + + + + Qt::NoFocus + + + Copy + + + + + + + Qt::NoFocus + + + Generate + + + + + + + Qt::NoFocus + + + @@ -500,7 +500,7 @@ - Please save these 14 words on paper (order is important). This seed will allow you to recover your wallet in case of computer failure. + Please save these 14 words on paper. This seed will allow you to recover your wallet in case of computer failure. true