input_common: Improve SDL joystick and hide toggle option

This commit is contained in:
german77
2021-07-22 19:59:26 -05:00
parent bd0e1d3a25
commit 48b6d41f1b
4 changed files with 76 additions and 33 deletions

View File

@ -309,11 +309,14 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
buttons_param[button_id].Clear();
button_map[button_id]->setText(tr("[not set]"));
});
context_menu.addAction(tr("Toggle button"), [&] {
const bool toggle_value = !buttons_param[button_id].Get("toggle", false);
buttons_param[button_id].Set("toggle", toggle_value);
button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
});
if (buttons_param[button_id].Has("toggle")) {
context_menu.addAction(tr("Toggle button"), [&] {
const bool toggle_value =
!buttons_param[button_id].Get("toggle", false);
buttons_param[button_id].Set("toggle", toggle_value);
button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
});
}
if (buttons_param[button_id].Has("threshold")) {
context_menu.addAction(tr("Set threshold"), [&] {
const int button_threshold = static_cast<int>(