diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/citra_qt/config/controller_config.cpp | 95 | ||||
| -rw-r--r-- | src/citra_qt/config/controller_config.h | 56 | ||||
| -rw-r--r-- | src/citra_qt/config/controller_config.ui | 308 | ||||
| -rw-r--r-- | src/citra_qt/config/controller_config_util.cpp | 125 | ||||
| -rw-r--r-- | src/citra_qt/config/controller_config_util.h | 82 |
6 files changed, 0 insertions, 671 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 0a5d4624b..585686627 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -2,8 +2,6 @@ set(CMAKE_AUTOMOC ON) | |||
| 2 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | 2 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 3 | 3 | ||
| 4 | set(SRCS | 4 | set(SRCS |
| 5 | config/controller_config.cpp | ||
| 6 | config/controller_config_util.cpp | ||
| 7 | config.cpp | 5 | config.cpp |
| 8 | debugger/callstack.cpp | 6 | debugger/callstack.cpp |
| 9 | debugger/disassembler.cpp | 7 | debugger/disassembler.cpp |
| @@ -33,8 +31,6 @@ set(SRCS | |||
| 33 | ) | 31 | ) |
| 34 | 32 | ||
| 35 | set(HEADERS | 33 | set(HEADERS |
| 36 | config/controller_config.h | ||
| 37 | config/controller_config_util.h | ||
| 38 | config.h | 34 | config.h |
| 39 | debugger/callstack.h | 35 | debugger/callstack.h |
| 40 | debugger/disassembler.h | 36 | debugger/disassembler.h |
| @@ -65,7 +61,6 @@ set(HEADERS | |||
| 65 | ) | 61 | ) |
| 66 | 62 | ||
| 67 | set(UIS | 63 | set(UIS |
| 68 | config/controller_config.ui | ||
| 69 | debugger/callstack.ui | 64 | debugger/callstack.ui |
| 70 | debugger/disassembler.ui | 65 | debugger/disassembler.ui |
| 71 | debugger/profiler.ui | 66 | debugger/profiler.ui |
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 | */ | ||
diff --git a/src/citra_qt/config/controller_config.h b/src/citra_qt/config/controller_config.h deleted file mode 100644 index 451593de1..000000000 --- a/src/citra_qt/config/controller_config.h +++ /dev/null | |||
| @@ -1,56 +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 | #ifndef _CONTROLLER_CONFIG_HXX_ | ||
| 6 | #define _CONTROLLER_CONFIG_HXX_ | ||
| 7 | |||
| 8 | #include <QDialog> | ||
| 9 | |||
| 10 | //#include "ui_controller_config.h" | ||
| 11 | |||
| 12 | /* TODO(bunnei): ImplementMe | ||
| 13 | |||
| 14 | #include "config.h" | ||
| 15 | |||
| 16 | class GControllerConfig : public QWidget | ||
| 17 | { | ||
| 18 | Q_OBJECT | ||
| 19 | |||
| 20 | public: | ||
| 21 | GControllerConfig(common::Config::ControllerPort* initial_config, QWidget* parent = NULL); | ||
| 22 | |||
| 23 | const common::Config::ControllerPort& GetControllerConfig(int index) const { return config[index]; } | ||
| 24 | |||
| 25 | signals: | ||
| 26 | void ActivePortChanged(const common::Config::ControllerPort&); | ||
| 27 | |||
| 28 | public slots: | ||
| 29 | void OnKeyConfigChanged(common::Config::Control id, int key, const QString& name); | ||
| 30 | |||
| 31 | private: | ||
| 32 | int GetActiveController(); | ||
| 33 | bool InputSourceJoypad(); | ||
| 34 | |||
| 35 | Ui::ControllerConfig ui; | ||
| 36 | common::Config::ControllerPort config[4]; | ||
| 37 | }; | ||
| 38 | |||
| 39 | class GControllerConfigDialog : public QDialog | ||
| 40 | { | ||
| 41 | Q_OBJECT | ||
| 42 | |||
| 43 | public: | ||
| 44 | GControllerConfigDialog(common::Config::ControllerPort* controller_ports, QWidget* parent = NULL); | ||
| 45 | |||
| 46 | public slots: | ||
| 47 | void EnableChanges(); | ||
| 48 | |||
| 49 | private: | ||
| 50 | GControllerConfig* config_widget; | ||
| 51 | common::Config::ControllerPort* config_ptr; | ||
| 52 | }; | ||
| 53 | |||
| 54 | */ | ||
| 55 | |||
| 56 | #endif // _CONTROLLER_CONFIG_HXX_ | ||
diff --git a/src/citra_qt/config/controller_config.ui b/src/citra_qt/config/controller_config.ui deleted file mode 100644 index 9f650047b..000000000 --- a/src/citra_qt/config/controller_config.ui +++ /dev/null | |||
| @@ -1,308 +0,0 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <ui version="4.0"> | ||
| 3 | <class>ControllerConfig</class> | ||
| 4 | <widget class="QWidget" name="ControllerConfig"> | ||
| 5 | <property name="geometry"> | ||
| 6 | <rect> | ||
| 7 | <x>0</x> | ||
| 8 | <y>0</y> | ||
| 9 | <width>503</width> | ||
| 10 | <height>293</height> | ||
| 11 | </rect> | ||
| 12 | </property> | ||
| 13 | <property name="sizePolicy"> | ||
| 14 | <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||
| 15 | <horstretch>0</horstretch> | ||
| 16 | <verstretch>0</verstretch> | ||
| 17 | </sizepolicy> | ||
| 18 | </property> | ||
| 19 | <property name="windowTitle"> | ||
| 20 | <string>Controller Configuration</string> | ||
| 21 | </property> | ||
| 22 | <layout class="QVBoxLayout" name="verticalLayout"> | ||
| 23 | <property name="sizeConstraint"> | ||
| 24 | <enum>QLayout::SetFixedSize</enum> | ||
| 25 | </property> | ||
| 26 | <item> | ||
| 27 | <layout class="QGridLayout" name="gridLayout"> | ||
| 28 | <item row="1" column="1"> | ||
| 29 | <widget class="QComboBox" name="activeControllerCB"> | ||
| 30 | <item> | ||
| 31 | <property name="text"> | ||
| 32 | <string>Controller 1</string> | ||
| 33 | </property> | ||
| 34 | </item> | ||
| 35 | <item> | ||
| 36 | <property name="text"> | ||
| 37 | <string>Controller 2</string> | ||
| 38 | </property> | ||
| 39 | </item> | ||
| 40 | <item> | ||
| 41 | <property name="text"> | ||
| 42 | <string>Controller 3</string> | ||
| 43 | </property> | ||
| 44 | </item> | ||
| 45 | <item> | ||
| 46 | <property name="text"> | ||
| 47 | <string>Controller 4</string> | ||
| 48 | </property> | ||
| 49 | </item> | ||
| 50 | </widget> | ||
| 51 | </item> | ||
| 52 | <item row="0" column="2"> | ||
| 53 | <spacer name="horizontalSpacer"> | ||
| 54 | <property name="orientation"> | ||
| 55 | <enum>Qt::Horizontal</enum> | ||
| 56 | </property> | ||
| 57 | <property name="sizeHint" stdset="0"> | ||
| 58 | <size> | ||
| 59 | <width>40</width> | ||
| 60 | <height>20</height> | ||
| 61 | </size> | ||
| 62 | </property> | ||
| 63 | </spacer> | ||
| 64 | </item> | ||
| 65 | <item row="1" column="2"> | ||
| 66 | <widget class="QCheckBox" name="checkBox"> | ||
| 67 | <property name="text"> | ||
| 68 | <string>Enabled</string> | ||
| 69 | </property> | ||
| 70 | </widget> | ||
| 71 | </item> | ||
| 72 | <item row="0" column="1"> | ||
| 73 | <widget class="QComboBox" name="inputSourceCB"> | ||
| 74 | <item> | ||
| 75 | <property name="text"> | ||
| 76 | <string>Keyboard</string> | ||
| 77 | </property> | ||
| 78 | </item> | ||
| 79 | <item> | ||
| 80 | <property name="text"> | ||
| 81 | <string>Joypad</string> | ||
| 82 | </property> | ||
| 83 | </item> | ||
| 84 | </widget> | ||
| 85 | </item> | ||
| 86 | <item row="1" column="0"> | ||
| 87 | <widget class="QLabel" name="label_2"> | ||
| 88 | <property name="text"> | ||
| 89 | <string>Active Controller:</string> | ||
| 90 | </property> | ||
| 91 | </widget> | ||
| 92 | </item> | ||
| 93 | <item row="0" column="0"> | ||
| 94 | <widget class="QLabel" name="label"> | ||
| 95 | <property name="text"> | ||
| 96 | <string>Input Source:</string> | ||
| 97 | </property> | ||
| 98 | </widget> | ||
| 99 | </item> | ||
| 100 | </layout> | ||
| 101 | </item> | ||
| 102 | <item> | ||
| 103 | <widget class="QTabWidget" name="tabWidget"> | ||
| 104 | <property name="currentIndex"> | ||
| 105 | <number>0</number> | ||
| 106 | </property> | ||
| 107 | <widget class="QWidget" name="mainStickTab"> | ||
| 108 | <attribute name="title"> | ||
| 109 | <string>Main Stick</string> | ||
| 110 | </attribute> | ||
| 111 | <layout class="QGridLayout" name="gridLayout_3"> | ||
| 112 | <item row="2" column="2"> | ||
| 113 | <spacer name="verticalSpacer_2"> | ||
| 114 | <property name="orientation"> | ||
| 115 | <enum>Qt::Vertical</enum> | ||
| 116 | </property> | ||
| 117 | <property name="sizeHint" stdset="0"> | ||
| 118 | <size> | ||
| 119 | <width>20</width> | ||
| 120 | <height>40</height> | ||
| 121 | </size> | ||
| 122 | </property> | ||
| 123 | </spacer> | ||
| 124 | </item> | ||
| 125 | <item row="0" column="2"> | ||
| 126 | <spacer name="verticalSpacer_3"> | ||
| 127 | <property name="orientation"> | ||
| 128 | <enum>Qt::Vertical</enum> | ||
| 129 | </property> | ||
| 130 | <property name="sizeHint" stdset="0"> | ||
| 131 | <size> | ||
| 132 | <width>20</width> | ||
| 133 | <height>40</height> | ||
| 134 | </size> | ||
| 135 | </property> | ||
| 136 | </spacer> | ||
| 137 | </item> | ||
| 138 | <item row="1" column="0"> | ||
| 139 | <spacer name="horizontalSpacer_4"> | ||
| 140 | <property name="orientation"> | ||
| 141 | <enum>Qt::Horizontal</enum> | ||
| 142 | </property> | ||
| 143 | <property name="sizeHint" stdset="0"> | ||
| 144 | <size> | ||
| 145 | <width>40</width> | ||
| 146 | <height>20</height> | ||
| 147 | </size> | ||
| 148 | </property> | ||
| 149 | </spacer> | ||
| 150 | </item> | ||
| 151 | <item row="1" column="4"> | ||
| 152 | <spacer name="horizontalSpacer_3"> | ||
| 153 | <property name="orientation"> | ||
| 154 | <enum>Qt::Horizontal</enum> | ||
| 155 | </property> | ||
| 156 | <property name="sizeHint" stdset="0"> | ||
| 157 | <size> | ||
| 158 | <width>40</width> | ||
| 159 | <height>20</height> | ||
| 160 | </size> | ||
| 161 | </property> | ||
| 162 | </spacer> | ||
| 163 | </item> | ||
| 164 | </layout> | ||
| 165 | </widget> | ||
| 166 | <widget class="QWidget" name="cStickTab"> | ||
| 167 | <attribute name="title"> | ||
| 168 | <string>C-Stick</string> | ||
| 169 | </attribute> | ||
| 170 | <layout class="QGridLayout" name="gridLayout_4"> | ||
| 171 | <item row="1" column="0"> | ||
| 172 | <spacer name="horizontalSpacer_6"> | ||
| 173 | <property name="orientation"> | ||
| 174 | <enum>Qt::Horizontal</enum> | ||
| 175 | </property> | ||
| 176 | <property name="sizeHint" stdset="0"> | ||
| 177 | <size> | ||
| 178 | <width>40</width> | ||
| 179 | <height>0</height> | ||
| 180 | </size> | ||
| 181 | </property> | ||
| 182 | </spacer> | ||
| 183 | </item> | ||
| 184 | <item row="0" column="1"> | ||
| 185 | <spacer name="verticalSpacer_5"> | ||
| 186 | <property name="orientation"> | ||
| 187 | <enum>Qt::Vertical</enum> | ||
| 188 | </property> | ||
| 189 | <property name="sizeHint" stdset="0"> | ||
| 190 | <size> | ||
| 191 | <width>20</width> | ||
| 192 | <height>40</height> | ||
| 193 | </size> | ||
| 194 | </property> | ||
| 195 | </spacer> | ||
| 196 | </item> | ||
| 197 | <item row="2" column="1"> | ||
| 198 | <spacer name="verticalSpacer_4"> | ||
| 199 | <property name="orientation"> | ||
| 200 | <enum>Qt::Vertical</enum> | ||
| 201 | </property> | ||
| 202 | <property name="sizeHint" stdset="0"> | ||
| 203 | <size> | ||
| 204 | <width>20</width> | ||
| 205 | <height>40</height> | ||
| 206 | </size> | ||
| 207 | </property> | ||
| 208 | </spacer> | ||
| 209 | </item> | ||
| 210 | <item row="1" column="2"> | ||
| 211 | <spacer name="horizontalSpacer_5"> | ||
| 212 | <property name="orientation"> | ||
| 213 | <enum>Qt::Horizontal</enum> | ||
| 214 | </property> | ||
| 215 | <property name="sizeHint" stdset="0"> | ||
| 216 | <size> | ||
| 217 | <width>40</width> | ||
| 218 | <height>20</height> | ||
| 219 | </size> | ||
| 220 | </property> | ||
| 221 | </spacer> | ||
| 222 | </item> | ||
| 223 | </layout> | ||
| 224 | </widget> | ||
| 225 | <widget class="QWidget" name="dPadTab"> | ||
| 226 | <attribute name="title"> | ||
| 227 | <string>D-Pad</string> | ||
| 228 | </attribute> | ||
| 229 | <layout class="QGridLayout" name="gridLayout_5"> | ||
| 230 | <item row="1" column="2"> | ||
| 231 | <spacer name="horizontalSpacer_7"> | ||
| 232 | <property name="orientation"> | ||
| 233 | <enum>Qt::Horizontal</enum> | ||
| 234 | </property> | ||
| 235 | <property name="sizeHint" stdset="0"> | ||
| 236 | <size> | ||
| 237 | <width>40</width> | ||
| 238 | <height>20</height> | ||
| 239 | </size> | ||
| 240 | </property> | ||
| 241 | </spacer> | ||
| 242 | </item> | ||
| 243 | <item row="0" column="1"> | ||
| 244 | <spacer name="verticalSpacer_7"> | ||
| 245 | <property name="orientation"> | ||
| 246 | <enum>Qt::Vertical</enum> | ||
| 247 | </property> | ||
| 248 | <property name="sizeHint" stdset="0"> | ||
| 249 | <size> | ||
| 250 | <width>20</width> | ||
| 251 | <height>40</height> | ||
| 252 | </size> | ||
| 253 | </property> | ||
| 254 | </spacer> | ||
| 255 | </item> | ||
| 256 | <item row="2" column="1"> | ||
| 257 | <spacer name="verticalSpacer_6"> | ||
| 258 | <property name="orientation"> | ||
| 259 | <enum>Qt::Vertical</enum> | ||
| 260 | </property> | ||
| 261 | <property name="sizeHint" stdset="0"> | ||
| 262 | <size> | ||
| 263 | <width>20</width> | ||
| 264 | <height>40</height> | ||
| 265 | </size> | ||
| 266 | </property> | ||
| 267 | </spacer> | ||
| 268 | </item> | ||
| 269 | <item row="1" column="0"> | ||
| 270 | <spacer name="horizontalSpacer_8"> | ||
| 271 | <property name="orientation"> | ||
| 272 | <enum>Qt::Horizontal</enum> | ||
| 273 | </property> | ||
| 274 | <property name="sizeHint" stdset="0"> | ||
| 275 | <size> | ||
| 276 | <width>40</width> | ||
| 277 | <height>20</height> | ||
| 278 | </size> | ||
| 279 | </property> | ||
| 280 | </spacer> | ||
| 281 | </item> | ||
| 282 | </layout> | ||
| 283 | </widget> | ||
| 284 | <widget class="QWidget" name="buttonsTab"> | ||
| 285 | <attribute name="title"> | ||
| 286 | <string>Buttons</string> | ||
| 287 | </attribute> | ||
| 288 | <layout class="QVBoxLayout" name="verticalLayout_2"/> | ||
| 289 | </widget> | ||
| 290 | </widget> | ||
| 291 | </item> | ||
| 292 | </layout> | ||
| 293 | </widget> | ||
| 294 | <resources/> | ||
| 295 | <connections/> | ||
| 296 | <slots> | ||
| 297 | <signal>ControlsChanged()</signal> | ||
| 298 | <signal>MainStickCleared()</signal> | ||
| 299 | <signal>CStickCleared()</signal> | ||
| 300 | <signal>DPadCleared()</signal> | ||
| 301 | <signal>ButtonsCleared()</signal> | ||
| 302 | <slot>OnControlsChanged()</slot> | ||
| 303 | <slot>OnMainStickCleared()</slot> | ||
| 304 | <slot>OnCStickCleared()</slot> | ||
| 305 | <slot>OnDPadCleared()</slot> | ||
| 306 | <slot>OnButtonsCleared()</slot> | ||
| 307 | </slots> | ||
| 308 | </ui> | ||
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 | */ | ||
diff --git a/src/citra_qt/config/controller_config_util.h b/src/citra_qt/config/controller_config_util.h deleted file mode 100644 index 15e025b57..000000000 --- a/src/citra_qt/config/controller_config_util.h +++ /dev/null | |||
| @@ -1,82 +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 | #ifndef _CONTROLLER_CONFIG_UTIL_HXX_ | ||
| 6 | #define _CONTROLLER_CONFIG_UTIL_HXX_ | ||
| 7 | |||
| 8 | #include <QWidget> | ||
| 9 | #include <QPushButton> | ||
| 10 | |||
| 11 | /* TODO(bunnei): ImplementMe | ||
| 12 | |||
| 13 | #include "config.h" | ||
| 14 | |||
| 15 | class GStickConfig : public QWidget | ||
| 16 | { | ||
| 17 | Q_OBJECT | ||
| 18 | |||
| 19 | public: | ||
| 20 | // change_receiver needs to have a OnKeyConfigChanged(common::Config::Control, int, const QString&) slot! | ||
| 21 | GStickConfig(common::Config::Control leftid, common::Config::Control rightid, common::Config::Control upid, common::Config::Control downid, QObject* change_receiver, QWidget* parent = NULL); | ||
| 22 | |||
| 23 | signals: | ||
| 24 | void LeftChanged(); | ||
| 25 | void RightChanged(); | ||
| 26 | void UpChanged(); | ||
| 27 | void DownChanged(); | ||
| 28 | |||
| 29 | private: | ||
| 30 | QPushButton* left; | ||
| 31 | QPushButton* right; | ||
| 32 | QPushButton* up; | ||
| 33 | QPushButton* down; | ||
| 34 | |||
| 35 | QPushButton* clear; | ||
| 36 | }; | ||
| 37 | |||
| 38 | class GKeyConfigButton : public QPushButton | ||
| 39 | { | ||
| 40 | Q_OBJECT | ||
| 41 | |||
| 42 | public: | ||
| 43 | // TODO: change_receiver also needs to have an ActivePortChanged(const common::Config::ControllerPort&) signal | ||
| 44 | // change_receiver needs to have a OnKeyConfigChanged(common::Config::Control, int, const QString&) slot! | ||
| 45 | GKeyConfigButton(common::Config::Control id, const QIcon& icon, const QString& text, QObject* change_receiver, QWidget* parent); | ||
| 46 | GKeyConfigButton(common::Config::Control id, const QString& text, QObject* change_receiver, QWidget* parent); | ||
| 47 | |||
| 48 | signals: | ||
| 49 | void KeyAssigned(common::Config::Control id, int key, const QString& text); | ||
| 50 | |||
| 51 | private slots: | ||
| 52 | void OnActivePortChanged(const common::Config::ControllerPort& config); | ||
| 53 | |||
| 54 | void OnClicked(); | ||
| 55 | |||
| 56 | void keyPressEvent(QKeyEvent* event); // TODO: bGrabbed? | ||
| 57 | void mousePressEvent(QMouseEvent* event); | ||
| 58 | |||
| 59 | private: | ||
| 60 | common::Config::Control id; | ||
| 61 | bool inputGrabbed; | ||
| 62 | |||
| 63 | QString old_text; | ||
| 64 | }; | ||
| 65 | |||
| 66 | class GButtonConfigGroup : public QWidget | ||
| 67 | { | ||
| 68 | Q_OBJECT | ||
| 69 | |||
| 70 | public: | ||
| 71 | // change_receiver needs to have a OnKeyConfigChanged(common::Config::Control, int, const QString&) slot! | ||
| 72 | GButtonConfigGroup(const QString& name, common::Config::Control id, QObject* change_receiver, QWidget* parent = NULL); | ||
| 73 | |||
| 74 | private: | ||
| 75 | GKeyConfigButton* config_button; | ||
| 76 | |||
| 77 | common::Config::Control id; | ||
| 78 | }; | ||
| 79 | |||
| 80 | */ | ||
| 81 | |||
| 82 | #endif // _CONTROLLER_CONFIG_HXX_ | ||