mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
yuzu: input: fix invert symbol on axis and order options alphabetically
This commit is contained in:
parent
2898be69f4
commit
de8f7e1250
@ -161,6 +161,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
|
|||||||
|
|
||||||
const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : "");
|
const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : "");
|
||||||
const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : "");
|
const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : "");
|
||||||
|
const QString invert = QString::fromStdString(param.Get("invert", "+") == "-" ? "-" : "");
|
||||||
const auto common_button_name = input_subsystem->GetButtonName(param);
|
const auto common_button_name = input_subsystem->GetButtonName(param);
|
||||||
|
|
||||||
// Retrieve the names from Qt
|
// Retrieve the names from Qt
|
||||||
@ -184,7 +185,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
|
|||||||
}
|
}
|
||||||
if (param.Has("axis")) {
|
if (param.Has("axis")) {
|
||||||
const QString axis = QString::fromStdString(param.Get("axis", ""));
|
const QString axis = QString::fromStdString(param.Get("axis", ""));
|
||||||
return QObject::tr("%1%2Axis %3").arg(toggle, inverted, axis);
|
return QObject::tr("%1%2Axis %3").arg(toggle, invert, axis);
|
||||||
}
|
}
|
||||||
if (param.Has("axis_x") && param.Has("axis_y") && param.Has("axis_z")) {
|
if (param.Has("axis_x") && param.Has("axis_y") && param.Has("axis_z")) {
|
||||||
const QString axis_x = QString::fromStdString(param.Get("axis_x", ""));
|
const QString axis_x = QString::fromStdString(param.Get("axis_x", ""));
|
||||||
@ -362,18 +363,18 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
button_map[button_id]->setText(tr("[not set]"));
|
button_map[button_id]->setText(tr("[not set]"));
|
||||||
});
|
});
|
||||||
if (param.Has("code") || param.Has("button") || param.Has("hat")) {
|
if (param.Has("code") || param.Has("button") || param.Has("hat")) {
|
||||||
context_menu.addAction(tr("Toggle button"), [&] {
|
|
||||||
const bool toggle_value = !param.Get("toggle", false);
|
|
||||||
param.Set("toggle", toggle_value);
|
|
||||||
button_map[button_id]->setText(ButtonToText(param));
|
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
|
||||||
});
|
|
||||||
context_menu.addAction(tr("Invert button"), [&] {
|
context_menu.addAction(tr("Invert button"), [&] {
|
||||||
const bool invert_value = !param.Get("inverted", false);
|
const bool invert_value = !param.Get("inverted", false);
|
||||||
param.Set("inverted", invert_value);
|
param.Set("inverted", invert_value);
|
||||||
button_map[button_id]->setText(ButtonToText(param));
|
button_map[button_id]->setText(ButtonToText(param));
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
});
|
});
|
||||||
|
context_menu.addAction(tr("Toggle button"), [&] {
|
||||||
|
const bool toggle_value = !param.Get("toggle", false);
|
||||||
|
param.Set("toggle", toggle_value);
|
||||||
|
button_map[button_id]->setText(ButtonToText(param));
|
||||||
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (param.Has("axis")) {
|
if (param.Has("axis")) {
|
||||||
context_menu.addAction(tr("Invert axis"), [&] {
|
context_menu.addAction(tr("Invert axis"), [&] {
|
||||||
@ -382,12 +383,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
button_map[button_id]->setText(ButtonToText(param));
|
button_map[button_id]->setText(ButtonToText(param));
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
});
|
});
|
||||||
context_menu.addAction(tr("Toggle axis"), [&] {
|
|
||||||
const bool toggle_value = !param.Get("toggle", false);
|
|
||||||
param.Set("toggle", toggle_value);
|
|
||||||
button_map[button_id]->setText(ButtonToText(param));
|
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
|
||||||
});
|
|
||||||
context_menu.addAction(tr("Set threshold"), [&] {
|
context_menu.addAction(tr("Set threshold"), [&] {
|
||||||
const int button_threshold =
|
const int button_threshold =
|
||||||
static_cast<int>(param.Get("threshold", 0.5f) * 100.0f);
|
static_cast<int>(param.Get("threshold", 0.5f) * 100.0f);
|
||||||
@ -404,6 +399,12 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
}
|
}
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
});
|
});
|
||||||
|
context_menu.addAction(tr("Toggle axis"), [&] {
|
||||||
|
const bool toggle_value = !param.Get("toggle", false);
|
||||||
|
param.Set("toggle", toggle_value);
|
||||||
|
button_map[button_id]->setText(ButtonToText(param));
|
||||||
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user