Qt2 TAS input: Generate key strings automatically

This saves us from having to hardcode strings, and it also gives
us strings in whatever format is appropriate on the current OS
(for instance, IIRC Windows uses Alt+F where other OSes use Alt-F).
This commit is contained in:
JosJuice
2018-03-04 19:25:24 +01:00
parent 45040f00c6
commit 83373e2e87
4 changed files with 61 additions and 56 deletions

View File

@ -17,12 +17,10 @@
GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : QDialog(parent)
{
setWindowTitle(tr("GameCube TAS Input %1").arg(num + 1));
auto* main_stick_box =
CreateStickInputs(this, tr("Main Stick") + QStringLiteral(" (ALT+F/G)"), m_x_main_stick_value,
m_y_main_stick_value, 255, 255, Qt::Key_F, Qt::Key_G);
auto* c_stick_box =
CreateStickInputs(this, tr("C Stick") + QStringLiteral(" (ALT+H/J)"), m_x_c_stick_value,
m_y_c_stick_value, 255, 255, Qt::Key_H, Qt::Key_J);
auto* main_stick_box = CreateStickInputs(this, tr("Main Stick"), m_x_main_stick_value,
m_y_main_stick_value, 255, 255, Qt::Key_F, Qt::Key_G);
auto* c_stick_box = CreateStickInputs(this, tr("C Stick"), m_x_c_stick_value, m_y_c_stick_value,
255, 255, Qt::Key_H, Qt::Key_J);
auto* top_layout = new QHBoxLayout;
top_layout->addWidget(main_stick_box);
@ -30,12 +28,10 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : QDialog(parent)
auto* triggers_box = new QGroupBox(tr("Triggers"));
auto* l_trigger_layout =
CreateSliderValuePairLayout(this, tr("Left") + QStringLiteral(" (ALT+N)"), m_l_trigger_value,
255, Qt::Key_N, triggers_box);
auto* r_trigger_layout =
CreateSliderValuePairLayout(this, tr("Right") + QStringLiteral(" (ALT+M)"), m_r_trigger_value,
255, Qt::Key_M, triggers_box);
auto* l_trigger_layout = CreateSliderValuePairLayout(this, tr("Left"), m_l_trigger_value, 255,
Qt::Key_N, triggers_box);
auto* r_trigger_layout = CreateSliderValuePairLayout(this, tr("Right"), m_r_trigger_value, 255,
Qt::Key_M, triggers_box);
auto* triggers_layout = new QVBoxLayout;
triggers_layout->addLayout(l_trigger_layout);