diff options
Diffstat (limited to 'src/citra_qt/configure_input.cpp')
| -rw-r--r-- | src/citra_qt/configure_input.cpp | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/citra_qt/configure_input.cpp b/src/citra_qt/configure_input.cpp index 9c7a67174..d321db71f 100644 --- a/src/citra_qt/configure_input.cpp +++ b/src/citra_qt/configure_input.cpp | |||
| @@ -5,38 +5,39 @@ | |||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include <utility> | 6 | #include <utility> |
| 7 | #include <QTimer> | 7 | #include <QTimer> |
| 8 | |||
| 9 | #include "citra_qt/configure_input.h" | 8 | #include "citra_qt/configure_input.h" |
| 10 | 9 | ||
| 11 | ConfigureInput::ConfigureInput(QWidget* parent) : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()) { | 10 | ConfigureInput::ConfigureInput(QWidget* parent) |
| 11 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()) { | ||
| 12 | |||
| 12 | ui->setupUi(this); | 13 | ui->setupUi(this); |
| 13 | 14 | ||
| 14 | // Initialize mapping of input enum to UI button. | 15 | // Initialize mapping of input enum to UI button. |
| 15 | input_mapping = { | 16 | input_mapping = { |
| 16 | { std::make_pair(Settings::NativeInput::Values::A, ui->buttonA) }, | 17 | {Settings::NativeInput::Values::A, ui->buttonA}, |
| 17 | { std::make_pair(Settings::NativeInput::Values::B, ui->buttonB) }, | 18 | {Settings::NativeInput::Values::B, ui->buttonB}, |
| 18 | { std::make_pair(Settings::NativeInput::Values::X, ui->buttonX) }, | 19 | {Settings::NativeInput::Values::X, ui->buttonX}, |
| 19 | { std::make_pair(Settings::NativeInput::Values::Y, ui->buttonY) }, | 20 | {Settings::NativeInput::Values::Y, ui->buttonY}, |
| 20 | { std::make_pair(Settings::NativeInput::Values::L, ui->buttonL) }, | 21 | {Settings::NativeInput::Values::L, ui->buttonL}, |
| 21 | { std::make_pair(Settings::NativeInput::Values::R, ui->buttonR) }, | 22 | {Settings::NativeInput::Values::R, ui->buttonR}, |
| 22 | { std::make_pair(Settings::NativeInput::Values::ZL, ui->buttonZL) }, | 23 | {Settings::NativeInput::Values::ZL, ui->buttonZL}, |
| 23 | { std::make_pair(Settings::NativeInput::Values::ZR, ui->buttonZR) }, | 24 | {Settings::NativeInput::Values::ZR, ui->buttonZR}, |
| 24 | { std::make_pair(Settings::NativeInput::Values::START, ui->buttonStart) }, | 25 | {Settings::NativeInput::Values::START, ui->buttonStart}, |
| 25 | { std::make_pair(Settings::NativeInput::Values::SELECT, ui->buttonSelect) }, | 26 | {Settings::NativeInput::Values::SELECT, ui->buttonSelect}, |
| 26 | { std::make_pair(Settings::NativeInput::Values::HOME, ui->buttonHome) }, | 27 | {Settings::NativeInput::Values::HOME, ui->buttonHome}, |
| 27 | { std::make_pair(Settings::NativeInput::Values::DUP, ui->buttonDpadUp) }, | 28 | {Settings::NativeInput::Values::DUP, ui->buttonDpadUp}, |
| 28 | { std::make_pair(Settings::NativeInput::Values::DDOWN, ui->buttonDpadDown) }, | 29 | {Settings::NativeInput::Values::DDOWN, ui->buttonDpadDown}, |
| 29 | { std::make_pair(Settings::NativeInput::Values::DLEFT, ui->buttonDpadLeft) }, | 30 | {Settings::NativeInput::Values::DLEFT, ui->buttonDpadLeft}, |
| 30 | { std::make_pair(Settings::NativeInput::Values::DRIGHT, ui->buttonDpadRight) }, | 31 | {Settings::NativeInput::Values::DRIGHT, ui->buttonDpadRight}, |
| 31 | { std::make_pair(Settings::NativeInput::Values::CUP, ui->buttonCStickUp) }, | 32 | {Settings::NativeInput::Values::CUP, ui->buttonCStickUp}, |
| 32 | { std::make_pair(Settings::NativeInput::Values::CDOWN, ui->buttonCStickDown) }, | 33 | {Settings::NativeInput::Values::CDOWN, ui->buttonCStickDown}, |
| 33 | { std::make_pair(Settings::NativeInput::Values::CLEFT, ui->buttonCStickLeft) }, | 34 | {Settings::NativeInput::Values::CLEFT, ui->buttonCStickLeft}, |
| 34 | { std::make_pair(Settings::NativeInput::Values::CRIGHT, ui->buttonCStickRight) }, | 35 | {Settings::NativeInput::Values::CRIGHT, ui->buttonCStickRight}, |
| 35 | { std::make_pair(Settings::NativeInput::Values::CIRCLE_UP, ui->buttonCircleUp) }, | 36 | {Settings::NativeInput::Values::CIRCLE_UP, ui->buttonCircleUp}, |
| 36 | { std::make_pair(Settings::NativeInput::Values::CIRCLE_DOWN, ui->buttonCircleDown) }, | 37 | {Settings::NativeInput::Values::CIRCLE_DOWN, ui->buttonCircleDown}, |
| 37 | { std::make_pair(Settings::NativeInput::Values::CIRCLE_LEFT, ui->buttonCircleLeft) }, | 38 | {Settings::NativeInput::Values::CIRCLE_LEFT, ui->buttonCircleLeft}, |
| 38 | { std::make_pair(Settings::NativeInput::Values::CIRCLE_RIGHT, ui->buttonCircleRight) }, | 39 | {Settings::NativeInput::Values::CIRCLE_RIGHT, ui->buttonCircleRight}, |
| 39 | { std::make_pair(Settings::NativeInput::Values::CIRCLE_MODIFIER, ui->buttonCircleMod) }, | 40 | {Settings::NativeInput::Values::CIRCLE_MODIFIER, ui->buttonCircleMod}, |
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| 42 | // Attach handle click method to each button click. | 43 | // Attach handle click method to each button click. |
| @@ -47,7 +48,10 @@ ConfigureInput::ConfigureInput(QWidget* parent) : QWidget(parent), ui(std::make_ | |||
| 47 | setFocusPolicy(Qt::ClickFocus); | 48 | setFocusPolicy(Qt::ClickFocus); |
| 48 | timer = new QTimer(this); | 49 | timer = new QTimer(this); |
| 49 | timer->setSingleShot(true); | 50 | timer->setSingleShot(true); |
| 50 | connect(timer, &QTimer::timeout, this, [&]() { key_pressed = Qt::Key_Escape; setKey(); }); | 51 | connect(timer, &QTimer::timeout, this, [&]() { |
| 52 | key_pressed = Qt::Key_Escape; | ||
| 53 | setKey(); | ||
| 54 | }); | ||
| 51 | this->setConfiguration(); | 55 | this->setConfiguration(); |
| 52 | } | 56 | } |
| 53 | 57 | ||
| @@ -59,7 +63,7 @@ void ConfigureInput::handleClick() { | |||
| 59 | grabKeyboard(); | 63 | grabKeyboard(); |
| 60 | grabMouse(); | 64 | grabMouse(); |
| 61 | changing_button = sender; | 65 | changing_button = sender; |
| 62 | timer->start(5000); //Cancel after 5 seconds | 66 | timer->start(5000); // Cancel after 5 seconds |
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | void ConfigureInput::applyConfiguration() { | 69 | void ConfigureInput::applyConfiguration() { |