DolphinQt: Remove unneeded out parameters in TASInputWindow

IIRC we needed this before the input override system was added.
This commit is contained in:
JosJuice 2023-03-07 19:30:21 +01:00
parent 3eac1fc284
commit 11e4d46927
6 changed files with 38 additions and 70 deletions

View file

@ -26,12 +26,10 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int controller_id)
{ {
setWindowTitle(tr("GameCube TAS Input %1").arg(controller_id + 1)); 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_main_stick_box = CreateStickInputs(tr("Main Stick"), GCPad::MAIN_STICK_GROUP, &m_overrider, 1,
m_x_main_stick_value, m_y_main_stick_value, 1, 1, 255, 255, 1, 255, 255, Qt::Key_F, Qt::Key_G);
Qt::Key_F, Qt::Key_G); m_c_stick_box = CreateStickInputs(tr("C Stick"), GCPad::C_STICK_GROUP, &m_overrider, 1, 1, 255,
m_c_stick_box = 255, Qt::Key_H, Qt::Key_J);
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);
auto* top_layout = new QHBoxLayout; auto* top_layout = new QHBoxLayout;
top_layout->addWidget(m_main_stick_box); top_layout->addWidget(m_main_stick_box);
@ -41,11 +39,11 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int controller_id)
auto* l_trigger_layout = auto* l_trigger_layout =
CreateSliderValuePairLayout(tr("Left"), GCPad::TRIGGERS_GROUP, GCPad::L_ANALOG, &m_overrider, 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 = auto* r_trigger_layout =
CreateSliderValuePairLayout(tr("Right"), GCPad::TRIGGERS_GROUP, GCPad::R_ANALOG, &m_overrider, 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; auto* triggers_layout = new QVBoxLayout;
triggers_layout->addLayout(l_trigger_layout); triggers_layout->addLayout(l_trigger_layout);

View file

@ -37,12 +37,6 @@ private:
TASCheckBox* m_up_button; TASCheckBox* m_up_button;
TASCheckBox* m_down_button; TASCheckBox* m_down_button;
TASCheckBox* m_right_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_main_stick_box;
QGroupBox* m_c_stick_box; QGroupBox* m_c_stick_box;
QGroupBox* m_triggers_box; QGroupBox* m_triggers_box;

View file

@ -93,9 +93,8 @@ TASCheckBox* TASInputWindow::CreateButton(const QString& text, std::string_view
} }
QGroupBox* TASInputWindow::CreateStickInputs(const QString& text, std::string_view group_name, QGroupBox* TASInputWindow::CreateStickInputs(const QString& text, std::string_view group_name,
InputOverrider* overrider, QSpinBox*& x_value, InputOverrider* overrider, u16 min_x, u16 min_y,
QSpinBox*& y_value, u16 min_x, u16 min_y, u16 max_x, u16 max_x, u16 max_y, Qt::Key x_shortcut_key,
u16 max_y, Qt::Key x_shortcut_key,
Qt::Key y_shortcut_key) Qt::Key y_shortcut_key)
{ {
const QKeySequence x_shortcut_key_sequence = QKeySequence(Qt::ALT | x_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<int>(std::round(max_y / 2.)); const int y_default = static_cast<int>(std::round(max_y / 2.));
auto* x_layout = new QHBoxLayout; auto* x_layout = new QHBoxLayout;
x_value = CreateSliderValuePair(x_layout, x_default, max_x, x_shortcut_key_sequence, QSpinBox* x_value = CreateSliderValuePair(x_layout, x_default, max_x, x_shortcut_key_sequence,
Qt::Horizontal, box); Qt::Horizontal, box);
auto* y_layout = new QVBoxLayout; auto* y_layout = new QVBoxLayout;
y_value = QSpinBox* y_value =
CreateSliderValuePair(y_layout, y_default, max_y, y_shortcut_key_sequence, Qt::Vertical, box); CreateSliderValuePair(y_layout, y_default, max_y, y_shortcut_key_sequence, Qt::Vertical, box);
y_value->setMaximumWidth(60); y_value->setMaximumWidth(60);
@ -153,8 +152,8 @@ QGroupBox* TASInputWindow::CreateStickInputs(const QString& text, std::string_vi
QBoxLayout* TASInputWindow::CreateSliderValuePairLayout( QBoxLayout* TASInputWindow::CreateSliderValuePairLayout(
const QString& text, std::string_view group_name, std::string_view control_name, 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, InputOverrider* overrider, u16 zero, int default_, u16 min, u16 max, Qt::Key shortcut_key,
Qt::Key shortcut_key, QWidget* shortcut_widget, std::optional<ControlState> scale) QWidget* shortcut_widget, std::optional<ControlState> scale)
{ {
const QKeySequence shortcut_key_sequence = QKeySequence(Qt::ALT | shortcut_key); const QKeySequence shortcut_key_sequence = QKeySequence(Qt::ALT | shortcut_key);
@ -164,8 +163,8 @@ QBoxLayout* TASInputWindow::CreateSliderValuePairLayout(
QBoxLayout* layout = new QHBoxLayout; QBoxLayout* layout = new QHBoxLayout;
layout->addWidget(label); layout->addWidget(label);
value = CreateSliderValuePair(group_name, control_name, overrider, layout, zero, default_, min, CreateSliderValuePair(group_name, control_name, overrider, layout, zero, default_, min, max,
max, shortcut_key_sequence, Qt::Horizontal, shortcut_widget, scale); shortcut_key_sequence, Qt::Horizontal, shortcut_widget, scale);
return layout; return layout;
} }

View file

@ -50,13 +50,12 @@ protected:
TASCheckBox* CreateButton(const QString& text, std::string_view group_name, TASCheckBox* CreateButton(const QString& text, std::string_view group_name,
std::string_view control_name, InputOverrider* overrider); std::string_view control_name, InputOverrider* overrider);
QGroupBox* CreateStickInputs(const QString& text, std::string_view group_name, QGroupBox* CreateStickInputs(const QString& text, std::string_view group_name,
InputOverrider* overrider, QSpinBox*& x_value, QSpinBox*& y_value, InputOverrider* overrider, u16 min_x, u16 min_y, u16 max_x,
u16 min_x, u16 min_y, u16 max_x, u16 max_y, Qt::Key x_shortcut_key, u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key);
Qt::Key y_shortcut_key);
QBoxLayout* CreateSliderValuePairLayout(const QString& text, std::string_view group_name, QBoxLayout* CreateSliderValuePairLayout(const QString& text, std::string_view group_name,
std::string_view control_name, InputOverrider* overrider, std::string_view control_name, InputOverrider* overrider,
QSpinBox*& value, u16 zero, int default_, u16 min, u16 zero, int default_, u16 min, u16 max,
u16 max, Qt::Key shortcut_key, QWidget* shortcut_widget, Qt::Key shortcut_key, QWidget* shortcut_widget,
std::optional<ControlState> scale = {}); std::optional<ControlState> scale = {});
QSpinBox* CreateSliderValuePair(std::string_view group_name, std::string_view control_name, QSpinBox* CreateSliderValuePair(std::string_view group_name, std::string_view control_name,
InputOverrider* overrider, QBoxLayout* layout, u16 zero, InputOverrider* overrider, QBoxLayout* layout, u16 zero,

View file

@ -83,19 +83,17 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(
ir_layout->addLayout(visual_layout); ir_layout->addLayout(visual_layout);
m_ir_box->setLayout(ir_layout); m_ir_box->setLayout(ir_layout);
m_nunchuk_stick_box = CreateStickInputs( m_nunchuk_stick_box =
tr("Nunchuk Stick"), WiimoteEmu::Nunchuk::STICK_GROUP, &m_nunchuk_overrider, 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); 0, 0, 255, 255, Qt::Key_X, Qt::Key_Y);
m_classic_left_stick_box = m_classic_left_stick_box =
CreateStickInputs(tr("Left Stick"), WiimoteEmu::Classic::LEFT_STICK_GROUP, CreateStickInputs(tr("Left Stick"), WiimoteEmu::Classic::LEFT_STICK_GROUP,
&m_classic_overrider, m_classic_left_stick_x_value, &m_classic_overrider, 0, 0, 63, 63, Qt::Key_F, Qt::Key_G);
m_classic_left_stick_y_value, 0, 0, 63, 63, Qt::Key_F, Qt::Key_G);
m_classic_right_stick_box = m_classic_right_stick_box =
CreateStickInputs(tr("Right Stick"), WiimoteEmu::Classic::RIGHT_STICK_GROUP, CreateStickInputs(tr("Right Stick"), WiimoteEmu::Classic::RIGHT_STICK_GROUP,
&m_classic_overrider, m_classic_right_stick_x_value, &m_classic_overrider, 0, 0, 31, 31, Qt::Key_Q, Qt::Key_W);
m_classic_right_stick_y_value, 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 // 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. // 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) // i18n: Refers to a 3D axis (used when mapping motion controls)
CreateSliderValuePairLayout(tr("X"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP, CreateSliderValuePairLayout(tr("X"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP,
ControllerEmu::ReshapableInput::X_INPUT_OVERRIDE, ControllerEmu::ReshapableInput::X_INPUT_OVERRIDE,
&m_wiimote_overrider, m_remote_orientation_x_value, ACCEL_ZERO_G, &m_wiimote_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN,
ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_Q, ACCEL_MAX, Qt::Key_Q, m_remote_orientation_box, ACCEL_SCALE);
m_remote_orientation_box, ACCEL_SCALE);
auto* remote_orientation_y_layout = auto* remote_orientation_y_layout =
// i18n: Refers to a 3D axis (used when mapping motion controls) // i18n: Refers to a 3D axis (used when mapping motion controls)
CreateSliderValuePairLayout(tr("Y"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP, CreateSliderValuePairLayout(tr("Y"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP,
ControllerEmu::ReshapableInput::Y_INPUT_OVERRIDE, ControllerEmu::ReshapableInput::Y_INPUT_OVERRIDE,
&m_wiimote_overrider, m_remote_orientation_y_value, ACCEL_ZERO_G, &m_wiimote_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN,
ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_W, ACCEL_MAX, Qt::Key_W, m_remote_orientation_box, ACCEL_SCALE);
m_remote_orientation_box, ACCEL_SCALE);
auto* remote_orientation_z_layout = auto* remote_orientation_z_layout =
// i18n: Refers to a 3D axis (used when mapping motion controls) // i18n: Refers to a 3D axis (used when mapping motion controls)
CreateSliderValuePairLayout(tr("Z"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP, CreateSliderValuePairLayout(tr("Z"), WiimoteEmu::Wiimote::ACCELEROMETER_GROUP,
ControllerEmu::ReshapableInput::Z_INPUT_OVERRIDE, ControllerEmu::ReshapableInput::Z_INPUT_OVERRIDE,
&m_wiimote_overrider, m_remote_orientation_z_value, ACCEL_ZERO_G, &m_wiimote_overrider, ACCEL_ZERO_G, ACCEL_ONE_G, ACCEL_MIN,
ACCEL_ONE_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_E, ACCEL_MAX, Qt::Key_E, m_remote_orientation_box, ACCEL_SCALE);
m_remote_orientation_box, ACCEL_SCALE);
auto* remote_orientation_layout = new QVBoxLayout; auto* remote_orientation_layout = new QVBoxLayout;
remote_orientation_layout->addLayout(remote_orientation_x_layout); 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) // i18n: Refers to a 3D axis (used when mapping motion controls)
CreateSliderValuePairLayout(tr("X"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP, CreateSliderValuePairLayout(tr("X"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP,
ControllerEmu::ReshapableInput::X_INPUT_OVERRIDE, ControllerEmu::ReshapableInput::X_INPUT_OVERRIDE,
&m_nunchuk_overrider, m_nunchuk_orientation_x_value, ACCEL_ZERO_G, &m_nunchuk_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN,
ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_I, ACCEL_MAX, Qt::Key_I, m_nunchuk_orientation_box);
m_nunchuk_orientation_box);
auto* nunchuk_orientation_y_layout = auto* nunchuk_orientation_y_layout =
// i18n: Refers to a 3D axis (used when mapping motion controls) // i18n: Refers to a 3D axis (used when mapping motion controls)
CreateSliderValuePairLayout(tr("Y"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP, CreateSliderValuePairLayout(tr("Y"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP,
ControllerEmu::ReshapableInput::Y_INPUT_OVERRIDE, ControllerEmu::ReshapableInput::Y_INPUT_OVERRIDE,
&m_nunchuk_overrider, m_nunchuk_orientation_y_value, ACCEL_ZERO_G, &m_nunchuk_overrider, ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_MIN,
ACCEL_ZERO_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_O, ACCEL_MAX, Qt::Key_O, m_nunchuk_orientation_box);
m_nunchuk_orientation_box);
auto* nunchuk_orientation_z_layout = auto* nunchuk_orientation_z_layout =
// i18n: Refers to a 3D axis (used when mapping motion controls) // i18n: Refers to a 3D axis (used when mapping motion controls)
CreateSliderValuePairLayout(tr("Z"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP, CreateSliderValuePairLayout(tr("Z"), WiimoteEmu::Nunchuk::ACCELEROMETER_GROUP,
ControllerEmu::ReshapableInput::Z_INPUT_OVERRIDE, ControllerEmu::ReshapableInput::Z_INPUT_OVERRIDE,
&m_nunchuk_overrider, m_nunchuk_orientation_z_value, ACCEL_ZERO_G, &m_nunchuk_overrider, ACCEL_ZERO_G, ACCEL_ONE_G, ACCEL_MIN,
ACCEL_ONE_G, ACCEL_MIN, ACCEL_MAX, Qt::Key_P, ACCEL_MAX, Qt::Key_P, m_nunchuk_orientation_box);
m_nunchuk_orientation_box);
auto* nunchuk_orientation_layout = new QVBoxLayout; auto* nunchuk_orientation_layout = new QVBoxLayout;
nunchuk_orientation_layout->addLayout(nunchuk_orientation_x_layout); 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")); m_triggers_box = new QGroupBox(tr("Triggers"));
auto* l_trigger_layout = CreateSliderValuePairLayout( auto* l_trigger_layout = CreateSliderValuePairLayout(
tr("Left"), WiimoteEmu::Classic::TRIGGERS_GROUP, WiimoteEmu::Classic::L_ANALOG, 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( auto* r_trigger_layout = CreateSliderValuePairLayout(
tr("Right"), WiimoteEmu::Classic::TRIGGERS_GROUP, WiimoteEmu::Classic::R_ANALOG, 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; auto* triggers_layout = new QVBoxLayout;
triggers_layout->addLayout(l_trigger_layout); triggers_layout->addLayout(l_trigger_layout);

View file

@ -75,22 +75,8 @@ private:
TASCheckBox* m_classic_up_button; TASCheckBox* m_classic_up_button;
TASCheckBox* m_classic_down_button; TASCheckBox* m_classic_down_button;
TASCheckBox* m_classic_right_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_x_value;
QSpinBox* m_ir_y_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_remote_orientation_box;
QGroupBox* m_nunchuk_orientation_box; QGroupBox* m_nunchuk_orientation_box;
QGroupBox* m_ir_box; QGroupBox* m_ir_box;