diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/GpgFrontendUIInit.cpp | 13 | ||||
-rw-r--r-- | src/ui/dialog/Wizard.cpp | 8 | ||||
-rw-r--r-- | src/ui/dialog/gnupg/GnuPGControllerDialog.cpp | 28 | ||||
-rw-r--r-- | src/ui/dialog/key_generate/KeygenDialog.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/settings/SettingsGeneral.cpp | 29 | ||||
-rw-r--r-- | src/ui/dialog/settings/SettingsGeneral.h | 13 | ||||
-rw-r--r-- | src/ui/main_window/MainWindow.cpp | 6 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 10 | ||||
-rw-r--r-- | src/ui/widgets/KeyList.cpp | 4 | ||||
-rw-r--r-- | src/ui/widgets/TextEdit.cpp | 2 |
12 files changed, 50 insertions, 69 deletions
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 83de2a0e..f8901e1d 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -32,7 +32,6 @@ #include <qcoreapplication.h> #include <QtNetwork> -#include <string> #include "core/GpgConstants.h" #include "core/function/CoreSignalStation.h" @@ -225,15 +224,13 @@ void InitLocale() { auto settings = GpgFrontend::GlobalSettingStation::GetInstance().GetSettings(); - GF_UI_LOG_DEBUG("current system locale: {}", setlocale(LC_ALL, nullptr)); + GF_UI_LOG_INFO("current system locale: {}", setlocale(LC_ALL, nullptr)); // read from settings file - auto lang = settings.value("general/lang", QString{}).toString(); - - GF_UI_LOG_DEBUG("lang from settings: {}", lang); - GF_UI_LOG_DEBUG("project name: {}", PROJECT_NAME); - GF_UI_LOG_DEBUG( - "locales path: {}", + auto lang = settings.value("basic/lang").toString(); + GF_UI_LOG_INFO("current language settings: {}", lang); + GF_UI_LOG_INFO( + "current locales path: {}", GpgFrontend::GlobalSettingStation::GetInstance().GetLocaleDir()); #ifndef WINDOWS diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index 65a5d822..dd23fcc0 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -91,18 +91,16 @@ IntroPage::IntroPage(QWidget* parent) : QWizardPage(parent) { topLabel->setWordWrap(true); // QComboBox for language selection - auto* langLabel = + auto* lang_label = new QLabel(_("If it supports the language currently being used in your " "system, GpgFrontend will automatically set it.")); - langLabel->setWordWrap(true); + lang_label->setWordWrap(true); // set layout and add widgets auto* layout = new QVBoxLayout; layout->addWidget(topLabel); layout->addStretch(); -#ifdef SUPPORT_MULTI_LANG - layout->addWidget(langLabel); -#endif + layout->addWidget(lang_label); setLayout(layout); } diff --git a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp index 70aa2f92..43dbcf1e 100644 --- a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp +++ b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp @@ -106,8 +106,8 @@ GnuPGControllerDialog::GnuPGControllerDialog(QWidget* parent) auto settings = GlobalSettingStation::GetInstance().GetSettings(); // update settings - if (!settings.contains("general/custom_key_database_path")) { - settings.setValue("general/custom_key_database_path", + if (!settings.contains("basic/custom_key_database_path")) { + settings.setValue("basic/custom_key_database_path", selected_custom_key_database_path); } @@ -135,8 +135,8 @@ GnuPGControllerDialog::GnuPGControllerDialog(QWidget* parent) } auto settings = GlobalSettingStation::GetInstance().GetSettings(); - if (!settings.contains("general/custom_gnupg_install_path")) { - settings.setValue("general/custom_gnupg_install_path", + if (!settings.contains("basic/custom_gnupg_install_path")) { + settings.setValue("basic/custom_gnupg_install_path", selected_custom_gnupg_install_path); } @@ -203,7 +203,7 @@ void GnuPGControllerDialog::slot_update_custom_key_database_path_label( QString custom_key_database_path = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/custom_key_database_path") + .value("basic/custom_key_database_path") .toString(); GF_UI_LOG_DEBUG("selected_custom_key_database_path from settings: {}", @@ -242,7 +242,7 @@ void GnuPGControllerDialog::slot_update_custom_gnupg_install_path_label( QString custom_gnupg_install_path = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/custom_gnupg_install_path") + .value("basic/custom_gnupg_install_path") .toString(); GF_UI_LOG_DEBUG("custom_gnupg_install_path from settings: {}", @@ -266,14 +266,14 @@ void GnuPGControllerDialog::set_settings() { auto& settings_station = GlobalSettingStation::GetInstance(); bool non_ascii_when_export = settings_station.GetSettings() - .value("general/non_ascii_when_export", true) + .value("basic/non_ascii_when_export", true) .toBool(); GF_UI_LOG_DEBUG("non_ascii_when_export: {}", non_ascii_when_export); if (non_ascii_when_export) ui_->asciiModeCheckBox->setCheckState(Qt::Checked); bool const use_custom_key_database_path = settings_station.GetSettings() - .value("general/use_custom_key_database_path", false) + .value("basic/use_custom_key_database_path", false) .toBool(); if (use_custom_key_database_path) { ui_->keyDatabseUseCustomCheckBox->setCheckState(Qt::Checked); @@ -284,7 +284,7 @@ void GnuPGControllerDialog::set_settings() { bool const use_custom_gnupg_install_path = settings_station.GetSettings() - .value("general/use_custom_gnupg_install_path", false) + .value("basic/use_custom_gnupg_install_path", false) .toBool(); if (use_custom_gnupg_install_path) { ui_->useCustomGnuPGInstallPathCheckBox->setCheckState(Qt::Checked); @@ -292,7 +292,7 @@ void GnuPGControllerDialog::set_settings() { bool const use_pinentry_as_password_input_dialog = settings_station.GetSettings() - .value("general/use_pinentry_as_password_input_dialog", false) + .value("basic/use_pinentry_as_password_input_dialog", false) .toBool(); if (use_pinentry_as_password_input_dialog) { ui_->usePinentryAsPasswordInputDialogCheckBox->setCheckState(Qt::Checked); @@ -308,13 +308,13 @@ void GnuPGControllerDialog::apply_settings() { auto settings = GpgFrontend::GlobalSettingStation::GetInstance().GetSettings(); - settings.setValue("general/non_ascii_when_export", + settings.setValue("basic/non_ascii_when_export", ui_->asciiModeCheckBox->isChecked()); - settings.setValue("general/use_custom_key_database_path", + settings.setValue("basic/use_custom_key_database_path", ui_->keyDatabseUseCustomCheckBox->isChecked()); - settings.setValue("general/use_custom_gnupg_install_path", + settings.setValue("basic/use_custom_gnupg_install_path", ui_->useCustomGnuPGInstallPathCheckBox->isChecked()); - settings.setValue("general/use_pinentry_as_password_input_dialog", + settings.setValue("basic/use_pinentry_as_password_input_dialog", ui_->usePinentryAsPasswordInputDialogCheckBox->isChecked()); } diff --git a/src/ui/dialog/key_generate/KeygenDialog.cpp b/src/ui/dialog/key_generate/KeygenDialog.cpp index e6495481..29ea74b6 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.cpp +++ b/src/ui/dialog/key_generate/KeygenDialog.cpp @@ -51,7 +51,7 @@ KeyGenDialog::KeyGenDialog(QWidget* parent) bool const longer_expiration_date = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/longer_expiration_date", false) + .value("basic/longer_expiration_date", false) .toBool(); max_date_time_ = longer_expiration_date diff --git a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp index ab538366..1036f9fa 100644 --- a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp @@ -46,7 +46,7 @@ SubkeyGenerateDialog::SubkeyGenerateDialog(const KeyId& key_id, QWidget* parent) bool longer_expiration_date = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/longer_expiration_date", false) + .value("basic/longer_expiration_date", false) .toBool(); max_date_time_ = longer_expiration_date diff --git a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp index d44341a4..76d24a12 100644 --- a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp +++ b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp @@ -102,7 +102,7 @@ void KeySetExpireDateDialog::init() { GpgFrontend::GlobalSettingStation::GetInstance().GetSettings(); bool longer_expiration_date = longer_expiration_date = - settings.value("general/longer_expiration_date").toBool(); + settings.value("basic/longer_expiration_date").toBool(); auto max_date_time = longer_expiration_date diff --git a/src/ui/dialog/settings/SettingsGeneral.cpp b/src/ui/dialog/settings/SettingsGeneral.cpp index ba8ce7ca..4c9c0368 100644 --- a/src/ui/dialog/settings/SettingsGeneral.cpp +++ b/src/ui/dialog/settings/SettingsGeneral.cpp @@ -28,13 +28,9 @@ #include "SettingsGeneral.h" +#include "SettingsDialog.h" #include "core/GpgModel.h" #include "core/function/GlobalSettingStation.h" - -#ifdef SUPPORT_MULTI_LANG -#include "SettingsDialog.h" -#endif - #include "ui_GeneralSettings.h" namespace GpgFrontend::UI { @@ -70,14 +66,12 @@ GeneralTab::GeneralTab(QWidget* parent) QString(_("Clear All Data Objects (Total Size: %1)")) .arg(GlobalSettingStation::GetInstance().GetDataObjectsFilesSize())); -#ifdef SUPPORT_MULTI_LANG lang_ = SettingsDialog::ListLanguages(); for (const auto& l : lang_) { ui_->langSelectBox->addItem(l); } connect(ui_->langSelectBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &GeneralTab::slot_language_changed); -#endif connect(ui_->clearAllLogFilesButton, &QPushButton::clicked, this, [=]() { GlobalSettingStation::GetInstance().ClearAllLogFiles(); @@ -110,26 +104,26 @@ void GeneralTab::SetSettings() { auto settings = GlobalSettingStation::GetInstance().GetSettings(); bool clear_gpg_password_cache = - settings.value("general/clear_gpg_password_cache", true).toBool(); + settings.value("basic/clear_gpg_password_cache", true).toBool(); ui_->clearGpgPasswordCacheCheckBox->setCheckState( clear_gpg_password_cache ? Qt::Checked : Qt::Unchecked); bool restore_text_editor_page = - settings.value("general/restore_text_editor_page", true).toBool(); + settings.value("basic/restore_text_editor_page", true).toBool(); ui_->restoreTextEditorPageCheckBox->setCheckState( restore_text_editor_page ? Qt::Checked : Qt::Unchecked); bool longer_expiration_date = - settings.value("general/longer_expiration_date", false).toBool(); + settings.value("basic/longer_expiration_date", false).toBool(); ui_->longerKeyExpirationDateCheckBox->setCheckState( longer_expiration_date ? Qt::Checked : Qt::Unchecked); bool confirm_import_keys = - settings.value("general/confirm_import_keys", false).toBool(); + settings.value("basic/confirm_import_keys", false).toBool(); ui_->importConfirmationCheckBox->setCheckState( confirm_import_keys ? Qt::Checked : Qt::Unchecked); - QString lang_key = settings.value("general/lang").toString(); + QString lang_key = settings.value("basic/lang").toString(); QString lang_value = lang_.value(lang_key); GF_UI_LOG_DEBUG("lang settings current: {}", lang_value.toStdString()); if (!lang_.empty()) { @@ -144,16 +138,15 @@ void GeneralTab::ApplySettings() { auto settings = GpgFrontend::GlobalSettingStation::GetInstance().GetSettings(); - settings.setValue("general/longer_expiration_date", + settings.setValue("basic/longer_expiration_date", ui_->longerKeyExpirationDateCheckBox->isChecked()); - settings.setValue("general/clear_gpg_password_cache", + settings.setValue("basic/clear_gpg_password_cache", ui_->clearGpgPasswordCacheCheckBox->isChecked()); - settings.setValue("general/restore_text_editor_page", + settings.setValue("basic/restore_text_editor_page", ui_->restoreTextEditorPageCheckBox->isChecked()); - settings.setValue("general/confirm_import_keys", + settings.setValue("basic/confirm_import_keys", ui_->importConfirmationCheckBox->isChecked()); - settings.setValue("general/lang", - lang_.key(ui_->langSelectBox->currentText())); + settings.setValue("basic/lang", lang_.key(ui_->langSelectBox->currentText())); } void GeneralTab::slot_language_changed() { emit SignalRestartNeeded(true); } diff --git a/src/ui/dialog/settings/SettingsGeneral.h b/src/ui/dialog/settings/SettingsGeneral.h index b7c61e52..284843d4 100644 --- a/src/ui/dialog/settings/SettingsGeneral.h +++ b/src/ui/dialog/settings/SettingsGeneral.h @@ -80,23 +80,16 @@ class GeneralTab : public QWidget { private: std::shared_ptr<Ui_GeneralSettings> ui_; ///< - -#ifdef SUPPORT_MULTI_LANG - QHash<QString, QString> lang_; ///< -#endif - - std::vector<QString> key_ids_list_; ///< - - KeyList* m_key_list_{}; ///< + QHash<QString, QString> lang_; ///< + std::vector<QString> key_ids_list_; ///< + KeyList* m_key_list_{}; ///< private slots: -#ifdef SUPPORT_MULTI_LANG /** * @brief * */ void slot_language_changed(); -#endif }; } // namespace GpgFrontend::UI diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 0ae6d409..cdeb597a 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -129,7 +129,7 @@ void MainWindow::Init() noexcept { if (GlobalSettingStation::GetInstance() .GetSettings() - .value("general/clear_gpg_password_cache", false) + .value("basic/clear_gpg_password_cache", false) .toBool()) { if (GpgFrontend::GpgAdvancedOperator::ClearGpgPasswordCache()) { GF_UI_LOG_DEBUG("clear gpg password cache done"); @@ -178,8 +178,8 @@ void MainWindow::restore_settings() { if (key_server.default_server < 0) key_server.default_server = 0; auto settings = GlobalSettingStation::GetInstance().GetSettings(); - if (!settings.contains("general/non_ascii_when_export")) { - settings.setValue("general/non_ascii_when_export", true); + if (!settings.contains("basic/non_ascii_when_export")) { + settings.setValue("basic/non_ascii_when_export", true); } // set appearance diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index c4cce04f..80390b13 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -53,7 +53,7 @@ void MainWindow::SlotFileEncrypt(const QString& path) { bool const non_ascii_when_export = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/non_ascii_when_export", true) + .value("basic/non_ascii_when_export", true) .toBool(); auto out_path = SetExtensionOfOutputFile(path, kENCRYPT, !non_ascii_when_export); @@ -161,7 +161,7 @@ void MainWindow::SlotDirectoryEncrypt(const QString& path) { bool const non_ascii_when_export = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/non_ascii_when_export", true) + .value("basic/non_ascii_when_export", true) .toBool(); auto out_path = SetExtensionOfOutputFileForArchive(path, kENCRYPT, !non_ascii_when_export); @@ -385,7 +385,7 @@ void MainWindow::SlotFileSign(const QString& path) { bool const non_ascii_when_export = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/non_ascii_when_export", true) + .value("basic/non_ascii_when_export", true) .toBool(); auto sig_file_path = SetExtensionOfOutputFile(path, kSIGN, !non_ascii_when_export); @@ -536,7 +536,7 @@ void MainWindow::SlotFileEncryptSign(const QString& path) { bool const non_ascii_when_export = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/non_ascii_when_export", true) + .value("basic/non_ascii_when_export", true) .toBool(); auto out_path = SetExtensionOfOutputFile(path, kENCRYPT_SIGN, !non_ascii_when_export); @@ -637,7 +637,7 @@ void MainWindow::SlotDirectoryEncryptSign(const QString& path) { bool const non_ascii_when_export = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/non_ascii_when_export", true) + .value("basic/non_ascii_when_export", true) .toBool(); auto out_path = SetExtensionOfOutputFileForArchive(path, kENCRYPT_SIGN, !non_ascii_when_export); diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index ea33e494..ba3e983b 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -362,7 +362,7 @@ void KeyList::dropEvent(QDropEvent* event) { bool confirm_import_keys = GlobalSettingStation::GetInstance() .GetSettings() - .value("general/confirm_import_keys", true) + .value("basic/confirm_import_keys", true) .toBool(); if (confirm_import_keys) check_box->setCheckState(Qt::Checked); @@ -384,7 +384,7 @@ void KeyList::dropEvent(QDropEvent* event) { if (dialog->result() == QDialog::Rejected) return; auto settings = GlobalSettingStation::GetInstance().GetSettings(); - settings.setValue("general/confirm_import_keys", check_box->isChecked()); + settings.setValue("basic/confirm_import_keys", check_box->isChecked()); } if (event->mimeData()->hasUrls()) { diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index 61fdd609..1812dd23 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -613,7 +613,7 @@ void TextEdit::slot_save_status_to_cache_for_revovery() { GpgFrontend::GlobalSettingStation::GetInstance().GetSettings(); bool restore_text_editor_page = - settings.value("general/restore_text_editor_page", false).toBool(); + settings.value("basic/restore_text_editor_page", false).toBool(); if (!restore_text_editor_page) { GF_UI_LOG_DEBUG("restore_text_editor_page is false, ignoring..."); return; |