From 45040f00c6d26dd0cd10500b8fd677669bb3573e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 4 Mar 2018 19:08:57 +0100 Subject: [PATCH 1/2] Tweak Qt strings to be more translation friendly --- .../Core/DolphinQt2/Config/NewPatchDialog.cpp | 6 +- .../Core/DolphinQt2/Config/PatchesWidget.cpp | 6 +- Source/Core/DolphinQt2/GCMemcardManager.cpp | 16 ++-- Source/Core/DolphinQt2/Settings/WiiPane.cpp | 4 +- .../Core/DolphinQt2/TAS/GCTASInputWindow.cpp | 20 +++-- .../Core/DolphinQt2/TAS/WiiTASInputWindow.cpp | 74 +++++++++++-------- 6 files changed, 73 insertions(+), 53 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/NewPatchDialog.cpp b/Source/Core/DolphinQt2/Config/NewPatchDialog.cpp index f575366306..07d9086456 100644 --- a/Source/Core/DolphinQt2/Config/NewPatchDialog.cpp +++ b/Source/Core/DolphinQt2/Config/NewPatchDialog.cpp @@ -93,9 +93,9 @@ QGroupBox* NewPatchDialog::CreateEntry(int index) auto* type_layout = new QHBoxLayout; auto* remove = new QPushButton(tr("Remove")); - auto* byte = new QRadioButton(tr("byte")); - auto* word = new QRadioButton(tr("word")); - auto* dword = new QRadioButton(tr("dword")); + auto* byte = new QRadioButton(tr("8-bit")); + auto* word = new QRadioButton(tr("16-bit")); + auto* dword = new QRadioButton(tr("32-bit")); type_layout->addWidget(byte); type_layout->addWidget(word); diff --git a/Source/Core/DolphinQt2/Config/PatchesWidget.cpp b/Source/Core/DolphinQt2/Config/PatchesWidget.cpp index b2e1c2c1b6..a922371669 100644 --- a/Source/Core/DolphinQt2/Config/PatchesWidget.cpp +++ b/Source/Core/DolphinQt2/Config/PatchesWidget.cpp @@ -87,7 +87,11 @@ void PatchesWidget::OnEdit() auto patch = m_patches[m_list->row(item)]; if (!patch.user_defined) - patch.name += tr(" (Copy)").toStdString(); + { + // i18n: If there is a pre-defined patch with the name %1 and the user wants to edit it, + // a copy of it gets created with this name + patch.name = tr("%1 (Copy)").arg(QString::fromStdString(patch.name)).toStdString(); + } if (NewPatchDialog(patch).exec()) { diff --git a/Source/Core/DolphinQt2/GCMemcardManager.cpp b/Source/Core/DolphinQt2/GCMemcardManager.cpp index 7fc804bf3a..a8e01e8b56 100644 --- a/Source/Core/DolphinQt2/GCMemcardManager.cpp +++ b/Source/Core/DolphinQt2/GCMemcardManager.cpp @@ -299,10 +299,9 @@ void GCMemcardManager::ExportFiles(bool prompt) } } - QMessageBox::information(this, tr("Success"), - tr("Successfully exported %1 %2") - .arg(count) - .arg(count == 1 ? tr("save file") : tr("save files"))); + QString text = count == 1 ? tr("Successfully exported the save file.") : + tr("Successfully exported the %1 save files."); + QMessageBox::information(this, tr("Success"), text); } void GCMemcardManager::ExportAllFiles() @@ -362,11 +361,10 @@ void GCMemcardManager::DeleteFiles() // Ask for confirmation if we are to delete multiple files if (count > 1) { - auto response = QMessageBox::warning(this, tr("Question"), - tr("Do you want to delete the %1 selected %2?") - .arg(count) - .arg(count == 1 ? tr("save file") : tr("save files")), - QMessageBox::Yes | QMessageBox::Abort); + QString text = count == 1 ? tr("Do you want to delete the selected save file?") : + tr("Do you want to delete the %1 selected save files?").arg(count); + auto response = + QMessageBox::warning(this, tr("Question"), text, QMessageBox::Yes | QMessageBox::Abort); if (response == QMessageBox::Abort) return; diff --git a/Source/Core/DolphinQt2/Settings/WiiPane.cpp b/Source/Core/DolphinQt2/Settings/WiiPane.cpp index 8cf970572a..f14c194b4c 100644 --- a/Source/Core/DolphinQt2/Settings/WiiPane.cpp +++ b/Source/Core/DolphinQt2/Settings/WiiPane.cpp @@ -118,7 +118,7 @@ void WiiPane::CreateMisc() "(576i) for PAL games.\nMay not work for all games.")); m_screensaver_checkbox->setToolTip(tr("Dims the screen after five minutes of inactivity.")); m_system_language_choice->setToolTip(tr("Sets the Wii system language.")); - m_sd_card_checkbox->setToolTip(tr("Saved to /Wii/sd.raw (default size is 128mb)")); + m_sd_card_checkbox->setToolTip(tr("Saved to /Wii/sd.raw (default size is 128mb).")); m_connect_keyboard_checkbox->setToolTip(tr("May cause slow down in Wii Menu and some games.")); misc_settings_group_layout->addWidget(m_pal60_mode_checkbox, 0, 0, 1, 1); @@ -156,7 +156,7 @@ void WiiPane::CreateWiiRemoteSettings() m_main_layout->addWidget(wii_remote_settings_group); m_wiimote_motor = new QCheckBox(tr("Wii Remote Rumble")); - m_wiimote_sensor_position_label = new QLabel(tr("Sensor Position:")); + m_wiimote_sensor_position_label = new QLabel(tr("Sensor Bar Position:")); m_wiimote_ir_sensor_position = new QComboBox(); m_wiimote_ir_sensor_position->addItem(tr("Top")); m_wiimote_ir_sensor_position->addItem(tr("Bottom")); diff --git a/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp b/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp index 4c7985a480..0aa13597d8 100644 --- a/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp +++ b/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp @@ -17,10 +17,12 @@ 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 (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 (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") + 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* top_layout = new QHBoxLayout; top_layout->addWidget(main_stick_box); @@ -28,10 +30,12 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : QDialog(parent) auto* triggers_box = new QGroupBox(tr("Triggers")); - auto* l_trigger_layout = CreateSliderValuePairLayout(this, tr("Left (ALT+N)"), m_l_trigger_value, - 255, Qt::Key_N, triggers_box); - auto* r_trigger_layout = CreateSliderValuePairLayout(this, tr("Right (ALT+M)"), m_r_trigger_value, - 255, Qt::Key_M, triggers_box); + 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* triggers_layout = new QVBoxLayout; triggers_layout->addLayout(l_trigger_layout); diff --git a/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp b/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp index c077b667a4..52aa3af5df 100644 --- a/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp +++ b/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp @@ -25,7 +25,7 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent), m_num(num) { - m_ir_box = new QGroupBox(tr("IR (ALT+F/G)")); + m_ir_box = new QGroupBox(tr("IR") + QStringLiteral(" (ALT+F/G)")); auto* x_layout = new QHBoxLayout; m_ir_x_value = CreateSliderValuePair(this, x_layout, ir_max_x, Qt::Key_F, Qt::Horizontal, @@ -58,24 +58,24 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) ir_layout->addLayout(visual_layout); m_ir_box->setLayout(ir_layout); - m_nunchuk_stick_box = - CreateStickInputs(this, tr("Nunchuk Stick (ALT+X/Y)"), m_nunchuk_stick_x_value, - m_nunchuk_stick_y_value, 255, 255, Qt::Key_X, Qt::Key_Y); + m_nunchuk_stick_box = CreateStickInputs(this, tr("Nunchuk Stick") + QStringLiteral(" (ALT+X/Y)"), + m_nunchuk_stick_x_value, m_nunchuk_stick_y_value, 255, + 255, Qt::Key_X, Qt::Key_Y); - m_classic_left_stick_box = - CreateStickInputs(this, tr("Left Stick (ALT+F/G)"), m_classic_left_stick_x_value, - m_classic_left_stick_y_value, 63, 63, Qt::Key_F, Qt::Key_G); + m_classic_left_stick_box = CreateStickInputs( + this, tr("Left Stick") + QStringLiteral(" (ALT+F/G)"), m_classic_left_stick_x_value, + m_classic_left_stick_y_value, 63, 63, Qt::Key_F, Qt::Key_G); - m_classic_right_stick_box = - CreateStickInputs(this, tr("Right Stick (ALT+Q/W)"), m_classic_right_stick_x_value, - m_classic_right_stick_y_value, 31, 31, Qt::Key_Q, Qt::Key_W); + m_classic_right_stick_box = CreateStickInputs( + this, tr("Right Stick") + QStringLiteral(" (ALT+Q/W)"), m_classic_right_stick_x_value, + m_classic_right_stick_y_value, 31, 31, Qt::Key_Q, Qt::Key_W); // Need to enforce the same minimum width because otherwise the different lengths in the labels // used on the QGroupBox will cause the StickWidgets to have different sizes. m_ir_box->setMinimumWidth(20); m_nunchuk_stick_box->setMinimumWidth(20); - m_remote_orientation_box = new QGroupBox(tr("Remote Orientation")); + m_remote_orientation_box = new QGroupBox(tr("Wii Remote Orientation")); auto* top_layout = new QHBoxLayout; top_layout->addWidget(m_ir_box); @@ -84,14 +84,20 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) top_layout->addWidget(m_classic_right_stick_box); auto* remote_orientation_x_layout = - CreateSliderValuePairLayout(this, tr("X (ALT+Q)"), m_remote_orientation_x_value, 1023, - Qt::Key_Q, m_remote_orientation_box); + // i18n: Refers to a 3D axis (used when mapping motion controls) + CreateSliderValuePairLayout(this, tr("X") + QStringLiteral(" (ALT+Q)"), + m_remote_orientation_x_value, 1023, Qt::Key_Q, + m_remote_orientation_box); auto* remote_orientation_y_layout = - CreateSliderValuePairLayout(this, tr("Y (ALT+W)"), m_remote_orientation_y_value, 1023, - Qt::Key_W, m_remote_orientation_box); + // i18n: Refers to a 3D axis (used when mapping motion controls) + CreateSliderValuePairLayout(this, tr("Y") + QStringLiteral(" (ALT+W)"), + m_remote_orientation_y_value, 1023, Qt::Key_W, + m_remote_orientation_box); auto* remote_orientation_z_layout = - CreateSliderValuePairLayout(this, tr("Z (ALT+E)"), m_remote_orientation_z_value, 1023, - Qt::Key_E, m_remote_orientation_box); + // i18n: Refers to a 3D axis (used when mapping motion controls) + CreateSliderValuePairLayout(this, tr("Z") + QStringLiteral(" (ALT+E)"), + m_remote_orientation_z_value, 1023, Qt::Key_E, + m_remote_orientation_box); auto* remote_orientation_layout = new QVBoxLayout; remote_orientation_layout->addLayout(remote_orientation_x_layout); @@ -102,14 +108,20 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) m_nunchuk_orientation_box = new QGroupBox(tr("Nunchuk Orientation")); auto* nunchuk_orientation_x_layout = - CreateSliderValuePairLayout(this, tr("X (ALT+I)"), m_nunchuk_orientation_x_value, 1023, - Qt::Key_I, m_nunchuk_orientation_box); + // i18n: Refers to a 3D axis (used when mapping motion controls) + CreateSliderValuePairLayout(this, tr("X") + QStringLiteral(" (ALT+I)"), + m_nunchuk_orientation_x_value, 1023, Qt::Key_I, + m_nunchuk_orientation_box); auto* nunchuk_orientation_y_layout = - CreateSliderValuePairLayout(this, tr("Y (ALT+O)"), m_nunchuk_orientation_y_value, 1023, - Qt::Key_O, m_nunchuk_orientation_box); + // i18n: Refers to a 3D axis (used when mapping motion controls) + CreateSliderValuePairLayout(this, tr("Y") + QStringLiteral(" (ALT+O)"), + m_nunchuk_orientation_y_value, 1023, Qt::Key_O, + m_nunchuk_orientation_box); auto* nunchuk_orientation_z_layout = - CreateSliderValuePairLayout(this, tr("Z (ALT+P)"), m_nunchuk_orientation_z_value, 1023, - Qt::Key_P, m_nunchuk_orientation_box); + // i18n: Refers to a 3D axis (used when mapping motion controls) + CreateSliderValuePairLayout(this, tr("Z") + QStringLiteral(" (ALT+P)"), + m_nunchuk_orientation_z_value, 1023, Qt::Key_P, + m_nunchuk_orientation_box); auto* nunchuk_orientation_layout = new QVBoxLayout; nunchuk_orientation_layout->addLayout(nunchuk_orientation_x_layout); @@ -118,10 +130,12 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) m_nunchuk_orientation_box->setLayout(nunchuk_orientation_layout); m_triggers_box = new QGroupBox(tr("Triggers")); - auto* l_trigger_layout = CreateSliderValuePairLayout( - this, tr("Left (ALT+N)"), m_left_trigger_value, 31, Qt::Key_N, m_triggers_box); - auto* r_trigger_layout = CreateSliderValuePairLayout( - this, tr("Right (ALT+M)"), m_right_trigger_value, 31, Qt::Key_M, m_triggers_box); + auto* l_trigger_layout = + CreateSliderValuePairLayout(this, tr("Left") + QStringLiteral(" (ALT+N)"), + m_left_trigger_value, 31, Qt::Key_N, m_triggers_box); + auto* r_trigger_layout = + CreateSliderValuePairLayout(this, tr("Right") + QStringLiteral(" (ALT+M)"), + m_right_trigger_value, 31, Qt::Key_M, m_triggers_box); auto* triggers_layout = new QVBoxLayout; triggers_layout->addLayout(l_trigger_layout); @@ -162,7 +176,7 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) remote_buttons_layout->addLayout(buttons_layout1); remote_buttons_layout->addLayout(buttons_layout2); - m_remote_buttons_box = new QGroupBox(tr("Remote Buttons")); + m_remote_buttons_box = new QGroupBox(tr("Wii Remote Buttons")); m_remote_buttons_box->setLayout(remote_buttons_layout); auto* nunchuk_buttons_layout = new QHBoxLayout; @@ -252,7 +266,7 @@ void WiiTASInputWindow::UpdateExt(u8 ext) { if (ext == 1) { - setWindowTitle(tr("Wii TAS Input %1 - Remote + Nunchuk").arg(m_num + 1)); + setWindowTitle(tr("Wii TAS Input %1 - Wii Remote + Nunchuk").arg(m_num + 1)); m_ir_box->show(); m_nunchuk_stick_box->show(); m_classic_right_stick_box->hide(); @@ -280,7 +294,7 @@ void WiiTASInputWindow::UpdateExt(u8 ext) } else { - setWindowTitle(tr("Wii TAS Input %1 - Remote").arg(m_num + 1)); + setWindowTitle(tr("Wii TAS Input %1 - Wii Remote").arg(m_num + 1)); m_ir_box->show(); m_nunchuk_stick_box->hide(); m_classic_right_stick_box->hide(); From 83373e2e8726575db8c1ffbd6a4dbff1a0a2790e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 4 Mar 2018 19:25:24 +0100 Subject: [PATCH 2/2] 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). --- .../Core/DolphinQt2/TAS/GCTASInputWindow.cpp | 20 +++--- Source/Core/DolphinQt2/TAS/Shared.cpp | 30 ++++++--- Source/Core/DolphinQt2/TAS/Shared.h | 6 +- .../Core/DolphinQt2/TAS/WiiTASInputWindow.cpp | 61 +++++++++---------- 4 files changed, 61 insertions(+), 56 deletions(-) diff --git a/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp b/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp index 0aa13597d8..694b539de0 100644 --- a/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp +++ b/Source/Core/DolphinQt2/TAS/GCTASInputWindow.cpp @@ -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); diff --git a/Source/Core/DolphinQt2/TAS/Shared.cpp b/Source/Core/DolphinQt2/TAS/Shared.cpp index 8debc396cc..ee1f45fe1a 100644 --- a/Source/Core/DolphinQt2/TAS/Shared.cpp +++ b/Source/Core/DolphinQt2/TAS/Shared.cpp @@ -20,13 +20,21 @@ QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value, QSpinBox*& y_value, u16 max_x, u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key) { - auto* box = new QGroupBox(name); + const QKeySequence x_shortcut_key_sequence = QKeySequence(Qt::ALT + x_shortcut_key); + const QKeySequence y_shortcut_key_sequence = QKeySequence(Qt::ALT + y_shortcut_key); + + auto* box = + new QGroupBox(QStringLiteral("%1 (%2/%3)") + .arg(name, x_shortcut_key_sequence.toString(QKeySequence::NativeText), + y_shortcut_key_sequence.toString(QKeySequence::NativeText))); auto* x_layout = new QHBoxLayout; - x_value = CreateSliderValuePair(window, x_layout, max_x, x_shortcut_key, Qt::Horizontal, box); + x_value = + CreateSliderValuePair(window, x_layout, max_x, x_shortcut_key_sequence, Qt::Horizontal, box); auto* y_layout = new QVBoxLayout; - y_value = CreateSliderValuePair(window, y_layout, max_y, y_shortcut_key, Qt::Vertical, box); + y_value = + CreateSliderValuePair(window, y_layout, max_y, y_shortcut_key_sequence, Qt::Vertical, box); y_value->setMaximumWidth(60); auto* visual = new StickWidget(window, max_x, max_y); @@ -57,21 +65,25 @@ QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value, QBoxLayout* CreateSliderValuePairLayout(QDialog* window, QString name, QSpinBox*& value, u16 max, Qt::Key shortcut_key, QWidget* shortcut_widget, bool invert) { - auto* label = new QLabel(name); + const QKeySequence shortcut_key_sequence = QKeySequence(Qt::ALT + shortcut_key); + + auto* label = new QLabel(QStringLiteral("%1 (%2)").arg( + name, shortcut_key_sequence.toString(QKeySequence::NativeText))); QBoxLayout* layout = new QHBoxLayout; layout->addWidget(label); - value = CreateSliderValuePair(window, layout, max, shortcut_key, Qt::Horizontal, shortcut_widget, - invert); + value = CreateSliderValuePair(window, layout, max, shortcut_key_sequence, Qt::Horizontal, + shortcut_widget, invert); return layout; } // The shortcut_widget argument needs to specify the container widget that will be hidden/shown. // This is done to avoid ambigous shortcuts -QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, Qt::Key shortcut_key, - Qt::Orientation orientation, QWidget* shortcut_widget, bool invert) +QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, + QKeySequence shortcut_key_sequence, Qt::Orientation orientation, + QWidget* shortcut_widget, bool invert) { auto* value = new QSpinBox(); value->setRange(0, 99999); @@ -89,7 +101,7 @@ QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, Qt window->connect(value, static_cast(&QSpinBox::valueChanged), slider, &QSlider::setValue); - auto* shortcut = new QShortcut(QKeySequence(Qt::ALT + shortcut_key), shortcut_widget); + auto* shortcut = new QShortcut(shortcut_key_sequence, shortcut_widget); window->connect(shortcut, &QShortcut::activated, [value] { value->setFocus(); value->selectAll(); diff --git a/Source/Core/DolphinQt2/TAS/Shared.h b/Source/Core/DolphinQt2/TAS/Shared.h index 77637f4080..72fdac2ff3 100644 --- a/Source/Core/DolphinQt2/TAS/Shared.h +++ b/Source/Core/DolphinQt2/TAS/Shared.h @@ -21,6 +21,6 @@ QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value, QBoxLayout* CreateSliderValuePairLayout(QDialog* window, QString name, QSpinBox*& value, u16 max, Qt::Key shortcut_key, QWidget* shortcut_widget, bool invert = false); -QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, Qt::Key shortcut_key, - Qt::Orientation orientation, QWidget* shortcut_widget, - bool invert = false); +QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, + QKeySequence shortcut_key_sequence, Qt::Orientation orientation, + QWidget* shortcut_widget, bool invert = false); diff --git a/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp b/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp index 52aa3af5df..5b02c164d7 100644 --- a/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp +++ b/Source/Core/DolphinQt2/TAS/WiiTASInputWindow.cpp @@ -25,15 +25,21 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent), m_num(num) { - m_ir_box = new QGroupBox(tr("IR") + QStringLiteral(" (ALT+F/G)")); + const QKeySequence ir_x_shortcut_key_sequence = QKeySequence(Qt::ALT + Qt::Key_F); + const QKeySequence ir_y_shortcut_key_sequence = QKeySequence(Qt::ALT + Qt::Key_G); + + m_ir_box = new QGroupBox(QStringLiteral("%1 (%2/%3)") + .arg(tr("IR"), + ir_x_shortcut_key_sequence.toString(QKeySequence::NativeText), + ir_y_shortcut_key_sequence.toString(QKeySequence::NativeText))); auto* x_layout = new QHBoxLayout; - m_ir_x_value = CreateSliderValuePair(this, x_layout, ir_max_x, Qt::Key_F, Qt::Horizontal, - m_ir_box, true); + m_ir_x_value = CreateSliderValuePair(this, x_layout, ir_max_x, ir_x_shortcut_key_sequence, + Qt::Horizontal, m_ir_box, true); auto* y_layout = new QVBoxLayout; - m_ir_y_value = CreateSliderValuePair(this, y_layout, ir_max_y, Qt::Key_G, Qt::Vertical, - m_ir_box, true); + m_ir_y_value = CreateSliderValuePair(this, y_layout, ir_max_y, ir_y_shortcut_key_sequence, + Qt::Vertical, m_ir_box, true); m_ir_y_value->setMaximumWidth(60); auto* visual = new IRWidget(this); @@ -58,17 +64,16 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) ir_layout->addLayout(visual_layout); m_ir_box->setLayout(ir_layout); - m_nunchuk_stick_box = CreateStickInputs(this, tr("Nunchuk Stick") + QStringLiteral(" (ALT+X/Y)"), - m_nunchuk_stick_x_value, m_nunchuk_stick_y_value, 255, - 255, Qt::Key_X, Qt::Key_Y); + m_nunchuk_stick_box = CreateStickInputs(this, tr("Nunchuk Stick"), m_nunchuk_stick_x_value, + m_nunchuk_stick_y_value, 255, 255, Qt::Key_X, Qt::Key_Y); - m_classic_left_stick_box = CreateStickInputs( - this, tr("Left Stick") + QStringLiteral(" (ALT+F/G)"), m_classic_left_stick_x_value, - m_classic_left_stick_y_value, 63, 63, Qt::Key_F, Qt::Key_G); + m_classic_left_stick_box = + CreateStickInputs(this, tr("Left Stick"), m_classic_left_stick_x_value, + m_classic_left_stick_y_value, 63, 63, Qt::Key_F, Qt::Key_G); - m_classic_right_stick_box = CreateStickInputs( - this, tr("Right Stick") + QStringLiteral(" (ALT+Q/W)"), m_classic_right_stick_x_value, - m_classic_right_stick_y_value, 31, 31, Qt::Key_Q, Qt::Key_W); + m_classic_right_stick_box = + CreateStickInputs(this, tr("Right Stick"), m_classic_right_stick_x_value, + m_classic_right_stick_y_value, 31, 31, Qt::Key_Q, Qt::Key_W); // Need to enforce the same minimum width because otherwise the different lengths in the labels // used on the QGroupBox will cause the StickWidgets to have different sizes. @@ -85,18 +90,15 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) auto* remote_orientation_x_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) - CreateSliderValuePairLayout(this, tr("X") + QStringLiteral(" (ALT+Q)"), - m_remote_orientation_x_value, 1023, Qt::Key_Q, + CreateSliderValuePairLayout(this, tr("X"), m_remote_orientation_x_value, 1023, Qt::Key_Q, m_remote_orientation_box); auto* remote_orientation_y_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) - CreateSliderValuePairLayout(this, tr("Y") + QStringLiteral(" (ALT+W)"), - m_remote_orientation_y_value, 1023, Qt::Key_W, + CreateSliderValuePairLayout(this, tr("Y"), m_remote_orientation_y_value, 1023, Qt::Key_W, m_remote_orientation_box); auto* remote_orientation_z_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) - CreateSliderValuePairLayout(this, tr("Z") + QStringLiteral(" (ALT+E)"), - m_remote_orientation_z_value, 1023, Qt::Key_E, + CreateSliderValuePairLayout(this, tr("Z"), m_remote_orientation_z_value, 1023, Qt::Key_E, m_remote_orientation_box); auto* remote_orientation_layout = new QVBoxLayout; @@ -109,18 +111,15 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) auto* nunchuk_orientation_x_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) - CreateSliderValuePairLayout(this, tr("X") + QStringLiteral(" (ALT+I)"), - m_nunchuk_orientation_x_value, 1023, Qt::Key_I, + CreateSliderValuePairLayout(this, tr("X"), m_nunchuk_orientation_x_value, 1023, Qt::Key_I, m_nunchuk_orientation_box); auto* nunchuk_orientation_y_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) - CreateSliderValuePairLayout(this, tr("Y") + QStringLiteral(" (ALT+O)"), - m_nunchuk_orientation_y_value, 1023, Qt::Key_O, + CreateSliderValuePairLayout(this, tr("Y"), m_nunchuk_orientation_y_value, 1023, Qt::Key_O, m_nunchuk_orientation_box); auto* nunchuk_orientation_z_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) - CreateSliderValuePairLayout(this, tr("Z") + QStringLiteral(" (ALT+P)"), - m_nunchuk_orientation_z_value, 1023, Qt::Key_P, + CreateSliderValuePairLayout(this, tr("Z"), m_nunchuk_orientation_z_value, 1023, Qt::Key_P, m_nunchuk_orientation_box); auto* nunchuk_orientation_layout = new QVBoxLayout; @@ -130,12 +129,10 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent) m_nunchuk_orientation_box->setLayout(nunchuk_orientation_layout); m_triggers_box = new QGroupBox(tr("Triggers")); - auto* l_trigger_layout = - CreateSliderValuePairLayout(this, tr("Left") + QStringLiteral(" (ALT+N)"), - m_left_trigger_value, 31, Qt::Key_N, m_triggers_box); - auto* r_trigger_layout = - CreateSliderValuePairLayout(this, tr("Right") + QStringLiteral(" (ALT+M)"), - m_right_trigger_value, 31, Qt::Key_M, m_triggers_box); + auto* l_trigger_layout = CreateSliderValuePairLayout(this, tr("Left"), m_left_trigger_value, 31, + Qt::Key_N, m_triggers_box); + auto* r_trigger_layout = CreateSliderValuePairLayout(this, tr("Right"), m_right_trigger_value, 31, + Qt::Key_M, m_triggers_box); auto* triggers_layout = new QVBoxLayout; triggers_layout->addLayout(l_trigger_layout);