diff options
author | Saturneric <[email protected]> | 2023-04-05 05:16:26 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-04-05 05:16:26 +0000 |
commit | 25dc98b395cbd4e60c468d82de7e2c7579350e58 (patch) | |
tree | 029683a56ad773aa915c32c93a1bf848def4a7a2 /src/ui/main_window/MainWindowFileSlotFunction.cpp | |
parent | fix: remove 'cached' in codeql ci (diff) | |
download | GpgFrontend-25dc98b395cbd4e60c468d82de7e2c7579350e58.tar.gz GpgFrontend-25dc98b395cbd4e60c468d82de7e2c7579350e58.zip |
feat: simplify settings lookup
Diffstat (limited to 'src/ui/main_window/MainWindowFileSlotFunction.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 598ba33c..6fe8062b 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -167,14 +167,9 @@ void MainWindow::SlotFileEncrypt() { GpgError error; bool if_error = false; - // Detect ascii mode - auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); - bool non_ascii_when_export = true; - try { - non_ascii_when_export = settings.lookup("general.non_ascii_when_export"); - } catch (...) { - SPDLOG_ERROR("setting operation error: non_ascii_when_export"); - } + bool non_ascii_when_export = + GlobalSettingStation::GetInstance().LookupSettings( + "general.non_ascii_when_export", true); // get file info QFileInfo file_info(path); @@ -390,14 +385,9 @@ void MainWindow::SlotFileSign() { } } - // Detect ascii mode - auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); - bool non_ascii_when_export = true; - try { - non_ascii_when_export = settings.lookup("general.non_ascii_when_export"); - } catch (...) { - SPDLOG_ERROR("setting operation error: non_ascii_when_export"); - } + bool non_ascii_when_export = + GlobalSettingStation::GetInstance().LookupSettings( + "general.non_ascii_when_export", true); auto _channel = GPGFRONTEND_DEFAULT_CHANNEL; auto _extension = ".asc"; @@ -469,14 +459,9 @@ void MainWindow::SlotFileVerify() { std::filesystem::path sign_file_path = in_path, data_file_path; - // Detect ascii mode - auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); - bool non_ascii_when_export = true; - try { - non_ascii_when_export = settings.lookup("general.non_ascii_when_export"); - } catch (...) { - SPDLOG_ERROR("setting operation error: non_ascii_when_export"); - } + bool non_ascii_when_export = + GlobalSettingStation::GetInstance().LookupSettings( + "general.non_ascii_when_export", true); auto _channel = GPGFRONTEND_DEFAULT_CHANNEL; if (non_ascii_when_export) { @@ -581,14 +566,9 @@ void MainWindow::SlotFileEncryptSign() { } } - // detect ascii mode - auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); - bool non_ascii_when_export = true; - try { - non_ascii_when_export = settings.lookup("general.non_ascii_when_export"); - } catch (...) { - SPDLOG_ERROR("setting operation error: non_ascii_when_export"); - } + bool non_ascii_when_export = + GlobalSettingStation::GetInstance().LookupSettings( + "general.non_ascii_when_export", true); // get file info QFileInfo file_info(path); |