mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-22 16:30:57 +01:00
Merge pull request #8224 from Docteh/hihi1
ui: translate hat directions
This commit is contained in:
commit
cc866ab7e4
1 changed files with 19 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include "common/assert.h"
|
||||
#include "common/param_package.h"
|
||||
#include "core/hid/emulated_controller.h"
|
||||
#include "core/hid/hid_core.h"
|
||||
|
@ -119,6 +120,23 @@ QString GetButtonName(Common::Input::ButtonNames button_name) {
|
|||
}
|
||||
}
|
||||
|
||||
QString GetDirectionName(const std::string& direction) {
|
||||
if (direction == "left") {
|
||||
return QObject::tr("Left");
|
||||
}
|
||||
if (direction == "right") {
|
||||
return QObject::tr("Right");
|
||||
}
|
||||
if (direction == "up") {
|
||||
return QObject::tr("Up");
|
||||
}
|
||||
if (direction == "down") {
|
||||
return QObject::tr("Down");
|
||||
}
|
||||
UNIMPLEMENTED_MSG("Unimplemented direction name={}", direction);
|
||||
return QString::fromStdString(direction);
|
||||
}
|
||||
|
||||
void SetAnalogParam(const Common::ParamPackage& input_param, Common::ParamPackage& analog_param,
|
||||
const std::string& button_name) {
|
||||
// The poller returned a complete axis, so set all the buttons
|
||||
|
@ -162,7 +180,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
|
|||
|
||||
if (common_button_name == Common::Input::ButtonNames::Value) {
|
||||
if (param.Has("hat")) {
|
||||
const QString hat = QString::fromStdString(param.Get("direction", ""));
|
||||
const QString hat = GetDirectionName(param.Get("direction", ""));
|
||||
return QObject::tr("%1%2Hat %3").arg(toggle, inverted, hat);
|
||||
}
|
||||
if (param.Has("axis")) {
|
||||
|
|
Loading…
Reference in a new issue