diff options
| author | 2016-06-06 17:44:01 -0400 | |
|---|---|---|
| committer | 2016-06-06 17:44:01 -0400 | |
| commit | e08fcb0df44d2106861861d8a96510ed0fa0891a (patch) | |
| tree | ab6ec4b6a795e58cdcb1768e6226c67194fda01c /src/citra_qt/config/controller_config_util.cpp | |
| parent | Merge pull request #1884 from lioncash/dlp (diff) | |
| parent | Remove unused and bitrotted "controller config" files (diff) | |
| download | yuzu-e08fcb0df44d2106861861d8a96510ed0fa0891a.tar.gz yuzu-e08fcb0df44d2106861861d8a96510ed0fa0891a.tar.xz yuzu-e08fcb0df44d2106861861d8a96510ed0fa0891a.zip | |
Merge pull request #1873 from archshift/remove-config
Remove unused and bitrotted "controller config" files
Diffstat (limited to 'src/citra_qt/config/controller_config_util.cpp')
| -rw-r--r-- | src/citra_qt/config/controller_config_util.cpp | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/src/citra_qt/config/controller_config_util.cpp b/src/citra_qt/config/controller_config_util.cpp deleted file mode 100644 index d68b119df..000000000 --- a/src/citra_qt/config/controller_config_util.cpp +++ /dev/null | |||
| @@ -1,125 +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 <QPushButton> | ||
| 6 | #include <QStyle> | ||
| 7 | #include <QGridLayout> | ||
| 8 | #include <QKeyEvent> | ||
| 9 | #include <QHBoxLayout> | ||
| 10 | #include <QLabel> | ||
| 11 | |||
| 12 | #include "controller_config_util.h" | ||
| 13 | |||
| 14 | /* TODO(bunnei): ImplementMe | ||
| 15 | GStickConfig::GStickConfig(common::Config::Control leftid, common::Config::Control rightid, common::Config::Control upid, common::Config::Control downid, QObject* change_receiver, QWidget* parent) : QWidget(parent) | ||
| 16 | { | ||
| 17 | left = new GKeyConfigButton(leftid, style()->standardIcon(QStyle::SP_ArrowLeft), QString(), change_receiver, this); | ||
| 18 | right = new GKeyConfigButton(rightid, style()->standardIcon(QStyle::SP_ArrowRight), QString(), change_receiver, this); | ||
| 19 | up = new GKeyConfigButton(upid, style()->standardIcon(QStyle::SP_ArrowUp), QString(), change_receiver, this); | ||
| 20 | down = new GKeyConfigButton(downid, style()->standardIcon(QStyle::SP_ArrowDown), QString(), change_receiver, this); | ||
| 21 | clear = new QPushButton(tr("Clear"), this); | ||
| 22 | |||
| 23 | QGridLayout* layout = new QGridLayout(this); | ||
| 24 | layout->addWidget(left, 1, 0); | ||
| 25 | layout->addWidget(right, 1, 2); | ||
| 26 | layout->addWidget(up, 0, 1); | ||
| 27 | layout->addWidget(down, 2, 1); | ||
| 28 | layout->addWidget(clear, 1, 1); | ||
| 29 | |||
| 30 | setLayout(layout); | ||
| 31 | } | ||
| 32 | |||
| 33 | GKeyConfigButton::GKeyConfigButton(common::Config::Control id, const QIcon& icon, const QString& text, QObject* change_receiver, QWidget* parent) : QPushButton(icon, text, parent), id(id), inputGrabbed(false) | ||
| 34 | { | ||
| 35 | connect(this, SIGNAL(clicked()), this, SLOT(OnClicked())); | ||
| 36 | connect(this, SIGNAL(KeyAssigned(common::Config::Control, int, const QString&)), change_receiver, SLOT(OnKeyConfigChanged(common::Config::Control, int, const QString&))); | ||
| 37 | connect(change_receiver, SIGNAL(ActivePortChanged(const common::Config::ControllerPort&)), this, SLOT(OnActivePortChanged(const common::Config::ControllerPort&))); | ||
| 38 | } | ||
| 39 | |||
| 40 | GKeyConfigButton::GKeyConfigButton(common::Config::Control id, const QString& text, QObject* change_receiver, QWidget* parent) : QPushButton(text, parent), id(id), inputGrabbed(false) | ||
| 41 | { | ||
| 42 | connect(this, SIGNAL(clicked()), this, SLOT(OnClicked())); | ||
| 43 | connect(this, SIGNAL(KeyAssigned(common::Config::Control, int, const QString&)), change_receiver, SLOT(OnKeyConfigChanged(common::Config::Control, int, const QString&))); | ||
| 44 | connect(change_receiver, SIGNAL(ActivePortChanged(const common::Config::ControllerPort&)), this, SLOT(OnActivePortChanged(const common::Config::ControllerPort&))); | ||
| 45 | } | ||
| 46 | |||
| 47 | void GKeyConfigButton::OnActivePortChanged(const common::Config::ControllerPort& config) | ||
| 48 | { | ||
| 49 | // TODO: Doesn't use joypad struct if that's the input source... | ||
| 50 | QString text = QKeySequence(config.keys.key_code[id]).toString(); // has a nicer format | ||
| 51 | if (config.keys.key_code[id] == Qt::Key_Shift) text = tr("Shift"); | ||
| 52 | else if (config.keys.key_code[id] == Qt::Key_Control) text = tr("Control"); | ||
| 53 | else if (config.keys.key_code[id] == Qt::Key_Alt) text = tr("Alt"); | ||
| 54 | else if (config.keys.key_code[id] == Qt::Key_Meta) text = tr("Meta"); | ||
| 55 | setText(text); | ||
| 56 | } | ||
| 57 | |||
| 58 | void GKeyConfigButton::OnClicked() | ||
| 59 | { | ||
| 60 | grabKeyboard(); | ||
| 61 | grabMouse(); | ||
| 62 | inputGrabbed = true; | ||
| 63 | |||
| 64 | old_text = text(); | ||
| 65 | setText(tr("Input...")); | ||
| 66 | } | ||
| 67 | |||
| 68 | void GKeyConfigButton::keyPressEvent(QKeyEvent* event) | ||
| 69 | { | ||
| 70 | if (inputGrabbed) | ||
| 71 | { | ||
| 72 | releaseKeyboard(); | ||
| 73 | releaseMouse(); | ||
| 74 | setText(QString()); | ||
| 75 | |||
| 76 | // TODO: Doesn't capture "return" key | ||
| 77 | // TODO: This doesn't quite work well, yet... find a better way | ||
| 78 | QString text = QKeySequence(event->key()).toString(); // has a nicer format than event->text() | ||
| 79 | int key = event->key(); | ||
| 80 | if (event->modifiers() == Qt::ShiftModifier) { text = tr("Shift"); key = Qt::Key_Shift; } | ||
| 81 | else if (event->modifiers() == Qt::ControlModifier) { text = tr("Ctrl"); key = Qt::Key_Control; } | ||
| 82 | else if (event->modifiers() == Qt::AltModifier) { text = tr("Alt"); key = Qt::Key_Alt; } | ||
| 83 | else if (event->modifiers() == Qt::MetaModifier) { text = tr("Meta"); key = Qt::Key_Meta; } | ||
| 84 | |||
| 85 | setText(old_text); | ||
| 86 | emit KeyAssigned(id, key, text); | ||
| 87 | |||
| 88 | inputGrabbed = false; | ||
| 89 | |||
| 90 | // TODO: Keys like "return" cause another keyPressEvent to be generated after this one... | ||
| 91 | } | ||
| 92 | |||
| 93 | QPushButton::keyPressEvent(event); // TODO: Necessary? | ||
| 94 | } | ||
| 95 | |||
| 96 | void GKeyConfigButton::mousePressEvent(QMouseEvent* event) | ||
| 97 | { | ||
| 98 | // Abort key assignment | ||
| 99 | if (inputGrabbed) | ||
| 100 | { | ||
| 101 | releaseKeyboard(); | ||
| 102 | releaseMouse(); | ||
| 103 | setText(old_text); | ||
| 104 | inputGrabbed = false; | ||
| 105 | } | ||
| 106 | |||
| 107 | QAbstractButton::mousePressEvent(event); | ||
| 108 | } | ||
| 109 | |||
| 110 | GButtonConfigGroup::GButtonConfigGroup(const QString& name, common::Config::Control id, QObject* change_receiver, QWidget* parent) : QWidget(parent), id(id) | ||
| 111 | { | ||
| 112 | QHBoxLayout* layout = new QHBoxLayout(this); | ||
| 113 | |||
| 114 | QPushButton* clear_button = new QPushButton(tr("Clear")); | ||
| 115 | |||
| 116 | layout->addWidget(new QLabel(name, this)); | ||
| 117 | layout->addWidget(config_button = new GKeyConfigButton(id, QString(), change_receiver, this)); | ||
| 118 | layout->addWidget(clear_button); | ||
| 119 | |||
| 120 | // TODO: connect config_button, clear_button | ||
| 121 | |||
| 122 | setLayout(layout); | ||
| 123 | } | ||
| 124 | |||
| 125 | */ | ||