From 89ea34cfb7ff60b8329ebc188c434bc11693d796 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sun, 11 Oct 2020 18:17:11 +0200 Subject: [PATCH] Wizard: misc improvements to create wallet pages Don't focus on Generate button Replace HTML for PlainTextEdit Set font using Utils::relativeFont Change directory button text no longer clips Wizard Pages are no longer orphans Vertical spacers no longer take up more room than they need to GridLayout -> VerticalLayout --- src/wizard/createwallet.ui | 94 +++++++++++---------- src/wizard/createwalletseed.cpp | 9 +- src/wizard/createwalletseed.h | 2 - src/wizard/createwalletseed.ui | 141 +++++++++++++++----------------- src/wizard/walletwizard.cpp | 12 +-- 5 files changed, 124 insertions(+), 134 deletions(-) diff --git a/src/wizard/createwallet.ui b/src/wizard/createwallet.ui index 783d517..912fb43 100644 --- a/src/wizard/createwallet.ui +++ b/src/wizard/createwallet.ui @@ -7,24 +7,24 @@ 0 0 400 - 335 + 321 Create Wallet - - - - - + + - Password (Optional) + + + + QLineEdit::Password - + Qt::Vertical @@ -32,11 +32,31 @@ 20 - 40 + 0 + + + + + + + + + + Directory + + + + + + + Password (Optional) + + + @@ -47,56 +67,46 @@ - - - - Directory - - - - - - - 180 - 16777215 - - - - Change directory - - - - - - - - - - QLineEdit::Password - - - - - + + + + + Change directory + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + label_3 label_9 password - btnChange directory label verticalSpacer walletName walletPath + horizontalLayoutWidget walletName walletPath password directory - btnChange diff --git a/src/wizard/createwalletseed.cpp b/src/wizard/createwalletseed.cpp index e1c02d7..6264a6a 100644 --- a/src/wizard/createwalletseed.cpp +++ b/src/wizard/createwalletseed.cpp @@ -22,11 +22,7 @@ CreateWalletSeedPage::CreateWalletSeedPage(AppContext *ctx, QWidget *parent) : this->registerField("mnemonicSeed", ui->hiddenMnemonicSeed); ui->hiddenMnemonicSeed->hide(); - auto fontApp = QApplication::font(); - auto fontFamily = fontApp.family(); - auto fontSize = fontApp.pointSize() + 2; - m_seedFontFamily = fontFamily; - m_seedFontSize = fontSize; + ui->seed->setFont(Utils::relativeFont(1)); connect(ui->btnRoulette, &QPushButton::clicked, [=]{ this->seedRoulette(0); @@ -52,8 +48,7 @@ void CreateWalletSeedPage::seedRoulette(int count) { } void CreateWalletSeedPage::displaySeed(const QString &seed){ - auto html = R"(

%3

)"; - ui->seed->setText(QString(html).arg(m_seedFontFamily).arg(m_seedFontSize).arg(seed)); + ui->seed->setPlainText(seed); } int CreateWalletSeedPage::nextId() const { diff --git a/src/wizard/createwalletseed.h b/src/wizard/createwalletseed.h index 7ac90d3..5f8389e 100644 --- a/src/wizard/createwalletseed.h +++ b/src/wizard/createwalletseed.h @@ -42,8 +42,6 @@ private: QString m_mnemonic; unsigned int m_restoreHeight; - int m_seedFontSize; - QString m_seedFontFamily; bool m_roulette = false; int m_rouletteSpin = 15; }; diff --git a/src/wizard/createwalletseed.ui b/src/wizard/createwalletseed.ui index 571cc0b..b5a7453 100644 --- a/src/wizard/createwalletseed.ui +++ b/src/wizard/createwalletseed.ui @@ -6,57 +6,44 @@ 0 0 - 439 - 425 + 438 + 444 WizardPage - - - - - - 75 - true - + + + + + + 16777215 + 90 + - - WARNING: + + Qt::NoFocus - - - - - - - 0 - 0 - + + QFrame::Box - - Please save these 14 words on paper (order is important). This seed will allow you to recover your wallet in case of computer failure. + + QFrame::Plain - + true - - - - Qt::Vertical + + + + Qt::NoFocus - - - 20 - 40 - - - + - + @@ -73,6 +60,9 @@ + + Qt::NoFocus + Generate @@ -80,7 +70,36 @@ - + + + + + 0 + 0 + + + + Please save these 14 words on paper (order is important). This seed will allow you to recover your wallet in case of computer failure. + + + true + + + + + + + + 75 + true + + + + WARNING: + + + + <html><head/><body><style>p{margin:0}</style><p>• Never disclose your seed.</p><p>• Never type it on a website.</p><p>• Store it safely (offline).</p><p>• <b>Do not lose your seed!</b></p></body></html> @@ -90,50 +109,18 @@ - - - - Your wallet generation seed is: + + + + Qt::Vertical - - - - - - - 0 - 0 - - - + - 16777215 - 80 + 20 + 0 - - QFrame::Box - - - QFrame::Plain - - - 1 - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html> - - - - - + diff --git a/src/wizard/walletwizard.cpp b/src/wizard/walletwizard.cpp index 13dd1f9..d3b8538 100644 --- a/src/wizard/walletwizard.cpp +++ b/src/wizard/walletwizard.cpp @@ -20,15 +20,15 @@ WalletWizard::WalletWizard(AppContext *ctx, WalletWizard::Page startPage, QWidge m_ctx(ctx) { this->setWindowTitle("Welcome to feather"); this->setWindowIcon(QIcon(":/assets/images/appicons/64x64.png")); - auto openWalletPage = new OpenWalletPage(m_ctx); - auto createWallet = new CreateWalletPage(m_ctx); - auto createWalletSeed = new CreateWalletSeedPage(m_ctx); - setPage(Page_Menu, new MenuPage(m_ctx)); + auto openWalletPage = new OpenWalletPage(m_ctx, this); + auto createWallet = new CreateWalletPage(m_ctx, this); + auto createWalletSeed = new CreateWalletSeedPage(m_ctx, this); + setPage(Page_Menu, new MenuPage(m_ctx, this)); setPage(Page_CreateWallet, createWallet); setPage(Page_OpenWallet, openWalletPage); setPage(Page_CreateWalletSeed, createWalletSeed); - setPage(Page_Network, new NetworkPage(m_ctx)); - setPage(Page_Restore, new RestorePage(m_ctx)); + setPage(Page_Network, new NetworkPage(m_ctx, this)); + setPage(Page_Restore, new RestorePage(m_ctx, this)); if(config()->get(Config::firstRun).toUInt()) setStartId(Page_Network);