diff options
author | Saturneric <[email protected]> | 2022-05-19 19:16:33 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-05-19 19:16:33 +0000 |
commit | 8eb19fcf9cd43fedcb862fcaab4ce9bdf6eb505a (patch) | |
tree | 49ae121b3408e099ebcbe3e9e766fd0e7ff0b035 | |
parent | fix: solve general problems for compiling (diff) | |
download | GpgFrontend-8eb19fcf9cd43fedcb862fcaab4ce9bdf6eb505a.tar.gz GpgFrontend-8eb19fcf9cd43fedcb862fcaab4ce9bdf6eb505a.zip |
fix: improve settings dialog style on macOS
-rw-r--r-- | src/ui/main_window/MainWindowUI.cpp | 11 | ||||
-rw-r--r-- | src/ui/settings/SettingsDialog.cpp | 29 |
2 files changed, 25 insertions, 15 deletions
diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index fa5e6de3..7d798c8b 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -53,7 +53,8 @@ void MainWindow::create_actions() { browser_act_->setIcon(QIcon(":file-browser.png")); browser_act_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); browser_act_->setToolTip(_("Open a file browser")); - connect(browser_act_, &QAction::triggered, this, &MainWindow::slot_open_file_tab); + connect(browser_act_, &QAction::triggered, this, + &MainWindow::slot_open_file_tab); save_act_ = new QAction(_("Save File"), this); save_act_->setIcon(QIcon(":filesave.png")); @@ -135,7 +136,8 @@ void MainWindow::create_actions() { select_all_act_->setIcon(QIcon(":edit.png")); select_all_act_->setShortcut(QKeySequence::SelectAll); select_all_act_->setToolTip(_("Select the whole text")); - connect(select_all_act_, &QAction::triggered, edit_, &TextEdit::SlotSelectAll); + connect(select_all_act_, &QAction::triggered, edit_, + &TextEdit::SlotSelectAll); find_act_ = new QAction(_("Find"), this); find_act_->setShortcut(QKeySequence::Find); @@ -153,6 +155,7 @@ void MainWindow::create_actions() { open_settings_act_ = new QAction(_("Settings"), this); open_settings_act_->setToolTip(_("Open settings dialog")); + open_settings_act_->setMenuRole(QAction::PreferencesRole); open_settings_act_->setShortcut(QKeySequence::Preferences); connect(open_settings_act_, &QAction::triggered, this, &MainWindow::slot_open_settings_dialog); @@ -244,6 +247,7 @@ void MainWindow::create_actions() { about_act_ = new QAction(_("About"), this); about_act_->setIcon(QIcon(":help.png")); about_act_->setToolTip(_("Show the application's About box")); + about_act_->setMenuRole(QAction::AboutRole); connect(about_act_, &QAction::triggered, this, [=]() { new AboutDialog(0, this); }); @@ -269,8 +273,7 @@ void MainWindow::create_actions() { /* Popup-Menu-Action for KeyList */ - append_selected_keys_act_ = - new QAction(_("Append To Text Editor"), this); + append_selected_keys_act_ = new QAction(_("Append To Text Editor"), this); append_selected_keys_act_->setToolTip( _("Append The Selected Public Key To Text in Editor")); connect(append_selected_keys_act_, &QAction::triggered, this, diff --git a/src/ui/settings/SettingsDialog.cpp b/src/ui/settings/SettingsDialog.cpp index bf3ce6a8..a08a16d0 100644 --- a/src/ui/settings/SettingsDialog.cpp +++ b/src/ui/settings/SettingsDialog.cpp @@ -29,12 +29,12 @@ #include "SettingsDialog.h" #include "core/function/GlobalSettingStation.h" +#include "ui/main_window/MainWindow.h" #include "ui/settings/SettingsAdvanced.h" #include "ui/settings/SettingsAppearance.h" #include "ui/settings/SettingsGeneral.h" #include "ui/settings/SettingsKeyServer.h" #include "ui/settings/SettingsNetwork.h" -#include "ui/main_window/MainWindow.h" namespace GpgFrontend::UI { @@ -45,31 +45,38 @@ SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) { key_server_tab_ = new KeyserverTab(); network_tab_ = new NetworkTab(); + auto* mainLayout = new QVBoxLayout; + mainLayout->addWidget(tab_widget_); + mainLayout->stretch(0); + tab_widget_->addTab(general_tab_, _("General")); tab_widget_->addTab(appearance_tab_, _("Appearance")); tab_widget_->addTab(key_server_tab_, _("Key Server")); tab_widget_->addTab(network_tab_, _("Network")); +#ifndef MACOS button_box_ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - - connect(button_box_, &QDialogButtonBox::accepted, this, &SettingsDialog::SlotAccept); - connect(button_box_, &QDialogButtonBox::rejected, this, &SettingsDialog::reject); - - auto* mainLayout = new QVBoxLayout; - mainLayout->addWidget(tab_widget_); - mainLayout->stretch(0); + connect(button_box_, &QDialogButtonBox::accepted, this, + &SettingsDialog::SlotAccept); + connect(button_box_, &QDialogButtonBox::rejected, this, + &SettingsDialog::reject); mainLayout->addWidget(button_box_); mainLayout->stretch(0); - setLayout(mainLayout); - setWindowTitle(_("Settings")); +#else + connect(this, &QDialog::close, this, &SettingsDialog::SlotAccept); + setWindowTitle(_("Preference")); +#endif + + setLayout(mainLayout); // slots for handling the restart needed member this->slot_set_restart_needed(false); connect(general_tab_, &GeneralTab::SignalRestartNeeded, this, &SettingsDialog::slot_set_restart_needed); - connect(this, &SettingsDialog::SignalRestartNeeded, qobject_cast<MainWindow *>(parent), &MainWindow::SlotSetRestartNeeded); + connect(this, &SettingsDialog::SignalRestartNeeded, + qobject_cast<MainWindow*>(parent), &MainWindow::SlotSetRestartNeeded); this->setMinimumSize(480, 680); this->adjustSize(); |