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.
This commit is contained in:
Lars Toenning
2024-03-17 10:43:41 +01:00
parent 9cdd624ae0
commit dbf37c023e
3 changed files with 0 additions and 130 deletions

View File

@@ -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 <QAction>
#include <QComboBox>
#include <QLineEdit>
#include <QSlider>
#include <QString>
#include <QTabBar>
#include <QToolButton>
#include <QtGlobal>
#include <QKeySequence>
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::Key>(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::Key>(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::Key>(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::Key>(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::Key>(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::Key>(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::Key>(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::Key>(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

View File

@@ -83,12 +83,6 @@ namespace BlackGui::Components
//! An overview button was clicked
void onOverviewButtonClicked();
//! Action triggered
void onActionTriggered();
//! Init actions
void initActions();
QScopedPointer<Ui::CSettingsComponent> ui;
};
} // namespace

View File

@@ -137,13 +137,6 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="lbl_Hint">
<property name="text">
<string>Hint: see tooltips for shortcuts.</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QPushButton" name="pb_Advanced">
<property name="sizePolicy">