From 5d2b02097eeb6ed166611a22cef66a8c56b7c997 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 27 Jan 2025 16:51:27 +0100 Subject: refactor: clean up code --- src/ui/dialog/Wizard.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/ui/dialog/Wizard.cpp') diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index 3a3c0800..ee70239a 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -45,10 +45,7 @@ Wizard::Wizard(QWidget* parent) : QWizard(parent) { setPixmap(QWizard::LogoPixmap, QPixmap(":/icons/gpgfrontend_logo.png").scaled(64, 64)); - int next_page_id = GlobalSettingStation::GetInstance() - .GetSettings() - .value("wizard.next_page", -1) - .toInt(); + int next_page_id = GetSettings().value("wizard.next_page", -1).toInt(); setStartId(next_page_id); connect(this, &Wizard::accepted, this, &Wizard::slot_wizard_accepted); @@ -57,7 +54,7 @@ Wizard::Wizard(QWidget* parent) : QWizard(parent) { void Wizard::slot_wizard_accepted() { // Don't show is mapped to show -> negation try { - auto settings = GlobalSettingStation::GetInstance().GetSettings(); + auto settings = GetSettings(); settings.setValue("wizard/show_wizard", false); } catch (...) { FLOG_W("setting operation error"); -- cgit v1.2.3 From d06c31abe7e2540518c4d3471acd381edfababa3 Mon Sep 17 00:00:00 2001 From: saturneric Date: Sun, 2 Feb 2025 00:21:59 +0100 Subject: feat: upgrade KeyGenDialog to meet easy and advanced requirements --- src/ui/dialog/Wizard.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/ui/dialog/Wizard.cpp') diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index ee70239a..32d88b31 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -29,14 +29,16 @@ #include "Wizard.h" #include "core/function/GlobalSettingStation.h" +#include "ui/GpgFrontendUI.h" +#include "ui/dialog/key_generate/KeyGenDialog.h" namespace GpgFrontend::UI { Wizard::Wizard(QWidget* parent) : QWizard(parent) { - setPage(Page_Intro, new IntroPage(this)); - setPage(Page_Choose, new ChoosePage(this)); - setPage(Page_GenKey, new KeyGenPage(this)); - setPage(Page_Conclusion, new ConclusionPage(this)); + setPage(kPAGE_INTRO, new IntroPage(this)); + setPage(kPAGE_CHOOSE, new ChoosePage(this)); + setPage(kPAGE_GEN_KEY, new KeyGenPage(this)); + setPage(kPAGE_CONCLUSION, new ConclusionPage(this)); #ifndef Q_WS_MAC setWizardStyle(ModernStyle); #endif @@ -98,7 +100,7 @@ IntroPage::IntroPage(QWidget* parent) : QWizardPage(parent) { setLayout(layout); } -int IntroPage::nextId() const { return Wizard::Page_Choose; } +int IntroPage::nextId() const { return Wizard::kPAGE_CHOOSE; } ChoosePage::ChoosePage(QWidget* parent) : QWizardPage(parent) { setTitle(tr("Choose your action...")); @@ -143,7 +145,7 @@ ChoosePage::ChoosePage(QWidget* parent) : QWizardPage(parent) { layout->addWidget(encr_decy_text_label); layout->addWidget(sign_verify_text_label); setLayout(layout); - next_page_ = Wizard::Page_Conclusion; + next_page_ = Wizard::kPAGE_CONCLUSION; } int ChoosePage::nextId() const { return next_page_; } @@ -190,7 +192,7 @@ KeyGenPage::KeyGenPage(QWidget* parent) : QWizardPage(parent) { setLayout(layout); } -int KeyGenPage::nextId() const { return Wizard::Page_Conclusion; } +int KeyGenPage::nextId() const { return Wizard::kPAGE_CONCLUSION; } void KeyGenPage::slot_generate_key_dialog() { (new KeyGenDialog(kGpgFrontendDefaultChannel, this))->show(); -- cgit v1.2.3 From cd4a1f749bea0a15df9f4f9dd5d7e18c6466e3ce Mon Sep 17 00:00:00 2001 From: saturneric Date: Sun, 2 Feb 2025 00:39:29 +0100 Subject: fix: solve lower/upper case name conflict --- src/ui/dialog/Wizard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/Wizard.cpp') diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index 32d88b31..243fb846 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -30,7 +30,7 @@ #include "core/function/GlobalSettingStation.h" #include "ui/GpgFrontendUI.h" -#include "ui/dialog/key_generate/KeyGenDialog.h" +#include "ui/dialog/key_generate/KeyGenerateDialog.h" namespace GpgFrontend::UI { -- cgit v1.2.3 From 1e95a70ab32fcdb8ef42e7ce8df5ba40b1f251ab Mon Sep 17 00:00:00 2001 From: saturneric Date: Sun, 2 Feb 2025 18:02:44 +0100 Subject: feat: improve KeyGenerateDialog --- src/ui/dialog/Wizard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/Wizard.cpp') diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index 243fb846..8e77dada 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -195,7 +195,7 @@ KeyGenPage::KeyGenPage(QWidget* parent) : QWizardPage(parent) { int KeyGenPage::nextId() const { return Wizard::kPAGE_CONCLUSION; } void KeyGenPage::slot_generate_key_dialog() { - (new KeyGenDialog(kGpgFrontendDefaultChannel, this))->show(); + (new KeyGenerateDialog(kGpgFrontendDefaultChannel, this))->show(); wizard()->next(); } -- cgit v1.2.3