diff options
Diffstat (limited to 'src/citra_qt/config/controller_config.cpp')
| -rw-r--r-- | src/citra_qt/config/controller_config.cpp | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/src/citra_qt/config/controller_config.cpp b/src/citra_qt/config/controller_config.cpp deleted file mode 100644 index 512879f1b..000000000 --- a/src/citra_qt/config/controller_config.cpp +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <QDialogButtonBox> | ||
| 6 | |||
| 7 | #include "controller_config.h" | ||
| 8 | #include "controller_config_util.h" | ||
| 9 | |||
| 10 | /* TODO(bunnei): ImplementMe | ||
| 11 | |||
| 12 | using common::Config; | ||
| 13 | |||
| 14 | GControllerConfig::GControllerConfig(common::Config::ControllerPort* initial_config, QWidget* parent) : QWidget(parent) | ||
| 15 | { | ||
| 16 | ui.setupUi(this); | ||
| 17 | ((QGridLayout*)ui.mainStickTab->layout())->addWidget(new GStickConfig(Config::ANALOG_LEFT, Config::ANALOG_RIGHT, Config::ANALOG_UP, Config::ANALOG_DOWN, this, this), 1, 1); | ||
| 18 | ((QGridLayout*)ui.cStickTab->layout())->addWidget(new GStickConfig(Config::C_LEFT, Config::C_RIGHT, Config::C_UP, Config::C_DOWN, this, this), 1, 1); | ||
| 19 | ((QGridLayout*)ui.dPadTab->layout())->addWidget(new GStickConfig(Config::DPAD_LEFT, Config::DPAD_RIGHT, Config::DPAD_UP, Config::DPAD_DOWN, this, this), 1, 1); | ||
| 20 | |||
| 21 | // TODO: Arrange these more compactly? | ||
| 22 | QVBoxLayout* layout = (QVBoxLayout*)ui.buttonsTab->layout(); | ||
| 23 | layout->addWidget(new GButtonConfigGroup("A Button", Config::BUTTON_A, this, ui.buttonsTab)); | ||
| 24 | layout->addWidget(new GButtonConfigGroup("B Button", Config::BUTTON_B, this, ui.buttonsTab)); | ||
| 25 | layout->addWidget(new GButtonConfigGroup("X Button", Config::BUTTON_X, this, ui.buttonsTab)); | ||
| 26 | layout->addWidget(new GButtonConfigGroup("Y Button", Config::BUTTON_Y, this, ui.buttonsTab)); | ||
| 27 | layout->addWidget(new GButtonConfigGroup("Z Button", Config::BUTTON_Z, this, ui.buttonsTab)); | ||
| 28 | layout->addWidget(new GButtonConfigGroup("L Trigger", Config::TRIGGER_L, this, ui.buttonsTab)); | ||
| 29 | layout->addWidget(new GButtonConfigGroup("R Trigger", Config::TRIGGER_R, this, ui.buttonsTab)); | ||
| 30 | layout->addWidget(new GButtonConfigGroup("Start Button", Config::BUTTON_START, this, ui.buttonsTab)); | ||
| 31 | |||
| 32 | memcpy(config, initial_config, sizeof(config)); | ||
| 33 | |||
| 34 | emit ActivePortChanged(config[0]); | ||
| 35 | } | ||
| 36 | |||
| 37 | void GControllerConfig::OnKeyConfigChanged(common::Config::Control id, int key, const QString& name) | ||
| 38 | { | ||
| 39 | if (InputSourceJoypad()) | ||
| 40 | { | ||
| 41 | config[GetActiveController()].pads.key_code[id] = key; | ||
| 42 | } | ||
| 43 | else | ||
| 44 | { | ||
| 45 | config[GetActiveController()].keys.key_code[id] = key; | ||
| 46 | } | ||
| 47 | emit ActivePortChanged(config[GetActiveController()]); | ||
| 48 | } | ||
| 49 | |||
| 50 | int GControllerConfig::GetActiveController() | ||
| 51 | { | ||
| 52 | return ui.activeControllerCB->currentIndex(); | ||
| 53 | } | ||
| 54 | |||
| 55 | bool GControllerConfig::InputSourceJoypad() | ||
| 56 | { | ||
| 57 | return ui.inputSourceCB->currentIndex() == 1; | ||
| 58 | } | ||
| 59 | |||
| 60 | GControllerConfigDialog::GControllerConfigDialog(common::Config::ControllerPort* controller_ports, QWidget* parent) : QDialog(parent), config_ptr(controller_ports) | ||
| 61 | { | ||
| 62 | setWindowTitle(tr("Input configuration")); | ||
| 63 | |||
| 64 | QVBoxLayout* layout = new QVBoxLayout(this); | ||
| 65 | config_widget = new GControllerConfig(controller_ports, this); | ||
| 66 | layout->addWidget(config_widget); | ||
| 67 | |||
| 68 | QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | ||
| 69 | layout->addWidget(buttons); | ||
| 70 | |||
| 71 | connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); | ||
| 72 | connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); | ||
| 73 | |||
| 74 | connect(this, SIGNAL(accepted()), this, SLOT(EnableChanges())); | ||
| 75 | |||
| 76 | layout->setSizeConstraint(QLayout::SetFixedSize); | ||
| 77 | setLayout(layout); | ||
| 78 | setModal(true); | ||
| 79 | show(); | ||
| 80 | } | ||
| 81 | |||
| 82 | void GControllerConfigDialog::EnableChanges() | ||
| 83 | { | ||
| 84 | for (unsigned int i = 0; i < 4; ++i) | ||
| 85 | { | ||
| 86 | memcpy(&config_ptr[i], &config_widget->GetControllerConfig(i), sizeof(common::Config::ControllerPort)); | ||
| 87 | |||
| 88 | if (common::g_config) { | ||
| 89 | // Apply changes if running a game | ||
| 90 | memcpy(&common::g_config->controller_ports(i), &config_widget->GetControllerConfig(i), sizeof(common::Config::ControllerPort)); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | */ | ||