mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-27 06:40:05 +00:00
Merge pull request #1947 from lioncash/init
configure_input_simple: Make input profile array constexpr
This commit is contained in:
commit
c9269a4a4b
@ -3,12 +3,8 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstring>
|
|
||||||
#include <functional>
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
#include "ui_configure_input_simple.h"
|
#include "ui_configure_input_simple.h"
|
||||||
#include "yuzu/configuration/configure_input.h"
|
#include "yuzu/configuration/configure_input.h"
|
||||||
#include "yuzu/configuration/configure_input_player.h"
|
#include "yuzu/configuration/configure_input_player.h"
|
||||||
@ -73,20 +69,18 @@ void DualJoyconsDockedOnProfileSelect() {
|
|||||||
|
|
||||||
// Name, OnProfileSelect (called when selected in drop down), OnConfigure (called when configure
|
// Name, OnProfileSelect (called when selected in drop down), OnConfigure (called when configure
|
||||||
// is clicked)
|
// is clicked)
|
||||||
using InputProfile =
|
using InputProfile = std::tuple<const char*, void (*)(), void (*)(ConfigureInputSimple*)>;
|
||||||
std::tuple<QString, std::function<void()>, std::function<void(ConfigureInputSimple*)>>;
|
|
||||||
|
|
||||||
const std::array<InputProfile, 3> INPUT_PROFILES{{
|
constexpr std::array<InputProfile, 3> INPUT_PROFILES{{
|
||||||
{ConfigureInputSimple::tr("Single Player - Handheld - Undocked"), HandheldOnProfileSelect,
|
{QT_TR_NOOP("Single Player - Handheld - Undocked"), HandheldOnProfileSelect,
|
||||||
[](ConfigureInputSimple* caller) {
|
[](ConfigureInputSimple* caller) {
|
||||||
CallConfigureDialog<ConfigureInputPlayer>(caller, HANDHELD_INDEX, false);
|
CallConfigureDialog<ConfigureInputPlayer>(caller, HANDHELD_INDEX, false);
|
||||||
}},
|
}},
|
||||||
{ConfigureInputSimple::tr("Single Player - Dual Joycons - Docked"),
|
{QT_TR_NOOP("Single Player - Dual Joycons - Docked"), DualJoyconsDockedOnProfileSelect,
|
||||||
DualJoyconsDockedOnProfileSelect,
|
|
||||||
[](ConfigureInputSimple* caller) {
|
[](ConfigureInputSimple* caller) {
|
||||||
CallConfigureDialog<ConfigureInputPlayer>(caller, 1, false);
|
CallConfigureDialog<ConfigureInputPlayer>(caller, 1, false);
|
||||||
}},
|
}},
|
||||||
{ConfigureInputSimple::tr("Custom"), [] {}, CallConfigureDialog<ConfigureInput>},
|
{QT_TR_NOOP("Custom"), [] {}, CallConfigureDialog<ConfigureInput>},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -101,7 +95,8 @@ ConfigureInputSimple::ConfigureInputSimple(QWidget* parent)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
for (const auto& profile : INPUT_PROFILES) {
|
for (const auto& profile : INPUT_PROFILES) {
|
||||||
ui->profile_combobox->addItem(std::get<0>(profile), std::get<0>(profile));
|
const QString label = tr(std::get<0>(profile));
|
||||||
|
ui->profile_combobox->addItem(label, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->profile_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(ui->profile_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
Loading…
Reference in New Issue
Block a user