diff options
author | Saturneric <[email protected]> | 2023-04-04 16:19:58 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-04-04 16:19:58 +0000 |
commit | c71d1ab50b42afe6ba0c77a9038d4ef3c8139a63 (patch) | |
tree | f2c0d77a08ce794d64ca4e75f809d9452006a03b /src/ui/GpgFrontendUIInit.cpp | |
parent | feat: add gnupg controller (diff) | |
download | GpgFrontend-c71d1ab50b42afe6ba0c77a9038d4ef3c8139a63.tar.gz GpgFrontend-c71d1ab50b42afe6ba0c77a9038d4ef3c8139a63.zip |
feat: improve init progress
Diffstat (limited to 'src/ui/GpgFrontendUIInit.cpp')
-rw-r--r-- | src/ui/GpgFrontendUIInit.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index b90493a5..c6360ca7 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -33,9 +33,11 @@ #include <spdlog/sinks/rotating_file_sink.h> #include <spdlog/sinks/stdout_color_sinks.h> +#include "core/GpgConstants.h" #include "core/function/GlobalSettingStation.h" #include "core/thread/CtxCheckTask.h" #include "core/thread/TaskRunnerGetter.h" +#include "spdlog/spdlog.h" #include "ui/SignalStation.h" #include "ui/UserInterfaceUtils.h" #include "ui/main_window/MainWindow.h" @@ -178,9 +180,17 @@ void InitGpgFrontendUI(QApplication* app) { int RunGpgFrontendUI(QApplication* app) { // create main window and show it auto main_window = std::make_unique<GpgFrontend::UI::MainWindow>(); - main_window->Init(); - SPDLOG_DEBUG("main window inited"); - main_window->show(); + + // pre-check, if application need to restart + if (CommonUtils::GetInstance()->isApplicationNeedRestart()) { + SPDLOG_DEBUG("application need to restart, before mian window init"); + return DEEP_RESTART_CODE; + } else { + main_window->Init(); + SPDLOG_DEBUG("main window inited"); + main_window->show(); + } + // start the main event loop return app->exec(); } |