|
|
|
@ -261,11 +261,10 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i |
|
|
|
} |
|
|
|
|
|
|
|
button->setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
connect(button, &QPushButton::clicked, [=] |
|
|
|
{ |
|
|
|
HandleClick(button_map[button_id], |
|
|
|
[=](Common::ParamPackage params) |
|
|
|
{ |
|
|
|
connect(button, &QPushButton::clicked, [=] { |
|
|
|
HandleClick( |
|
|
|
button_map[button_id], |
|
|
|
[=](Common::ParamPackage params) { |
|
|
|
// Workaround for ZL & ZR for analog triggers like on XBOX controllors.
|
|
|
|
// Analog triggers (from controllers like the XBOX controller) would not
|
|
|
|
// work due to a different range of their signals (from 0 to 255 on
|
|
|
|
@ -283,16 +282,13 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i |
|
|
|
}, |
|
|
|
InputCommon::Polling::DeviceType::Button); |
|
|
|
}); |
|
|
|
connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) |
|
|
|
{ |
|
|
|
connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) { |
|
|
|
QMenu context_menu; |
|
|
|
context_menu.addAction(tr("Clear"), [&] |
|
|
|
{ |
|
|
|
context_menu.addAction(tr("Clear"), [&] { |
|
|
|
buttons_param[button_id].Clear(); |
|
|
|
button_map[button_id]->setText(tr("[not set]")); |
|
|
|
}); |
|
|
|
context_menu.addAction(tr("Restore Default"), [&] |
|
|
|
{ |
|
|
|
context_menu.addAction(tr("Restore Default"), [&] { |
|
|
|
buttons_param[button_id] = Common::ParamPackage{ |
|
|
|
InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])}; |
|
|
|
button_map[button_id]->setText(ButtonToText(buttons_param[button_id])); |
|
|
|
@ -309,27 +305,23 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i |
|
|
|
} |
|
|
|
|
|
|
|
analog_button->setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
connect(analog_button, &QPushButton::clicked, [=]() |
|
|
|
{ |
|
|
|
HandleClick(analog_map_buttons[analog_id][sub_button_id], |
|
|
|
[=](const Common::ParamPackage& params) |
|
|
|
{ |
|
|
|
connect(analog_button, &QPushButton::clicked, [=]() { |
|
|
|
HandleClick( |
|
|
|
analog_map_buttons[analog_id][sub_button_id], |
|
|
|
[=](const Common::ParamPackage& params) { |
|
|
|
SetAnalogButton(params, analogs_param[analog_id], |
|
|
|
analog_sub_buttons[sub_button_id]); |
|
|
|
}, |
|
|
|
InputCommon::Polling::DeviceType::Button); |
|
|
|
}); |
|
|
|
connect(analog_button, &QPushButton::customContextMenuRequested, |
|
|
|
[=](const QPoint& menu_location) |
|
|
|
{ |
|
|
|
[=](const QPoint& menu_location) { |
|
|
|
QMenu context_menu; |
|
|
|
context_menu.addAction(tr("Clear"), [&] |
|
|
|
{ |
|
|
|
context_menu.addAction(tr("Clear"), [&] { |
|
|
|
analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]); |
|
|
|
analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]")); |
|
|
|
}); |
|
|
|
context_menu.addAction(tr("Restore Default"), [&] |
|
|
|
{ |
|
|
|
context_menu.addAction(tr("Restore Default"), [&] { |
|
|
|
Common::ParamPackage params{InputCommon::GenerateKeyboardParam( |
|
|
|
Config::default_analogs[analog_id][sub_button_id])}; |
|
|
|
SetAnalogButton(params, analogs_param[analog_id], |
|
|
|
@ -341,8 +333,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i |
|
|
|
menu_location)); |
|
|
|
}); |
|
|
|
} |
|
|
|
connect(analog_map_stick[analog_id], &QPushButton::clicked, [=] |
|
|
|
{ |
|
|
|
connect(analog_map_stick[analog_id], &QPushButton::clicked, [=] { |
|
|
|
if (QMessageBox::information( |
|
|
|
this, tr("Information"), |
|
|
|
tr("After pressing OK, first move your joystick horizontally, " |
|
|
|
@ -355,8 +346,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
connect(analog_map_deadzone_and_modifier_slider[analog_id], &QSlider::valueChanged, [=] |
|
|
|
{ |
|
|
|
connect(analog_map_deadzone_and_modifier_slider[analog_id], &QSlider::valueChanged, [=] { |
|
|
|
const float slider_value = analog_map_deadzone_and_modifier_slider[analog_id]->value(); |
|
|
|
if (analogs_param[analog_id].Get("engine", "") == "sdl" || |
|
|
|
analogs_param[analog_id].Get("engine", "") == "gcpad") { |
|
|
|
@ -377,8 +367,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i |
|
|
|
timeout_timer->setSingleShot(true); |
|
|
|
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); }); |
|
|
|
|
|
|
|
connect(poll_timer.get(), &QTimer::timeout, [this] |
|
|
|
{ |
|
|
|
connect(poll_timer.get(), &QTimer::timeout, [this] { |
|
|
|
Common::ParamPackage params; |
|
|
|
if (InputCommon::GetGCButtons()->IsPolling()) { |
|
|
|
params = InputCommon::GetGCButtons()->GetNextInput(); |
|
|
|
@ -625,10 +614,11 @@ void ConfigureInputPlayer::HandleClick( |
|
|
|
|
|
|
|
grabKeyboard(); |
|
|
|
grabMouse(); |
|
|
|
if (type == InputCommon::Polling::DeviceType::Button) |
|
|
|
if (type == InputCommon::Polling::DeviceType::Button) { |
|
|
|
InputCommon::GetGCButtons()->BeginConfiguration(); |
|
|
|
else |
|
|
|
} else { |
|
|
|
InputCommon::GetGCAnalogs()->BeginConfiguration(); |
|
|
|
} |
|
|
|
timeout_timer->start(5000); // Cancel after 5 seconds
|
|
|
|
poll_timer->start(200); // Check for new inputs every 200ms
|
|
|
|
} |
|
|
|
|