From 5222a2fd1ba372f6eb67dc8fa71e334f1ff10bbb Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 8 Jan 2024 17:26:41 +0800 Subject: fix: solve compile issue --- src/ui/dialog/gnupg/GnuPGControllerDialog.cpp | 52 ++++++++++----------------- 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'src/ui/dialog/gnupg/GnuPGControllerDialog.cpp') diff --git a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp index d2bbf07b..0c3af463 100644 --- a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp +++ b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp @@ -279,47 +279,33 @@ void GnuPGControllerDialog::slot_update_custom_gnupg_install_path_label( } void GnuPGControllerDialog::set_settings() { - auto& settings = GlobalSettingStation::GetInstance().GetMainSettings(); - - try { - bool non_ascii_when_export = - settings.lookup("general.non_ascii_when_export"); - GF_UI_LOG_DEBUG("non_ascii_when_export: {}", non_ascii_when_export); - if (non_ascii_when_export) - ui_->asciiModeCheckBox->setCheckState(Qt::Checked); - } catch (...) { - GF_UI_LOG_ERROR("setting operation error: non_ascii_when_export"); - } + auto& settings_station = GlobalSettingStation::GetInstance(); + + bool non_ascii_when_export = + settings_station.LookupSettings("general.non_ascii_when_export", true); + GF_UI_LOG_DEBUG("non_ascii_when_export: {}", non_ascii_when_export); + if (non_ascii_when_export) ui_->asciiModeCheckBox->setCheckState(Qt::Checked); - try { - bool use_custom_key_database_path = - settings.lookup("general.use_custom_key_database_path"); - if (use_custom_key_database_path) - ui_->keyDatabseUseCustomCheckBox->setCheckState(Qt::Checked); - } catch (...) { - GF_UI_LOG_ERROR("setting operation error: use_custom_key_database_path"); + bool const use_custom_key_database_path = settings_station.LookupSettings( + "general.use_custom_key_database_path", false); + if (use_custom_key_database_path) { + ui_->keyDatabseUseCustomCheckBox->setCheckState(Qt::Checked); } this->slot_update_custom_key_database_path_label( ui_->keyDatabseUseCustomCheckBox->checkState()); - try { - bool use_custom_gnupg_install_path = - settings.lookup("general.use_custom_gnupg_install_path"); - if (use_custom_gnupg_install_path) - ui_->useCustomGnuPGInstallPathCheckBox->setCheckState(Qt::Checked); - } catch (...) { - GF_UI_LOG_ERROR("setting operation error: use_custom_gnupg_install_path"); + bool const use_custom_gnupg_install_path = settings_station.LookupSettings( + "general.use_custom_gnupg_install_path", false); + if (use_custom_gnupg_install_path) { + ui_->useCustomGnuPGInstallPathCheckBox->setCheckState(Qt::Checked); } - try { - bool use_pinentry_as_password_input_dialog = - settings.lookup("general.use_pinentry_as_password_input_dialog"); - if (use_pinentry_as_password_input_dialog) - ui_->usePinentryAsPasswordInputDialogCheckBox->setCheckState(Qt::Checked); - } catch (...) { - GF_UI_LOG_ERROR( - "setting operation error: use_pinentry_as_password_input_dialog"); + bool const use_pinentry_as_password_input_dialog = + settings_station.LookupSettings( + "general.use_pinentry_as_password_input_dialog", false); + if (use_pinentry_as_password_input_dialog) { + ui_->usePinentryAsPasswordInputDialogCheckBox->setCheckState(Qt::Checked); } this->slot_update_custom_gnupg_install_path_label( -- cgit v1.2.3