From dbf37c023e8f7b5586c70687931278255d19d2a2 Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Sun, 17 Mar 2024 10:43:41 +0100 Subject: [PATCH] refactor: Remove settings hotkey tab access The hotkeys were only implemented for some tabs as this was likely forgotten for the new tabs. As this feature was likely not used very often and to reduce the maintanance burden, this commit removes this feature. --- src/blackgui/components/settingscomponent.cpp | 117 ------------------ src/blackgui/components/settingscomponent.h | 6 - src/blackgui/components/settingscomponent.ui | 7 -- 3 files changed, 130 deletions(-) diff --git a/src/blackgui/components/settingscomponent.cpp b/src/blackgui/components/settingscomponent.cpp index de5ddb057..6c898d0c0 100644 --- a/src/blackgui/components/settingscomponent.cpp +++ b/src/blackgui/components/settingscomponent.cpp @@ -4,20 +4,15 @@ #include "blackgui/components/audionotificationcomponent.h" #include "blackgui/components/settingscomponent.h" #include "blackgui/guiapplication.h" -#include "blackgui/stylesheetutility.h" #include "blackconfig/buildconfig.h" -#include "blackmisc/logmessage.h" #include "ui_settingscomponent.h" #include #include #include -#include -#include #include #include #include -#include using namespace BlackMisc; using namespace BlackMisc::Network; @@ -56,72 +51,11 @@ namespace BlackGui::Components connect(ui->pb_SimulatorMessages, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); connect(ui->pb_Matching, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); connect(ui->pb_DataLoadAndCaches, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); - - this->initActions(); } CSettingsComponent::~CSettingsComponent() {} - void CSettingsComponent::initActions() - { - QAction *a = new QAction(this); - a->setObjectName("overview"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_O)); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - ui->lbl_Hint->setText("Hint: See tooltips for shortcuts, \"ALT+S, O\" for overview."); - - a = new QAction(this); - a->setObjectName("audio"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_A)); - ui->pb_Audio->setToolTip(a->shortcut().toString()); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - - a = new QAction(this); - a->setObjectName("data"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_D)); - ui->pb_DataLoadAndCaches->setToolTip(a->shortcut().toString()); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - - a = new QAction(this); - a->setObjectName("gui"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_G)); - ui->pb_Gui->setToolTip(a->shortcut().toString()); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - - a = new QAction(this); - a->setObjectName("hotkeys"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_H)); - ui->pb_Hotkeys->setToolTip(a->shortcut().toString()); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - - a = new QAction(this); - a->setObjectName("network"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_N)); - ui->pb_Network->setToolTip(a->shortcut().toString()); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - - a = new QAction(this); - a->setObjectName("simulator"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_S)); - ui->pb_Simulator->setToolTip(a->shortcut().toString()); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - - a = new QAction(this); - a->setObjectName("matching"); - a->setShortcut(QKeySequence(static_cast(Qt::ALT) + Qt::Key_S, Qt::Key_M)); - ui->pb_Matching->setToolTip(a->shortcut().toString()); - connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); - this->addAction(a); - } - bool CSettingsComponent::playNotificationSounds() const { return ui->comp_AudioNotification->playNotificationSounds(); @@ -207,55 +141,4 @@ namespace BlackGui::Components } this->setCurrentIndex(SettingTabOverview); } - - void CSettingsComponent::onActionTriggered() - { - const QString a = QObject::sender()->objectName().toLower().trimmed(); - if (a.isEmpty()) { return; } - if (a.contains("audio")) - { - this->setCurrentIndex(SettingTabAudio); - return; - } - if (a.contains("data")) - { - this->setCurrentIndex(SettingTabDataAndCaches); - return; - } - if (a.contains("gui")) - { - this->setCurrentIndex(SettingTabGui); - return; - } - if (a.contains("hot")) - { - this->setCurrentIndex(SettingTabHotkeys); - return; - } - if (a.contains("network")) - { - this->setCurrentIndex(SettingTabNetwork); - return; - } - if (a.contains("overview")) - { - this->setCurrentIndex(SettingTabOverview); - return; - } - if (a.contains("simulator")) - { - this->setCurrentIndex(SettingTabSimulator); - return; - } - if (a.contains("matching")) - { - this->setCurrentIndex(SettingTabMatching); - return; - } - if (a.contains("advanced")) - { - this->setCurrentIndex(SettingTabAdvanced); - return; - } - } } // namespace diff --git a/src/blackgui/components/settingscomponent.h b/src/blackgui/components/settingscomponent.h index a4adb81e7..d9c2c8a19 100644 --- a/src/blackgui/components/settingscomponent.h +++ b/src/blackgui/components/settingscomponent.h @@ -83,12 +83,6 @@ namespace BlackGui::Components //! An overview button was clicked void onOverviewButtonClicked(); - //! Action triggered - void onActionTriggered(); - - //! Init actions - void initActions(); - QScopedPointer ui; }; } // namespace diff --git a/src/blackgui/components/settingscomponent.ui b/src/blackgui/components/settingscomponent.ui index aafa6341e..643dc228d 100644 --- a/src/blackgui/components/settingscomponent.ui +++ b/src/blackgui/components/settingscomponent.ui @@ -137,13 +137,6 @@ - - - - Hint: see tooltips for shortcuts. - - -