SeedDialog: show restore height for 25 word seeds

This commit is contained in:
tobtoht 2020-11-25 12:34:14 +01:00
parent edad1928ab
commit d4dbc748c8
3 changed files with 99 additions and 28 deletions

View file

@ -68,9 +68,7 @@ HelpLabel::HelpLabel(QWidget *parent) : QLabel(parent)
void HelpLabel::mouseReleaseEvent(QMouseEvent *event) void HelpLabel::mouseReleaseEvent(QMouseEvent *event)
{ {
Q_UNUSED(event) Q_UNUSED(event)
QMessageBox msgBox(QApplication::activeWindow()); QMessageBox::information(this, "Help", this->help_text);
msgBox.setText(this->help_text);
msgBox.exec();
} }
void HelpLabel::enterEvent(QEvent *event) void HelpLabel::enterEvent(QEvent *event)

View file

@ -11,6 +11,8 @@ SeedDialog::SeedDialog(Wallet *wallet, QWidget *parent)
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));
ui->label_restoreHeight->setText(QString::number(wallet->getWalletCreationHeight()));
QString seed_14_words = wallet->getCacheAttribute("feather.seed"); QString seed_14_words = wallet->getCacheAttribute("feather.seed");
QString seed_25_words = wallet->getSeed(); QString seed_25_words = wallet->getSeed();
@ -19,11 +21,17 @@ SeedDialog::SeedDialog(Wallet *wallet, QWidget *parent)
this->setSeed(seed_25_words); this->setSeed(seed_25_words);
} else { } else {
this->setSeed(seed_14_words); this->setSeed(seed_14_words);
connect(ui->check_toggleSeedType, &QCheckBox::toggled, [this, seed_25_words, seed_14_words](bool toggled){ ui->widgetRestoreHeight->setVisible(false);
this->setSeed(toggled ? seed_25_words : 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);
ui->widgetRestoreHeight->setVisible(toggled);
});
ui->label_restoreHeightHelp->setHelpText("Should you restore your wallet in the future, "
"specifying this block number will recover your wallet quicker.");
this->adjustSize(); this->adjustSize();
} }

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>542</width> <width>590</width>
<height>259</height> <height>346</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -34,26 +34,84 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPlainTextEdit" name="seed"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="enabled"> <item>
<bool>true</bool> <widget class="QPlainTextEdit" name="seed">
</property> <property name="enabled">
<property name="sizePolicy"> <bool>true</bool>
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> </property>
<horstretch>0</horstretch> <property name="sizePolicy">
<verstretch>0</verstretch> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
</sizepolicy> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="maximumSize"> </sizepolicy>
<size> </property>
<width>16777215</width> <property name="minimumSize">
<height>125</height> <size>
</size> <width>0</width>
</property> <height>125</height>
<property name="readOnly"> </size>
<bool>true</bool> </property>
</property> <property name="maximumSize">
</widget> <size>
<width>16777215</width>
<height>300</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widgetRestoreHeight" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="HelpLabel" name="label_restoreHeightHelp">
<property name="text">
<string>Restore height:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_restoreHeight">
<property name="text">
<string>TextLabel</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
@ -86,6 +144,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>HelpLabel</class>
<extends>QLabel</extends>
<header>components.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>