diff options
author | saturneric <[email protected]> | 2023-12-04 12:31:36 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-12-04 12:31:36 +0000 |
commit | de05b25e0b8078d5c9d91b31ad5fc2800ad4b6a5 (patch) | |
tree | 3aa6c351835018697d0711503dab4159226cf8af /src | |
parent | fix: slove logger system isolation issues (diff) | |
download | GpgFrontend-de05b25e0b8078d5c9d91b31ad5fc2800ad4b6a5.tar.gz GpgFrontend-de05b25e0b8078d5c9d91b31ad5fc2800ad4b6a5.zip |
fix: common utils should be created before core initialization
Diffstat (limited to 'src')
-rw-r--r-- | src/app.cpp | 5 | ||||
-rw-r--r-- | src/ui/GpgFrontendUIInit.cpp | 7 | ||||
-rw-r--r-- | src/ui/GpgFrontendUIInit.h | 6 | ||||
-rw-r--r-- | src/ui/UserInterfaceUtils.cpp | 12 |
4 files changed, 21 insertions, 9 deletions
diff --git a/src/app.cpp b/src/app.cpp index 8df46024..b0c771d9 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -103,10 +103,13 @@ auto StartApplication(InitArgs args) -> int { module_init_args.log_level = args.log_level; GpgFrontend::Module::LoadGpgFrontendModules(module_init_args); + // then preload ui + GpgFrontend::UI::PreInitGpgFrontendUI(); + // then load core GpgFrontend::InitGpgFrontendCore(); - // after that load ui library + // after that load ui totally GpgFrontend::UI::InitGpgFrontendUI(app); // finally create main window diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 0d2a3331..e8b3663c 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -29,6 +29,7 @@ #include "GpgFrontendUIInit.h" #include <qapplication.h> +#include <qcoreapplication.h> #include <spdlog/async.h> #include <spdlog/common.h> #include <spdlog/sinks/rotating_file_sink.h> @@ -43,9 +44,9 @@ #include "core/module/ModuleManager.h" #include "core/thread/CtxCheckTask.h" #include "core/thread/TaskRunnerGetter.h" -#include "spdlog/spdlog.h" #include "ui/UISignalStation.h" #include "ui/UserInterfaceUtils.h" +#include "ui/dialog/gnupg/GnuPGControllerDialog.h" #include "ui/main_window/MainWindow.h" #if !defined(RELEASE) && defined(WINDOWS) @@ -115,6 +116,8 @@ void WaitEnvCheckingProcess() { looper.exec(); } +void PreInitGpgFrontendUI() { CommonUtils::GetInstance(); } + void InitGpgFrontendUI(QApplication* app) { // init locale InitLocale(); @@ -201,7 +204,7 @@ void InitGpgFrontendUI(QApplication* app) { } } -int RunGpgFrontendUI(QApplication* app) { +auto RunGpgFrontendUI(QApplication* app) -> int { // create main window and show it auto main_window = std::make_unique<GpgFrontend::UI::MainWindow>(); diff --git a/src/ui/GpgFrontendUIInit.h b/src/ui/GpgFrontendUIInit.h index 0ed630bb..42c00c5a 100644 --- a/src/ui/GpgFrontendUIInit.h +++ b/src/ui/GpgFrontendUIInit.h @@ -33,6 +33,12 @@ namespace GpgFrontend::UI { /** + * @brief + * + */ +void GPGFRONTEND_UI_EXPORT PreInitGpgFrontendUI(); + +/** * @brief init the UI library * */ diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index 6f4ca7d0..7c42e86d 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -185,9 +185,9 @@ CommonUtils::CommonUtils() : QWidget(nullptr) { &CommonUtils::SlotRestartApplication); connect(this, &CommonUtils::SignalBadGnupgEnv, this, [=]() { - QMessageBox msgBox; - msgBox.setText(_("GnuPG Context Loading Failed")); - msgBox.setInformativeText( + QMessageBox msg_box; + msg_box.setText(_("GnuPG Context Loading Failed")); + msg_box.setInformativeText( _("Gnupg(gpg) is not installed correctly, please follow " "<a href='https://www.gpgfrontend.bktus.com/#/" "faq?id=how-to-deal-with-39env-loading-failed39'>this notes</a>" @@ -195,9 +195,9 @@ CommonUtils::CommonUtils() : QWidget(nullptr) { "GpgFrontend. Or, you can open GnuPG Controller to set a custom " "GnuPG " "which GpgFrontend should use. Then, GpgFrontend will restart.")); - msgBox.setStandardButtons(QMessageBox::Open | QMessageBox::Cancel); - msgBox.setDefaultButton(QMessageBox::Save); - int ret = msgBox.exec(); + msg_box.setStandardButtons(QMessageBox::Open | QMessageBox::Cancel); + msg_box.setDefaultButton(QMessageBox::Save); + int ret = msg_box.exec(); switch (ret) { case QMessageBox::Open: |