Skip to content

Commit

Permalink
refactor: Remove settings hotkey tab access
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ltoenning committed Mar 17, 2024
1 parent 482407e commit 9f1d948
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 130 deletions.
117 changes: 0 additions & 117 deletions src/blackgui/components/settingscomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
6 changes: 0 additions & 6 deletions src/blackgui/components/settingscomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions src/blackgui/components/settingscomponent.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 9f1d948

Please sign in to comment.