mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
refs #892, key sequences / actions for settings
This commit is contained in:
committed by
Mathew Sutcliffe
parent
d504bfbee0
commit
72200d4bba
@@ -22,6 +22,7 @@
|
||||
#include <QTabBar>
|
||||
#include <QToolButton>
|
||||
#include <QtGlobal>
|
||||
#include <QKeySequence>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -60,11 +61,65 @@ namespace BlackGui
|
||||
connect(ui->pb_SimulatorBasics, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
|
||||
connect(ui->pb_DataLoadAndCaches, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
|
||||
connect(ui->pb_SimulatorMessages, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
|
||||
|
||||
this->initActions();
|
||||
}
|
||||
|
||||
CSettingsComponent::~CSettingsComponent()
|
||||
{ }
|
||||
|
||||
void CSettingsComponent::initActions()
|
||||
{
|
||||
QAction *a = nullptr;
|
||||
a = new QAction(this);
|
||||
a->setObjectName("overview");
|
||||
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_O));
|
||||
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
|
||||
this->addAction(a);
|
||||
|
||||
a = new QAction(this);
|
||||
a->setObjectName("audio");
|
||||
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_A));
|
||||
ui->pb_Audio->setToolTip(a->shortcut().toString());
|
||||
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
|
||||
this->addAction(a);
|
||||
|
||||
a = new QAction(this);
|
||||
a->setObjectName("data");
|
||||
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_D));
|
||||
ui->pb_DataLoadAndCaches->setToolTip(a->shortcut().toString());
|
||||
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
|
||||
this->addAction(a);
|
||||
|
||||
a = new QAction(this);
|
||||
a->setObjectName("gui");
|
||||
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_G));
|
||||
ui->pb_Gui->setToolTip(a->shortcut().toString());
|
||||
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
|
||||
this->addAction(a);
|
||||
|
||||
a = new QAction(this);
|
||||
a->setObjectName("hotkeys");
|
||||
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_H));
|
||||
ui->pb_Hotkeys->setToolTip(a->shortcut().toString());
|
||||
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
|
||||
this->addAction(a);
|
||||
|
||||
a = new QAction(this);
|
||||
a->setObjectName("network");
|
||||
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_N));
|
||||
ui->pb_Network->setToolTip(a->shortcut().toString());
|
||||
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
|
||||
this->addAction(a);
|
||||
|
||||
a = new QAction(this);
|
||||
a->setObjectName("simulator");
|
||||
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_S));
|
||||
ui->pb_Simulator->setToolTip(a->shortcut().toString());
|
||||
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
|
||||
this->addAction(a);
|
||||
}
|
||||
|
||||
bool CSettingsComponent::playNotificationSounds() const
|
||||
{
|
||||
return ui->comp_AudioSetup->playNotificationSounds();
|
||||
@@ -95,5 +150,18 @@ namespace BlackGui
|
||||
if (sender == ui->pb_SimulatorMessages) { this->setCurrentIndex(SettingTabSimulatorMessages); return; }
|
||||
this->setCurrentIndex(SettingTabOverview);
|
||||
}
|
||||
|
||||
void CSettingsComponent::ps_actionTriggered()
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user