diff options
author | saturneric <[email protected]> | 2023-12-04 13:43:03 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-12-04 13:43:33 +0000 |
commit | 33544f343df4e834730d9b0c0916433a51738d55 (patch) | |
tree | fdab9c9971e041aacf9ddf4269c3def512c0f627 /src/ui/GpgFrontendUIInit.cpp | |
parent | fix: common utils should be created before core initialization (diff) | |
download | GpgFrontend-33544f343df4e834730d9b0c0916433a51738d55.tar.gz GpgFrontend-33544f343df4e834730d9b0c0916433a51738d55.zip |
feat: add reasons explanation to env loading failed message box
Diffstat (limited to 'src/ui/GpgFrontendUIInit.cpp')
-rw-r--r-- | src/ui/GpgFrontendUIInit.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index e8b3663c..9849fab2 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -42,7 +42,6 @@ #include "core/function/CoreSignalStation.h" #include "core/function/GlobalSettingStation.h" #include "core/module/ModuleManager.h" -#include "core/thread/CtxCheckTask.h" #include "core/thread/TaskRunnerGetter.h" #include "ui/UISignalStation.h" #include "ui/UserInterfaceUtils.h" @@ -118,7 +117,7 @@ void WaitEnvCheckingProcess() { void PreInitGpgFrontendUI() { CommonUtils::GetInstance(); } -void InitGpgFrontendUI(QApplication* app) { +void InitGpgFrontendUI(QApplication* /*app*/) { // init locale InitLocale(); @@ -179,10 +178,12 @@ void InitGpgFrontendUI(QApplication* app) { proxy.setType(proxy_type_qt); proxy.setHostName(QString::fromStdString(proxy_host)); proxy.setPort(proxy_port); - if (!proxy_username.empty()) + if (!proxy_username.empty()) { proxy.setUser(QString::fromStdString(proxy_username)); - if (!proxy_password.empty()) + } + if (!proxy_password.empty()) { proxy.setPassword(QString::fromStdString(proxy_password)); + } } else { proxy.setType(proxy_type_qt); } @@ -226,9 +227,6 @@ auto RunGpgFrontendUI(QApplication* app) -> int { } void InitUILoggingSystem(spdlog::level::level_enum level) { - using namespace boost::posix_time; - using namespace boost::gregorian; - // get the log directory auto logfile_path = (GlobalSettingStation::GetInstance().GetLogDir() / "ui"); logfile_path.replace_extension(".log"); @@ -283,13 +281,15 @@ void InitLocale() { // create general settings if not exist if (!settings.exists("general") || - settings.lookup("general").getType() != libconfig::Setting::TypeGroup) + settings.lookup("general").getType() != libconfig::Setting::TypeGroup) { settings.add("general", libconfig::Setting::TypeGroup); + } // set system default at first auto& general = settings["general"]; - if (!general.exists("lang")) + if (!general.exists("lang")) { general.add("lang", libconfig::Setting::TypeString) = ""; + } // sync the settings to the file GpgFrontend::GlobalSettingStation::GetInstance().SyncSettings(); @@ -316,12 +316,12 @@ void InitLocale() { // set LC_ALL auto* locale_name = setlocale(LC_ALL, lc.c_str()); if (locale_name == nullptr) SPDLOG_WARN("set LC_ALL failed, lc: {}", lc); - auto language = getenv("LANGUAGE"); + auto* language = getenv("LANGUAGE"); // set LANGUAGE std::string language_env = language == nullptr ? "en" : language; language_env.insert(0, lang + ":"); SPDLOG_DEBUG("language env: {}", language_env); - if (setenv("LANGUAGE", language_env.c_str(), 1)) { + if (setenv("LANGUAGE", language_env.c_str(), 1) != 0) { SPDLOG_WARN("set LANGUAGE {} failed", language_env); }; } |