diff options
author | Lioncash <mathew1800@gmail.com> | 2019-05-19 18:24:13 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-05-19 18:34:18 +0200 |
commit | c9c4208c4a0196780446f1773ffcb87895b41d8f (patch) | |
tree | f26e96cea9e00060dbf718a0b57998c98b28205d | |
parent | yuzu/configuration/configure_input_player: Clean up array accesses (diff) | |
download | yuzu-c9c4208c4a0196780446f1773ffcb87895b41d8f.tar yuzu-c9c4208c4a0196780446f1773ffcb87895b41d8f.tar.gz yuzu-c9c4208c4a0196780446f1773ffcb87895b41d8f.tar.bz2 yuzu-c9c4208c4a0196780446f1773ffcb87895b41d8f.tar.lz yuzu-c9c4208c4a0196780446f1773ffcb87895b41d8f.tar.xz yuzu-c9c4208c4a0196780446f1773ffcb87895b41d8f.tar.zst yuzu-c9c4208c4a0196780446f1773ffcb87895b41d8f.zip |
-rw-r--r-- | src/yuzu/configuration/configure_mouse_advanced.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/yuzu/configuration/configure_mouse_advanced.cpp b/src/yuzu/configuration/configure_mouse_advanced.cpp index ef857035e..ba5992f9f 100644 --- a/src/yuzu/configuration/configure_mouse_advanced.cpp +++ b/src/yuzu/configuration/configure_mouse_advanced.cpp @@ -25,7 +25,7 @@ static QString GetKeyName(int key_code) { case Qt::Key_Alt: return QObject::tr("Alt"); case Qt::Key_Meta: - return ""; + return {}; default: return QKeySequence(key_code).toString(); } @@ -34,24 +34,36 @@ static QString GetKeyName(int key_code) { static QString ButtonToText(const Common::ParamPackage& param) { if (!param.Has("engine")) { return QObject::tr("[not set]"); - } else if (param.Get("engine", "") == "keyboard") { + } + + if (param.Get("engine", "") == "keyboard") { return GetKeyName(param.Get("code", 0)); - } else if (param.Get("engine", "") == "sdl") { + } + + if (param.Get("engine", "") == "sdl") { if (param.Has("hat")) { - return QString(QObject::tr("Hat %1 %2")) - .arg(param.Get("hat", "").c_str(), param.Get("direction", "").c_str()); + const QString hat_str = QString::fromStdString(param.Get("hat", "")); + const QString direction_str = QString::fromStdString(param.Get("direction", "")); + + return QObject::tr("Hat %1 %2").arg(hat_str, direction_str); } + if (param.Has("axis")) { - return QString(QObject::tr("Axis %1%2")) - .arg(param.Get("axis", "").c_str(), param.Get("direction", "").c_str()); + const QString axis_str = QString::fromStdString(param.Get("axis", "")); + const QString direction_str = QString::fromStdString(param.Get("direction", "")); + + return QObject::tr("Axis %1%2").arg(axis_str, direction_str); } + if (param.Has("button")) { - return QString(QObject::tr("Button %1")).arg(param.Get("button", "").c_str()); + const QString button_str = QString::fromStdString(param.Get("button", "")); + + return QObject::tr("Button %1").arg(button_str); } - return QString(); - } else { - return QObject::tr("[unknown]"); + return {}; } + + return QObject::tr("[unknown]"); } ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent) |