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
This commit is contained in:
tobtoht 2020-10-11 18:17:11 +02:00
parent 12940361d8
commit 89ea34cfb7
5 changed files with 124 additions and 134 deletions

View file

@ -7,24 +7,24 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>335</height>
<height>321</height>
</rect>
</property>
<property name="windowTitle">
<string>Create Wallet</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
<widget class="QLineEdit" name="directory"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<item row="4" column="0">
<widget class="QLineEdit" name="password">
<property name="text">
<string>Password (Optional)</string>
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -32,11 +32,31 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<widget class="QLineEdit" name="directory"/>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="walletPath"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Password (Optional)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -47,56 +67,46 @@
<item row="1" column="0">
<widget class="QLineEdit" name="walletName"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnChange">
<property name="maximumSize">
<size>
<width>180</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Change directory</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLineEdit" name="password">
<property name="text">
<string/>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="walletPath"/>
</layout>
</item>
</layout>
<zorder>label_3</zorder>
<zorder>label_9</zorder>
<zorder>password</zorder>
<zorder>btnChange</zorder>
<zorder>directory</zorder>
<zorder>label</zorder>
<zorder>verticalSpacer</zorder>
<zorder>walletName</zorder>
<zorder>walletPath</zorder>
<zorder>horizontalLayoutWidget</zorder>
</widget>
<tabstops>
<tabstop>walletName</tabstop>
<tabstop>walletPath</tabstop>
<tabstop>password</tabstop>
<tabstop>directory</tabstop>
<tabstop>btnChange</tabstop>
</tabstops>
<resources/>
<connections/>

View file

@ -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"(<html><head><meta name="qrichtext" content="1" /></head><body style="font-family:'%1'; font-size:%2pt; font-weight:400; font-style:normal;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%3</p></body></html>)";
ui->seed->setText(QString(html).arg(m_seedFontFamily).arg(m_seedFontSize).arg(seed));
ui->seed->setPlainText(seed);
}
int CreateWalletSeedPage::nextId() const {

View file

@ -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;
};

View file

@ -6,57 +6,44 @@
<rect>
<x>0</x>
<y>0</y>
<width>439</width>
<height>425</height>
<width>438</width>
<height>444</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPlainTextEdit" name="seed">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>90</height>
</size>
</property>
<property name="text">
<string>WARNING:</string>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>Please save these 14 words on paper (order is important). This seed will allow you to recover your wallet in case of computer failure.</string>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="wordWrap">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item>
<widget class="QLineEdit" name="hiddenMnemonicSeed">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
@ -73,6 +60,9 @@
</item>
<item>
<widget class="QPushButton" name="btnRoulette">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Generate</string>
</property>
@ -80,7 +70,36 @@
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Please save these 14 words on paper (order is important). This seed will allow you to recover your wallet in case of computer failure.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>WARNING:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;style&gt;p{margin:0}&lt;/style&gt;&lt;p&gt;• Never disclose your seed.&lt;/p&gt;&lt;p&gt;• Never type it on a website.&lt;/p&gt;&lt;p&gt;• Store it safely (offline).&lt;/p&gt;&lt;p&gt;• &lt;b&gt;Do not lose your seed!&lt;/b&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -90,50 +109,18 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Your wallet generation seed is:</string>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTextEdit" name="seed">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<property name="sizeHint" stdset="0">
<size>
<width>16777215</width>
<height>80</height>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="hiddenMnemonicSeed"/>
</spacer>
</item>
</layout>
</widget>

View file

@ -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);