diff options
author | Saturneric <[email protected]> | 2022-02-07 11:56:18 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-02-07 11:56:18 +0000 |
commit | 1028b92343c0f8579503d3439d1b6ae76c35b8ca (patch) | |
tree | ec2bc2b41e8c280b2653bb96b9a289654a36d8f4 /src/ui/main_window/MainWindowSlotUI.cpp | |
parent | <fix>(core, ui): Fix the remaining problems in the data object (diff) | |
download | GpgFrontend-1028b92343c0f8579503d3439d1b6ae76c35b8ca.tar.gz GpgFrontend-1028b92343c0f8579503d3439d1b6ae76c35b8ca.zip |
<fix>(ui): Adapt some settings transferred to the data object
Diffstat (limited to 'src/ui/main_window/MainWindowSlotUI.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowSlotUI.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp index 9b7e358d..42dd3be7 100644 --- a/src/ui/main_window/MainWindowSlotUI.cpp +++ b/src/ui/main_window/MainWindowSlotUI.cpp @@ -27,8 +27,9 @@ */ #include "MainWindow.h" -#include "ui/UserInterfaceUtils.h" #include "core/function/GlobalSettingStation.h" +#include "ui/UserInterfaceUtils.h" +#include "ui/struct/SettingsObject.h" namespace GpgFrontend::UI { @@ -104,20 +105,24 @@ void MainWindow::slot_open_settings_dialog() { connect(dialog, &SettingsDialog::finished, this, [&]() -> void { LOG(INFO) << "Setting Dialog Finished"; - auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); + SettingsObject main_windows_state("main_windows_state"); - int icon_width = settings["window"]["icon_size"]["width"]; - int icon_height = settings["window"]["icon_size"]["height"]; + int width = main_windows_state.Check("icon_size").Check("width", 24), + height = main_windows_state.Check("icon_size").Check("height", 24); + LOG(INFO) << "icon_size" << width << height; - this->setIconSize(QSize(icon_width, icon_height)); - import_button_->setIconSize(QSize(icon_width, icon_height)); + main_windows_state.Check("info_font_size", 10); - // Iconstyle + // icon_style + int s_icon_style = + main_windows_state.Check("icon_style", Qt::ToolButtonTextUnderIcon); + auto icon_style = static_cast<Qt::ToolButtonStyle>(s_icon_style); + this->setToolButtonStyle(icon_style); + import_button_->setToolButtonStyle(icon_style); - int icon_style = settings["window"]["icon_style"]; - auto button_style = static_cast<Qt::ToolButtonStyle>(icon_style); - this->setToolButtonStyle(button_style); - import_button_->setToolButtonStyle(button_style); + // icons ize + this->setIconSize(QSize(width, height)); + import_button_->setIconSize(QSize(width, height)); // restart mainwindow if necessary if (get_restart_needed()) { @@ -126,15 +131,6 @@ void MainWindow::slot_open_settings_dialog() { qApp->exit(RESTART_CODE); } } -#ifdef ADVANCED_SUPPORT - // steganography hide/show - if (!settings.value("advanced/steganography").toBool()) { - this->menuBar()->removeAction(steganoMenu->menuAction()); - } else { - this->menuBar()->insertAction(viewMenu->menuAction(), - steganoMenu->menuAction()); - } -#endif }); } |