From 11e4d46927999b7980315a1c546b4075d9f9c8a0 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 7 Mar 2023 19:30:21 +0100 Subject: [PATCH] DolphinQt: Remove unneeded out parameters in TASInputWindow IIRC we needed this before the input override system was added. --- .../Core/DolphinQt/TAS/GCTASInputWindow.cpp | 14 +++--- Source/Core/DolphinQt/TAS/GCTASInputWindow.h | 6 --- Source/Core/DolphinQt/TAS/TASInputWindow.cpp | 19 ++++---- Source/Core/DolphinQt/TAS/TASInputWindow.h | 9 ++-- .../Core/DolphinQt/TAS/WiiTASInputWindow.cpp | 46 ++++++++----------- Source/Core/DolphinQt/TAS/WiiTASInputWindow.h | 14 ------ 6 files changed, 38 insertions(+), 70 deletions(-) diff --git a/Source/Core/DolphinQt/TAS/GCTASInputWindow.cpp b/Source/Core/DolphinQt/TAS/GCTASInputWindow.cpp index 68075185d2..67c3d9a3d7 100644 --- a/Source/Core/DolphinQt/TAS/GCTASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/GCTASInputWindow.cpp @@ -26,12 +26,10 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int controller_id) { setWindowTitle(tr("GameCube TAS Input %1").arg(controller_id + 1)); - m_main_stick_box = CreateStickInputs(tr("Main Stick"), GCPad::MAIN_STICK_GROUP, &m_overrider, - m_x_main_stick_value, m_y_main_stick_value, 1, 1, 255, 255, - Qt::Key_F, Qt::Key_G); - m_c_stick_box = - CreateStickInputs(tr("C Stick"), GCPad::C_STICK_GROUP, &m_overrider, m_x_c_stick_value, - m_y_c_stick_value, 1, 1, 255, 255, Qt::Key_H, Qt::Key_J); + m_main_stick_box = CreateStickInputs(tr("Main Stick"), GCPad::MAIN_STICK_GROUP, &m_overrider, 1, + 1, 255, 255, Qt::Key_F, Qt::Key_G); + m_c_stick_box = CreateStickInputs(tr("C Stick"), GCPad::C_STICK_GROUP, &m_overrider, 1, 1, 255, + 255, Qt::Key_H, Qt::Key_J); auto* top_layout = new QHBoxLayout; top_layout->addWidget(m_main_stick_box); @@ -41,11 +39,11 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int controller_id) auto* l_trigger_layout = CreateSliderValuePairLayout(tr("Left"), GCPad::TRIGGERS_GROUP, GCPad::L_ANALOG, &m_overrider, - m_l_trigger_value, 0, 0, 0, 255, Qt::Key_N, m_triggers_box); + 0, 0, 0, 255, Qt::Key_N, m_triggers_box); auto* r_trigger_layout = CreateSliderValuePairLayout(tr("Right"), GCPad::TRIGGERS_GROUP, GCPad::R_ANALOG, &m_overrider, - m_r_trigger_value, 0, 0, 0, 255, Qt::Key_M, m_triggers_box); + 0, 0, 0, 255, Qt::Key_M, m_triggers_box); auto* triggers_layout = new QVBoxLayout; triggers_layout->addLayout(l_trigger_layout); diff --git a/Source/Core/DolphinQt/TAS/GCTASInputWindow.h b/Source/Core/DolphinQt/TAS/GCTASInputWindow.h index 00830c0f52..3a3fd20d49 100644 --- a/Source/Core/DolphinQt/TAS/GCTASInputWindow.h +++ b/Source/Core/DolphinQt/TAS/GCTASInputWindow.h @@ -37,12 +37,6 @@ private: TASCheckBox* m_up_button; TASCheckBox* m_down_button; TASCheckBox* m_right_button; - QSpinBox* m_l_trigger_value; - QSpinBox* m_r_trigger_value; - QSpinBox* m_x_main_stick_value; - QSpinBox* m_y_main_stick_value; - QSpinBox* m_x_c_stick_value; - QSpinBox* m_y_c_stick_value; QGroupBox* m_main_stick_box; QGroupBox* m_c_stick_box; QGroupBox* m_triggers_box; diff --git a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp index 61e37e5238..047b554b38 100644 --- a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp @@ -93,9 +93,8 @@ TASCheckBox* TASInputWindow::CreateButton(const QString& text, std::string_view } QGroupBox* TASInputWindow::CreateStickInputs(const QString& text, std::string_view group_name, - InputOverrider* overrider, QSpinBox*& x_value, - QSpinBox*& y_value, u16 min_x, u16 min_y, u16 max_x, - u16 max_y, Qt::Key x_shortcut_key, + InputOverrider* overrider, u16 min_x, u16 min_y, + u16 max_x, u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key) { const QKeySequence x_shortcut_key_sequence = QKeySequence(Qt::ALT | x_shortcut_key); @@ -110,11 +109,11 @@ QGroupBox* TASInputWindow::CreateStickInputs(const QString& text, std::string_vi const int y_default = static_cast(std::round(max_y / 2.)); auto* x_layout = new QHBoxLayout; - x_value = CreateSliderValuePair(x_layout, x_default, max_x, x_shortcut_key_sequence, - Qt::Horizontal, box); + QSpinBox* x_value = CreateSliderValuePair(x_layout, x_default, max_x, x_shortcut_key_sequence, + Qt::Horizontal, box); auto* y_layout = new QVBoxLayout; - y_value = + QSpinBox* y_value = CreateSliderValuePair(y_layout, y_default, max_y, y_shortcut_key_sequence, Qt::Vertical, box); y_value->setMaximumWidth(60); @@ -153,8 +152,8 @@ QGroupBox* TASInputWindow::CreateStickInputs(const QString& text, std::string_vi QBoxLayout* TASInputWindow::CreateSliderValuePairLayout( const QString& text, std::string_view group_name, std::string_view control_name, - InputOverrider* overrider, QSpinBox*& value, u16 zero, int default_, u16 min, u16 max, - Qt::Key shortcut_key, QWidget* shortcut_widget, std::optional scale) + InputOverrider* overrider, u16 zero, int default_, u16 min, u16 max, Qt::Key shortcut_key, + QWidget* shortcut_widget, std::optional scale) { const QKeySequence shortcut_key_sequence = QKeySequence(Qt::ALT | shortcut_key); @@ -164,8 +163,8 @@ QBoxLayout* TASInputWindow::CreateSliderValuePairLayout( QBoxLayout* layout = new QHBoxLayout; layout->addWidget(label); - value = CreateSliderValuePair(group_name, control_name, overrider, layout, zero, default_, min, - max, shortcut_key_sequence, Qt::Horizontal, shortcut_widget, scale); + CreateSliderValuePair(group_name, control_name, overrider, layout, zero, default_, min, max, + shortcut_key_sequence, Qt::Horizontal, shortcut_widget, scale); return layout; } diff --git a/Source/Core/DolphinQt/TAS/TASInputWindow.h b/Source/Core/DolphinQt/TAS/TASInputWindow.h index 104cb28fe9..15aea29443 100644 --- a/Source/Core/DolphinQt/TAS/TASInputWindow.h +++ b/Source/Core/DolphinQt/TAS/TASInputWindow.h @@ -50,13 +50,12 @@ protected: TASCheckBox* CreateButton(const QString& text, std::string_view group_name, std::string_view control_name, InputOverrider* overrider); QGroupBox* CreateStickInputs(const QString& text, std::string_view group_name, - InputOverrider* overrider, QSpinBox*& x_value, QSpinBox*& y_value, - u16 min_x, u16 min_y, u16 max_x, u16 max_y, Qt::Key x_shortcut_key, - Qt::Key y_shortcut_key); + InputOverrider* overrider, u16 min_x, u16 min_y, u16 max_x, + u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key); QBoxLayout* CreateSliderValuePairLayout(const QString& text, std::string_view group_name, std::string_view control_name, InputOverrider* overrider, - QSpinBox*& value, u16 zero, int default_, u16 min, - u16 max, Qt::Key shortcut_key, QWidget* shortcut_widget, + u16 zero, int default_, u16 min, u16 max, + Qt::Key shortcut_key, QWidget* shortcut_widget, std::optional scale = {}); QSpinBox* CreateSliderValuePair(std::string_view group_name, std::string_view control_name, InputOverrider* overrider, QBoxLayout* layout, u16 zero, diff --git a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp index e207ee0bb8..c38e340912 100644 --- a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp @@ -83,19 +83,17 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow( ir_layout->addLayout(visual_layout); m_ir_box->setLayout(ir_layout); - m_nunchuk_stick_box = CreateStickInputs( - tr("Nunchuk Stick"), WiimoteEmu::Nunchuk::STICK_GROUP, &m_nunchuk_overrider, - m_nunchuk_stick_x_value, m_nunchuk_stick_y_value, 0, 0, 255, 255, Qt::Key_X, Qt::Key_Y); + m_nunchuk_stick_box = + CreateStickInputs(tr("Nunchuk Stick"), WiimoteEmu::Nunchuk::STICK_GROUP, &m_nunchuk_overrider, + 0, 0, 255, 255, Qt::Key_X, Qt::Key_Y); m_classic_left_stick_box = CreateStickInputs(tr("Left Stick"), WiimoteEmu::Classic::LEFT_STICK_GROUP, - &m_classic_overrider, m_classic_left_stick_x_value, - m_classic_left_stick_y_value, 0, 0, 63, 63, Qt::Key_F, Qt::Key_G); + &m_classic_overrider, 0, 0, 63, 63, Qt::Key_F, Qt::Key_G); m_classic_right_stick_box = CreateStickInputs(tr("Right Stick"), WiimoteEmu::Classic::RIGHT_STICK_GROUP, - &m_classic_overrider, m_classic_right_stick_x_value, - m_classic_right_stick_y_value, 0, 0, 31, 31, Qt::Key_Q, Qt::Key_W); + &m_classic_overrider, 0, 0, 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. @@ -120,23 +118,20 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow( // i18n: Refers to a 3D axis (used when mapping motion controls) CreateSliderValuePairLayout(tr("X"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP, ControllerEmu::ReshapableInput::X_INPUT_OVERRIDE, - &m_wiimote_overrider, m_remote_orientation_x_value, ACCEL_ZERO_G, - ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_Q, - m_remote_orientation_box, ACCEL_SCALE); + &m_wiimote_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN, + ACCEL_MAX, Qt::Key_Q, m_remote_orientation_box, ACCEL_SCALE); auto* remote_orientation_y_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) CreateSliderValuePairLayout(tr("Y"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP, ControllerEmu::ReshapableInput::Y_INPUT_OVERRIDE, - &m_wiimote_overrider, m_remote_orientation_y_value, ACCEL_ZERO_G, - ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_W, - m_remote_orientation_box, ACCEL_SCALE); + &m_wiimote_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN, + ACCEL_MAX, Qt::Key_W, m_remote_orientation_box, ACCEL_SCALE); auto* remote_orientation_z_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) CreateSliderValuePairLayout(tr("Z"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP, ControllerEmu::ReshapableInput::Z_INPUT_OVERRIDE, - &m_wiimote_overrider, m_remote_orientation_z_value, ACCEL_ZERO_G, - ACCEL_ONE_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_E, - m_remote_orientation_box, ACCEL_SCALE); + &m_wiimote_overrider, ACCEL_ZERO_G, ACCEL_ONE_G, ACCEL_MIN, + ACCEL_MAX, Qt::Key_E, m_remote_orientation_box, ACCEL_SCALE); auto* remote_orientation_layout = new QVBoxLayout; remote_orientation_layout->addLayout(remote_orientation_x_layout); @@ -150,23 +145,20 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow( // i18n: Refers to a 3D axis (used when mapping motion controls) CreateSliderValuePairLayout(tr("X"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP, ControllerEmu::ReshapableInput::X_INPUT_OVERRIDE, - &m_nunchuk_overrider, m_nunchuk_orientation_x_value, ACCEL_ZERO_G, - ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_I, - m_nunchuk_orientation_box); + &m_nunchuk_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN, + ACCEL_MAX, Qt::Key_I, m_nunchuk_orientation_box); auto* nunchuk_orientation_y_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) CreateSliderValuePairLayout(tr("Y"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP, ControllerEmu::ReshapableInput::Y_INPUT_OVERRIDE, - &m_nunchuk_overrider, m_nunchuk_orientation_y_value, ACCEL_ZERO_G, - ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_O, - m_nunchuk_orientation_box); + &m_nunchuk_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN, + ACCEL_MAX, Qt::Key_O, m_nunchuk_orientation_box); auto* nunchuk_orientation_z_layout = // i18n: Refers to a 3D axis (used when mapping motion controls) CreateSliderValuePairLayout(tr("Z"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP, ControllerEmu::ReshapableInput::Z_INPUT_OVERRIDE, - &m_nunchuk_overrider, m_nunchuk_orientation_z_value, ACCEL_ZERO_G, - ACCEL_ONE_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_P, - m_nunchuk_orientation_box); + &m_nunchuk_overrider, ACCEL_ZERO_G, ACCEL_ONE_G, ACCEL_MIN, + ACCEL_MAX, Qt::Key_P, m_nunchuk_orientation_box); auto* nunchuk_orientation_layout = new QVBoxLayout; nunchuk_orientation_layout->addLayout(nunchuk_orientation_x_layout); @@ -177,10 +169,10 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow( m_triggers_box = new QGroupBox(tr("Triggers")); auto* l_trigger_layout = CreateSliderValuePairLayout( tr("Left"), WiimoteEmu::Classic::TRIGGERS_GROUP, WiimoteEmu::Classic::L_ANALOG, - &m_classic_overrider, m_left_trigger_value, 0, 0, 0, 31, Qt::Key_N, m_triggers_box); + &m_classic_overrider, 0, 0, 0, 31, Qt::Key_N, m_triggers_box); auto* r_trigger_layout = CreateSliderValuePairLayout( tr("Right"), WiimoteEmu::Classic::TRIGGERS_GROUP, WiimoteEmu::Classic::R_ANALOG, - &m_classic_overrider, m_right_trigger_value, 0, 0, 0, 31, Qt::Key_M, m_triggers_box); + &m_classic_overrider, 0, 0, 0, 31, Qt::Key_M, m_triggers_box); auto* triggers_layout = new QVBoxLayout; triggers_layout->addLayout(l_trigger_layout); diff --git a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.h b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.h index a521301a60..ef01906741 100644 --- a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.h +++ b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.h @@ -75,22 +75,8 @@ private: TASCheckBox* m_classic_up_button; TASCheckBox* m_classic_down_button; TASCheckBox* m_classic_right_button; - QSpinBox* m_remote_orientation_x_value; - QSpinBox* m_remote_orientation_y_value; - QSpinBox* m_remote_orientation_z_value; - QSpinBox* m_nunchuk_orientation_x_value; - QSpinBox* m_nunchuk_orientation_y_value; - QSpinBox* m_nunchuk_orientation_z_value; QSpinBox* m_ir_x_value; QSpinBox* m_ir_y_value; - QSpinBox* m_nunchuk_stick_x_value; - QSpinBox* m_nunchuk_stick_y_value; - QSpinBox* m_classic_left_stick_x_value; - QSpinBox* m_classic_left_stick_y_value; - QSpinBox* m_classic_right_stick_x_value; - QSpinBox* m_classic_right_stick_y_value; - QSpinBox* m_left_trigger_value; - QSpinBox* m_right_trigger_value; QGroupBox* m_remote_orientation_box; QGroupBox* m_nunchuk_orientation_box; QGroupBox* m_ir_box;