Wizard UX fixes

Fixed cancelEvent slot, disabled back butttons, removed close button since cancel button displays alert and can close app instead of loading GUI with light server error.
This commit is contained in:
fekt
2022-11-04 20:38:10 -04:00
parent 7454854bf6
commit ff8692fa39
2 changed files with 19 additions and 9 deletions

View File

@@ -49,9 +49,13 @@ void FirstTimeWizard::slot_change_theme(const QString& theme_name) {
}
FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server)
{
FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server){
qDebug() << __func__ << ": dangerous=" << dangerous << " server=" << server;
// Set window flags and disable close button - force user to use Wizard's cancel button to prevent funk
this->setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowCloseButtonHint);
// Include css
QString theme_name;
try
@@ -127,7 +131,6 @@ void FirstTimeWizard::initializePage() {
void NewOrRestorePage::initializePage() {
qDebug() << "NewOrRestorePage:" <<__func__;
}
NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent) {
@@ -146,7 +149,9 @@ NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent
setButtonText(QWizard::CommitButton, tr("Next"));
// Remove back button
parent->setOption(QWizard::NoBackButtonOnStartPage);
parent->setOption(QWizard::NoBackButtonOnLastPage);
form.txtPassword->setEnabled(false);
form.txtConfirmPassword->setEnabled(false);
@@ -263,6 +268,10 @@ NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent
parent->button(QWizard::CommitButton)->setEnabled(false);
parent->button(QWizard::NextButton)->setEnabled(false);
// Connect cancelEvent
disconnect(parent->button(QWizard::CancelButton ), SIGNAL( clicked() ), parent, SLOT( reject() ) );
connect(parent->button(QWizard::CancelButton ), SIGNAL( clicked() ), parent, SLOT( cancelEvent() ) );
}
NewSeedPage::NewSeedPage(FirstTimeWizard *parent) : QWizardPage(parent) {
@@ -298,7 +307,6 @@ void NewSeedPage::initializePage() {
parent->setSeed(seed);
parent->setBirthday(birthday);
form.birthday->setPlainText(birthday);
parent->button(QWizard::CancelButton)->setEnabled(false);
disconnect(parent->button(QWizard::CancelButton ), SIGNAL( clicked() ), parent, SLOT( reject() ) );
connect(parent->button(QWizard::CancelButton ), SIGNAL( clicked() ), parent, SLOT( cancelEvent() ) );
qDebug() << __func__ << ": page initialized with birthday=" << birthday;
@@ -308,10 +316,13 @@ void NewSeedPage::initializePage() {
void FirstTimeWizard::cancelEvent() {
qDebug() << __func__;
if( QMessageBox::question( this, ( "Quit Setup" ), ( "Setup is not complete yet. Are you sure you want to quit setup?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
if( QMessageBox::question( this, tr(( "Quit Setup" )), tr(( "Setup is not complete yet. Are you sure you want to quit setup and close the app?" )), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
qDebug() << __func__ << ": wizard canceled";
// allow cancel
reject();
// Allow cancel
reject();
// Close the app
qApp->exit();
}
}

View File

@@ -23,11 +23,10 @@ public:
QString _seed;
void setSeed(QString Seed);
void setBirthday(QString Birthday);
void cancelEvent();
public slots:
void slot_change_theme(const QString& themeName);
void cancelEvent();
protected:
int nextId() const;