Settings: Remove inputs.ui, code the whole UI in C++. Use layouts instead of hard-coding the UI. Add support for ZL, ZR and C-Pad. Let each lineEdit hold a reference to the temp_settings struct.

This commit is contained in:
Chin 2015-05-31 12:42:53 -04:00 committed by chinhodado
parent 6d4b63aeaf
commit e1a91b3c4b
7 changed files with 239 additions and 700 deletions

View File

@ -27,10 +27,10 @@ set(SRCS
) )
set(HEADERS set(HEADERS
config/inputs.h
config/QLineEditKeyConfig.h
config/controller_config.h config/controller_config.h
config/controller_config_util.h config/controller_config_util.h
config/inputs.h
config/QLineEditKeyConfig.h
config.h config.h
debugger/callstack.h debugger/callstack.h
debugger/disassembler.h debugger/disassembler.h
@ -54,7 +54,6 @@ set(HEADERS
set(UIS set(UIS
config/controller_config.ui config/controller_config.ui
config/inputs.ui
debugger/callstack.ui debugger/callstack.ui
debugger/disassembler.ui debugger/disassembler.ui
debugger/profiler.ui debugger/profiler.ui

View File

@ -5,19 +5,25 @@
#include "QLineEditKeyConfig.h" #include "QLineEditKeyConfig.h"
#include "inputs.h" #include "inputs.h"
#include <QKeyEvent> #include <QKeyEvent>
#include <QLineEdit>
QLineEditKeyConfig::QLineEditKeyConfig(QWidget* parent) : QLineEdit(parent) {} std::map<Button, std::string> ButtonNameMap({
{ Button::A, "A" }, { Button::B, "B" }, { Button::X, "X" }, { Button::Y, "Y" },
{ Button::L, "L" }, { Button::R, "R" }, { Button::ZL, "ZL" }, { Button::ZR, "ZR" },
{ Button::DLeft, "D-Left" }, { Button::DRight, "D-Right" }, { Button::DUp, "D-Up" }, { Button::DDown, "D-Down" },
{ Button::SLeft, "S-Left" }, { Button::SRight, "S-Right" }, { Button::SUp, "S-Up" }, { Button::SDown, "S-Down" },
{ Button::CLeft, "C-Left" }, { Button::CRight, "C-Right" }, { Button::CUp, "C-Up" }, { Button::CDown, "C-Down" },
{ Button::Start, "Start" }, { Button::Select, "Select" }, { Button::Home, "Home" } }
);
QLineEditKeyConfig::QLineEditKeyConfig(Settings::Values& temp_settings, Button button, QWidget* parent)
: button(button), temp_settings(temp_settings), QLineEdit(parent) {}
void QLineEditKeyConfig::keyPressEvent(QKeyEvent* event) { void QLineEditKeyConfig::keyPressEvent(QKeyEvent* event) {
QString key_name = GInputsDialog::getKeyName(event->key()); QString key_name = GInputsDialog::GetKeyName(event->key());
this->setText(key_name); setText(key_name);
GInputsDialog* parent_dialog = static_cast<GInputsDialog*>(this->parent()->parent());
Settings::Values& temp_settings = parent_dialog->temp_settings;
int key = event->key(); int key = event->key();
switch (this->button) { switch (button) {
case Button::A: case Button::A:
temp_settings.pad_a_key = key; temp_settings.pad_a_key = key;
break; break;
@ -36,14 +42,11 @@ void QLineEditKeyConfig::keyPressEvent(QKeyEvent* event) {
case Button::R: case Button::R:
temp_settings.pad_r_key = key; temp_settings.pad_r_key = key;
break; break;
case Button::Start: case Button::ZL:
temp_settings.pad_start_key = key; temp_settings.pad_zl_key = key;
break; break;
case Button::Select: case Button::ZR:
temp_settings.pad_select_key = key; temp_settings.pad_zr_key = key;
break;
case Button::Home:
temp_settings.pad_home_key = key;
break; break;
case Button::DUp: case Button::DUp:
temp_settings.pad_dup_key = key; temp_settings.pad_dup_key = key;
@ -69,6 +72,27 @@ void QLineEditKeyConfig::keyPressEvent(QKeyEvent* event) {
case Button::SRight: case Button::SRight:
temp_settings.pad_sright_key = key; temp_settings.pad_sright_key = key;
break; break;
case Button::CUp:
temp_settings.pad_cup_key = key;
break;
case Button::CDown:
temp_settings.pad_cdown_key = key;
break;
case Button::CLeft:
temp_settings.pad_cleft_key = key;
break;
case Button::CRight:
temp_settings.pad_cright_key = key;
break;
case Button::Home:
temp_settings.pad_home_key = key;
break;
case Button::Start:
temp_settings.pad_start_key = key;
break;
case Button::Select:
temp_settings.pad_select_key = key;
break;
default: default:
break; break;
} }

View File

@ -5,22 +5,32 @@
#pragma once #pragma once
#include <QLineEdit> #include <QLineEdit>
#include <map>
#include "../core/settings.h"
class QKeyEvent; class QKeyEvent;
/// An enum for the buttons on the 3DS /// An enum for the buttons on the 3DS
enum Button { enum Button {
A, B, X, Y, L, R, Start, Select, Home, A, B, X, Y, L, R, ZL, ZR,
DUp, DDown, DLeft, DRight, DUp, DDown, DLeft, DRight,
SUp, SDown, SLeft, SRight SUp, SDown, SLeft, SRight,
CUp, CDown, CLeft, CRight,
Start, Select, Home
}; };
/// Map a button to its name
extern std::map<Button, std::string> ButtonNameMap;
/// The LineEdits used for button configuration /// The LineEdits used for button configuration
class QLineEditKeyConfig : public QLineEdit { class QLineEditKeyConfig : public QLineEdit {
Q_OBJECT Q_OBJECT
public: public:
Button button; Button button;
QLineEditKeyConfig(QWidget* parent); QLineEditKeyConfig(Settings::Values& temp_settings, Button button, QWidget* parent = nullptr);
void keyPressEvent(QKeyEvent* event) override; void keyPressEvent(QKeyEvent* event) override;
private:
Settings::Values& temp_settings;
}; };

View File

@ -7,68 +7,117 @@
#include <QKeySequence> #include <QKeySequence>
#include <QSettings> #include <QSettings>
#include <QPushButton> #include <QPushButton>
#include <QLabel>
#include <QGridLayout>
#include <QDialogButtonBox>
#include "config.h" #include "config.h"
#include "inputs.h" #include "inputs.h"
#include "QLineEditKeyConfig.h"
GInputsDialog::GInputsDialog(QWidget* parent) : QDialog(parent) { GInputsDialog::GInputsDialog(QWidget* parent) : QDialog(parent) {
ui.setupUi(this); // create a copy of the current settings
temp_settings = Settings::Values(Settings::values);
// setup the LineEdits // create the lineEdits
this->ui.lineEdit_A->button = Button::A; lineEdit_A = new QLineEditKeyConfig(temp_settings, Button::A);
this->ui.lineEdit_B->button = Button::B; lineEdit_B = new QLineEditKeyConfig(temp_settings, Button::B);
this->ui.lineEdit_X->button = Button::X; lineEdit_X = new QLineEditKeyConfig(temp_settings, Button::X);
this->ui.lineEdit_Y->button = Button::Y; lineEdit_Y = new QLineEditKeyConfig(temp_settings, Button::Y);
this->ui.lineEdit_L->button = Button::L; lineEdit_L = new QLineEditKeyConfig(temp_settings, Button::L);
this->ui.lineEdit_R->button = Button::R; lineEdit_R = new QLineEditKeyConfig(temp_settings, Button::R);
this->ui.lineEdit_Start->button = Button::Start; lineEdit_ZL = new QLineEditKeyConfig(temp_settings, Button::ZL);
this->ui.lineEdit_Select->button = Button::Select; lineEdit_ZR = new QLineEditKeyConfig(temp_settings, Button::ZR);
this->ui.lineEdit_Home->button = Button::Home; lineEdit_dUp = new QLineEditKeyConfig(temp_settings, Button::DUp);
this->ui.lineEdit_dUp->button = Button::DUp; lineEdit_dDown = new QLineEditKeyConfig(temp_settings, Button::DDown);
this->ui.lineEdit_dDown->button = Button::DDown; lineEdit_dLeft = new QLineEditKeyConfig(temp_settings, Button::DLeft);
this->ui.lineEdit_dLeft->button = Button::DLeft; lineEdit_dRight = new QLineEditKeyConfig(temp_settings, Button::DRight);
this->ui.lineEdit_dRight->button = Button::DRight; lineEdit_sUp = new QLineEditKeyConfig(temp_settings, Button::SUp);
this->ui.lineEdit_sUp->button = Button::SUp; lineEdit_sDown = new QLineEditKeyConfig(temp_settings, Button::SDown);
this->ui.lineEdit_sDown->button = Button::SDown; lineEdit_sLeft = new QLineEditKeyConfig(temp_settings, Button::SLeft);
this->ui.lineEdit_sLeft->button = Button::SLeft; lineEdit_sRight = new QLineEditKeyConfig(temp_settings, Button::SRight);
this->ui.lineEdit_sRight->button = Button::SRight; lineEdit_cUp = new QLineEditKeyConfig(temp_settings, Button::CUp);
lineEdit_cDown = new QLineEditKeyConfig(temp_settings, Button::CDown);
lineEdit_cLeft = new QLineEditKeyConfig(temp_settings, Button::CLeft);
lineEdit_cRight = new QLineEditKeyConfig(temp_settings, Button::CRight);
lineEdit_Home = new QLineEditKeyConfig(temp_settings, Button::Home);
lineEdit_Start = new QLineEditKeyConfig(temp_settings, Button::Start);
lineEdit_Select = new QLineEditKeyConfig(temp_settings, Button::Select);
lineEdits = {{
lineEdit_A, lineEdit_B, lineEdit_X, lineEdit_Y, lineEdit_L, lineEdit_R, lineEdit_ZL, lineEdit_ZR,
lineEdit_dUp, lineEdit_dDown, lineEdit_dLeft, lineEdit_dRight,
lineEdit_sUp, lineEdit_sDown, lineEdit_sLeft, lineEdit_sRight,
lineEdit_cUp, lineEdit_cDown, lineEdit_cLeft, lineEdit_cRight,
lineEdit_Home, lineEdit_Start, lineEdit_Select
}};
// put the lineEdits and their labels into a grid
QGridLayout *grid = new QGridLayout();
size_t size = lineEdits.size();
for (size_t i = 0; i < size; i++) {
const int numRow = 8;
int row = i % numRow;
int labelColumn = i / numRow * 2;
QLineEditKeyConfig *lineEdit = lineEdits[i];
QLabel *label = new QLabel(QString::fromStdString(ButtonNameMap[lineEdit->button]));
grid->addWidget(label, row, labelColumn);
grid->addWidget(lineEdit, row, labelColumn + 1);
}
// the button box that contains the restore default/ok/cancel buttons
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok | QDialogButtonBox::RestoreDefaults);
verticalLayout->addLayout(grid);
verticalLayout->addWidget(buttonBox);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
setLayout(verticalLayout);
setWindowTitle(tr("Input Settings"));
resize(165, height());
// set up event handlers for the buttons // set up event handlers for the buttons
QPushButton* defaultButton = this->ui.buttonBox->button(QDialogButtonBox::RestoreDefaults); QPushButton* defaultButton = buttonBox->button(QDialogButtonBox::RestoreDefaults);
connect(defaultButton, SIGNAL(clicked()), this, SLOT(RestoreDefaultSettings())); connect(defaultButton, SIGNAL(clicked()), this, SLOT(RestoreDefaultSettings()));
QPushButton* okButton = this->ui.buttonBox->button(QDialogButtonBox::Ok); QPushButton* okButton = buttonBox->button(QDialogButtonBox::Ok);
connect(okButton, SIGNAL(clicked()), this, SLOT(SaveSettings())); connect(okButton, SIGNAL(clicked()), this, SLOT(SaveSettings()));
// create a copy of the current settings
this->temp_settings = Settings::Values(Settings::values);
// display current key settings // display current key settings
this->displayButtonSettings(Settings::values); UpdateKeyLabels();
} }
void GInputsDialog::displayButtonSettings(const Settings::Values& values) { void GInputsDialog::UpdateKeyLabels() {
this->ui.lineEdit_A->setText(GInputsDialog::getKeyName(values.pad_a_key)); lineEdit_A->setText(GetKeyName(temp_settings.pad_a_key));
this->ui.lineEdit_B->setText(GInputsDialog::getKeyName(values.pad_b_key)); lineEdit_B->setText(GetKeyName(temp_settings.pad_b_key));
this->ui.lineEdit_X->setText(GInputsDialog::getKeyName(values.pad_x_key)); lineEdit_X->setText(GetKeyName(temp_settings.pad_x_key));
this->ui.lineEdit_Y->setText(GInputsDialog::getKeyName(values.pad_y_key)); lineEdit_Y->setText(GetKeyName(temp_settings.pad_y_key));
this->ui.lineEdit_L->setText(GInputsDialog::getKeyName(values.pad_l_key)); lineEdit_L->setText(GetKeyName(temp_settings.pad_l_key));
this->ui.lineEdit_R->setText(GInputsDialog::getKeyName(values.pad_r_key)); lineEdit_R->setText(GetKeyName(temp_settings.pad_r_key));
this->ui.lineEdit_Start->setText(GInputsDialog::getKeyName(values.pad_start_key)); lineEdit_ZL->setText(GetKeyName(temp_settings.pad_zl_key));
this->ui.lineEdit_Select->setText(GInputsDialog::getKeyName(values.pad_select_key)); lineEdit_ZR->setText(GetKeyName(temp_settings.pad_zr_key));
this->ui.lineEdit_Home->setText(GInputsDialog::getKeyName(values.pad_home_key)); lineEdit_dUp->setText(GetKeyName(temp_settings.pad_dup_key));
this->ui.lineEdit_dUp->setText(GInputsDialog::getKeyName(values.pad_dup_key)); lineEdit_dDown->setText(GetKeyName(temp_settings.pad_ddown_key));
this->ui.lineEdit_dDown->setText(GInputsDialog::getKeyName(values.pad_ddown_key)); lineEdit_dLeft->setText(GetKeyName(temp_settings.pad_dleft_key));
this->ui.lineEdit_dLeft->setText(GInputsDialog::getKeyName(values.pad_dleft_key)); lineEdit_dRight->setText(GetKeyName(temp_settings.pad_dright_key));
this->ui.lineEdit_dRight->setText(GInputsDialog::getKeyName(values.pad_dright_key)); lineEdit_sUp->setText(GetKeyName(temp_settings.pad_sup_key));
this->ui.lineEdit_sUp->setText(GInputsDialog::getKeyName(values.pad_sup_key)); lineEdit_sDown->setText(GetKeyName(temp_settings.pad_sdown_key));
this->ui.lineEdit_sDown->setText(GInputsDialog::getKeyName(values.pad_sdown_key)); lineEdit_sLeft->setText(GetKeyName(temp_settings.pad_sleft_key));
this->ui.lineEdit_sLeft->setText(GInputsDialog::getKeyName(values.pad_sleft_key)); lineEdit_sRight->setText(GetKeyName(temp_settings.pad_sright_key));
this->ui.lineEdit_sRight->setText(GInputsDialog::getKeyName(values.pad_sright_key)); lineEdit_cUp->setText(GetKeyName(temp_settings.pad_cup_key));
lineEdit_cDown->setText(GetKeyName(temp_settings.pad_cdown_key));
lineEdit_cLeft->setText(GetKeyName(temp_settings.pad_cleft_key));
lineEdit_cRight->setText(GetKeyName(temp_settings.pad_cright_key));
lineEdit_Home->setText(GetKeyName(temp_settings.pad_home_key));
lineEdit_Start->setText(GetKeyName(temp_settings.pad_start_key));
lineEdit_Select->setText(GetKeyName(temp_settings.pad_select_key));
} }
QString GInputsDialog::getKeyName(int key_code) { QString GInputsDialog::GetKeyName(int key_code) {
if (key_code == Qt::Key_Shift) if (key_code == Qt::Key_Shift)
return tr("Shift"); return tr("Shift");
@ -86,51 +135,66 @@ QString GInputsDialog::getKeyName(int key_code) {
void GInputsDialog::RestoreDefaultSettings() { void GInputsDialog::RestoreDefaultSettings() {
// load the default button settings into temp_settings // load the default button settings into temp_settings
this->temp_settings.pad_a_key = Qt::Key_A; temp_settings.pad_a_key = Qt::Key_A;
this->temp_settings.pad_b_key = Qt::Key_S; temp_settings.pad_b_key = Qt::Key_S;
this->temp_settings.pad_x_key = Qt::Key_Z; temp_settings.pad_x_key = Qt::Key_Z;
this->temp_settings.pad_y_key = Qt::Key_X; temp_settings.pad_y_key = Qt::Key_X;
this->temp_settings.pad_l_key = Qt::Key_Q; temp_settings.pad_l_key = Qt::Key_Q;
this->temp_settings.pad_r_key = Qt::Key_W; temp_settings.pad_r_key = Qt::Key_W;
this->temp_settings.pad_start_key = Qt::Key_M; temp_settings.pad_zl_key = Qt::Key_1;
this->temp_settings.pad_select_key = Qt::Key_N; temp_settings.pad_zr_key = Qt::Key_2;
this->temp_settings.pad_home_key = Qt::Key_B;
this->temp_settings.pad_dup_key = Qt::Key_T; temp_settings.pad_dup_key = Qt::Key_T;
this->temp_settings.pad_ddown_key = Qt::Key_G; temp_settings.pad_ddown_key = Qt::Key_G;
this->temp_settings.pad_dleft_key = Qt::Key_F; temp_settings.pad_dleft_key = Qt::Key_F;
this->temp_settings.pad_dright_key = Qt::Key_H; temp_settings.pad_dright_key = Qt::Key_H;
this->temp_settings.pad_sup_key = Qt::Key_Up; temp_settings.pad_sup_key = Qt::Key_Up;
this->temp_settings.pad_sdown_key = Qt::Key_Down; temp_settings.pad_sdown_key = Qt::Key_Down;
this->temp_settings.pad_sleft_key = Qt::Key_Left; temp_settings.pad_sleft_key = Qt::Key_Left;
this->temp_settings.pad_sright_key = Qt::Key_Right; temp_settings.pad_sright_key = Qt::Key_Right;
temp_settings.pad_cup_key = Qt::Key_I;
temp_settings.pad_cdown_key = Qt::Key_K;
temp_settings.pad_cleft_key = Qt::Key_J;
temp_settings.pad_cright_key = Qt::Key_L;
temp_settings.pad_home_key = Qt::Key_B;
temp_settings.pad_start_key = Qt::Key_M;
temp_settings.pad_select_key = Qt::Key_N;
// then display it // then display it
this->displayButtonSettings(GInputsDialog::temp_settings); UpdateKeyLabels();
} }
void GInputsDialog::SaveSettings() { void GInputsDialog::SaveSettings() {
Config config; Config config;
// load the temporary settings into our real settings // load the temporary settings into our real settings
Settings::values.pad_a_key = this->temp_settings.pad_a_key; Settings::values.pad_a_key = temp_settings.pad_a_key;
Settings::values.pad_b_key = this->temp_settings.pad_b_key; Settings::values.pad_b_key = temp_settings.pad_b_key;
Settings::values.pad_x_key = this->temp_settings.pad_x_key; Settings::values.pad_x_key = temp_settings.pad_x_key;
Settings::values.pad_y_key = this->temp_settings.pad_y_key; Settings::values.pad_y_key = temp_settings.pad_y_key;
Settings::values.pad_l_key = this->temp_settings.pad_l_key; Settings::values.pad_l_key = temp_settings.pad_l_key;
Settings::values.pad_r_key = this->temp_settings.pad_r_key; Settings::values.pad_r_key = temp_settings.pad_r_key;
Settings::values.pad_start_key = this->temp_settings.pad_start_key; Settings::values.pad_zl_key = temp_settings.pad_zl_key;
Settings::values.pad_select_key = this->temp_settings.pad_select_key; Settings::values.pad_zr_key = temp_settings.pad_zr_key;
Settings::values.pad_home_key = this->temp_settings.pad_home_key;
Settings::values.pad_dup_key = this->temp_settings.pad_dup_key; Settings::values.pad_dup_key = temp_settings.pad_dup_key;
Settings::values.pad_ddown_key = this->temp_settings.pad_ddown_key; Settings::values.pad_ddown_key = temp_settings.pad_ddown_key;
Settings::values.pad_dleft_key = this->temp_settings.pad_dleft_key; Settings::values.pad_dleft_key = temp_settings.pad_dleft_key;
Settings::values.pad_dright_key = this->temp_settings.pad_dright_key; Settings::values.pad_dright_key = temp_settings.pad_dright_key;
Settings::values.pad_sup_key = this->temp_settings.pad_sup_key; Settings::values.pad_sup_key = temp_settings.pad_sup_key;
Settings::values.pad_sdown_key = this->temp_settings.pad_sdown_key; Settings::values.pad_sdown_key = temp_settings.pad_sdown_key;
Settings::values.pad_sleft_key = this->temp_settings.pad_sleft_key; Settings::values.pad_sleft_key = temp_settings.pad_sleft_key;
Settings::values.pad_sright_key = this->temp_settings.pad_sright_key; Settings::values.pad_sright_key = temp_settings.pad_sright_key;
Settings::values.pad_cup_key = temp_settings.pad_cup_key;
Settings::values.pad_cdown_key = temp_settings.pad_cdown_key;
Settings::values.pad_cleft_key = temp_settings.pad_cleft_key;
Settings::values.pad_cright_key = temp_settings.pad_cright_key;
Settings::values.pad_home_key = temp_settings.pad_home_key;
Settings::values.pad_start_key = temp_settings.pad_start_key;
Settings::values.pad_select_key = temp_settings.pad_select_key;
// then save it // then save it
config.Save(); config.Save();
LOG_INFO(Config, "Input settings changed.");
} }

View File

@ -4,10 +4,12 @@
#pragma once #pragma once
#include <array>
#include <QDialog> #include <QDialog>
#include "../core/settings.h" #include "../core/settings.h"
#include "ui_inputs.h" #include "QLineEditKeyConfig.h"
/// The input configuration dialog /// The input configuration dialog
class GInputsDialog : public QDialog { class GInputsDialog : public QDialog {
@ -16,17 +18,42 @@ class GInputsDialog : public QDialog {
public: public:
GInputsDialog(QWidget* parent = nullptr); GInputsDialog(QWidget* parent = nullptr);
/// Temporary settings used when configuration is changed but not saved yet /// Given a key code, return the key name. In addition to QKeySequence(key_code).toString(); this will translate modifier keys properly.
Settings::Values temp_settings; static QString GetKeyName(int key_code);
/// Given a key code, return the key name. Needed for modifier keys
static QString getKeyName(int key_code);
private: private:
Ui::inputs ui; QLineEditKeyConfig *lineEdit_A;
QLineEditKeyConfig *lineEdit_B;
QLineEditKeyConfig *lineEdit_X;
QLineEditKeyConfig *lineEdit_Y;
QLineEditKeyConfig *lineEdit_L;
QLineEditKeyConfig *lineEdit_R;
QLineEditKeyConfig *lineEdit_ZL;
QLineEditKeyConfig *lineEdit_ZR;
QLineEditKeyConfig *lineEdit_dUp;
QLineEditKeyConfig *lineEdit_dDown;
QLineEditKeyConfig *lineEdit_dLeft;
QLineEditKeyConfig *lineEdit_dRight;
QLineEditKeyConfig *lineEdit_sUp;
QLineEditKeyConfig *lineEdit_sDown;
QLineEditKeyConfig *lineEdit_sLeft;
QLineEditKeyConfig *lineEdit_sRight;
QLineEditKeyConfig *lineEdit_cUp;
QLineEditKeyConfig *lineEdit_cDown;
QLineEditKeyConfig *lineEdit_cLeft;
QLineEditKeyConfig *lineEdit_cRight;
QLineEditKeyConfig *lineEdit_Start;
QLineEditKeyConfig *lineEdit_Select;
QLineEditKeyConfig *lineEdit_Home;
/// An array of all the lineEdits above for easy iterating though them
std::array<QLineEditKeyConfig*, 23> lineEdits;
/// Display the button settings on the LineEdits from the given values /// Display the button settings on the LineEdits from the given values
void displayButtonSettings(const Settings::Values& values); void UpdateKeyLabels();
/// Temporary settings used when configuration is changed but not saved yet
Settings::Values temp_settings;
private slots: private slots:
void SaveSettings(); void SaveSettings();

View File

@ -1,585 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>inputs</class>
<widget class="QDialog" name="inputs">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>512</width>
<height>402</height>
</rect>
</property>
<property name="windowTitle">
<string>Input Settings</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>10</x>
<y>360</y>
<width>491</width>
<height>23</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>241</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>Circle Pad</string>
</property>
<widget class="QLineEditKeyConfig" name="lineEdit_sRight">
<property name="geometry">
<rect>
<x>160</x>
<y>40</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_sLeft">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>29</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Left</string>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_sDown">
<property name="geometry">
<rect>
<x>110</x>
<y>70</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_sLeft">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_sDown">
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>37</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Down</string>
</property>
</widget>
<widget class="QLabel" name="label_sRight">
<property name="geometry">
<rect>
<x>127</x>
<y>40</y>
<width>35</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Right</string>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_sUp">
<property name="geometry">
<rect>
<x>110</x>
<y>10</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_sUp">
<property name="geometry">
<rect>
<x>80</x>
<y>10</y>
<width>23</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Up</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>241</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>D-Pad</string>
</property>
<widget class="QLineEditKeyConfig" name="lineEdit_dDown">
<property name="geometry">
<rect>
<x>110</x>
<y>70</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_dLeft">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_dUp">
<property name="geometry">
<rect>
<x>80</x>
<y>10</y>
<width>24</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Up</string>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_dRight">
<property name="geometry">
<rect>
<x>160</x>
<y>40</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_dDown">
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>38</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Down</string>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_dUp">
<property name="geometry">
<rect>
<x>110</x>
<y>10</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_dLeft">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>30</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Left</string>
</property>
</widget>
<widget class="QLabel" name="label_dRight">
<property name="geometry">
<rect>
<x>130</x>
<y>40</y>
<width>36</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Right</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>260</x>
<y>70</y>
<width>241</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>Main Buttons</string>
</property>
<widget class="QLineEditKeyConfig" name="lineEdit_B">
<property name="geometry">
<rect>
<x>90</x>
<y>70</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_Y">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_Y">
<property name="geometry">
<rect>
<x>7</x>
<y>40</y>
<width>16</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Y</string>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_A">
<property name="geometry">
<rect>
<x>140</x>
<y>40</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_B">
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>16</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>B</string>
</property>
</widget>
<widget class="QLabel" name="label_X">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>16</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
<widget class="QLabel" name="label_A">
<property name="geometry">
<rect>
<x>120</x>
<y>40</y>
<width>16</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>A</string>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_X">
<property name="geometry">
<rect>
<x>90</x>
<y>10</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_4">
<property name="geometry">
<rect>
<x>10</x>
<y>290</y>
<width>491</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>Other Buttons</string>
</property>
<widget class="QLineEditKeyConfig" name="lineEdit_Start">
<property name="geometry">
<rect>
<x>360</x>
<y>20</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_Start">
<property name="geometry">
<rect>
<x>330</x>
<y>20</y>
<width>24</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Start</string>
</property>
</widget>
<widget class="QLabel" name="label_Select">
<property name="geometry">
<rect>
<x>47</x>
<y>20</y>
<width>29</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Select</string>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_Select">
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_Home">
<property name="geometry">
<rect>
<x>230</x>
<y>20</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_Home">
<property name="geometry">
<rect>
<x>186</x>
<y>20</y>
<width>27</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Home</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_5">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>491</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>Bumpers</string>
</property>
<widget class="QLineEditKeyConfig" name="lineEdit_R">
<property name="geometry">
<rect>
<x>340</x>
<y>20</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEditKeyConfig" name="lineEdit_L">
<property name="geometry">
<rect>
<x>110</x>
<y>20</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_R">
<property name="geometry">
<rect>
<x>310</x>
<y>20</y>
<width>16</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>R</string>
</property>
</widget>
<widget class="QLabel" name="label_L">
<property name="geometry">
<rect>
<x>86</x>
<y>20</y>
<width>16</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>L</string>
</property>
</widget>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>QLineEditKeyConfig</class>
<extends>QLineEdit</extends>
<header>config/QLineEditKeyConfig.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>inputs</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>inputs</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -159,6 +159,11 @@
<string>Configure ...</string> <string>Configure ...</string>
</property> </property>
</action> </action>
<action name="action_Inputs">
<property name="text">
<string>Configure &amp;Controls</string>
</property>
</action>
<action name="actionDisplay_widget_title_bars"> <action name="actionDisplay_widget_title_bars">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
@ -167,11 +172,6 @@
<string>Display Dock Widget Headers</string> <string>Display Dock Widget Headers</string>
</property> </property>
</action> </action>
<action name="action_Inputs">
<property name="text">
<string>Configure &amp;Inputs</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>