Preliminary controller support

This commit is contained in:
SimoneN64
2024-05-17 23:19:15 +02:00
parent 87f9546ed3
commit 2ebda70a8c
4 changed files with 122 additions and 15 deletions

View File

@@ -62,8 +62,8 @@ InputSettings::InputSettings(nlohmann::json& settings) : settings(settings), QWi
for (int i = 0; i < 18; i++) {
connect(kb_buttons[i], &QPushButton::pressed, this, [&, i]() {
for (int i = 0; i < 18; i++) {
kb_buttons[i]->setEnabled(false);
for (auto kb_button : kb_buttons) {
kb_button->setEnabled(false);
}
grabKeyboard();
grabbing = true;
@@ -71,16 +71,16 @@ InputSettings::InputSettings(nlohmann::json& settings) : settings(settings), QWi
});
}
QHBoxLayout* AB = new QHBoxLayout;
QHBoxLayout* ZStart = new QHBoxLayout;
QHBoxLayout* LR = new QHBoxLayout;
QHBoxLayout* DupDdown = new QHBoxLayout;
QHBoxLayout* DleftDright = new QHBoxLayout;
QHBoxLayout* CupCdown = new QHBoxLayout;
QHBoxLayout* CleftCright = new QHBoxLayout;
QHBoxLayout* AupAdown = new QHBoxLayout;
QHBoxLayout* AleftAright = new QHBoxLayout;
QVBoxLayout* mainLayout = new QVBoxLayout;
auto AB = new QHBoxLayout;
auto ZStart = new QHBoxLayout;
auto LR = new QHBoxLayout;
auto DupDdown = new QHBoxLayout;
auto DleftDright = new QHBoxLayout;
auto CupCdown = new QHBoxLayout;
auto CleftCright = new QHBoxLayout;
auto AupAdown = new QHBoxLayout;
auto AleftAright = new QHBoxLayout;
auto mainLayout = new QVBoxLayout;
AB->addWidget(n64_button_labels[0]);
AB->addWidget(kb_buttons[0]);
@@ -139,8 +139,8 @@ void InputSettings::keyPressEvent(QKeyEvent* e) {
kb_buttons[which_grabbing]->setText(k);
grabbing = false;
which_grabbing = -1;
for (int i = 0; i < 18; i++) {
kb_buttons[i]->setEnabled(true);
for (auto kb_button : kb_buttons) {
kb_button->setEnabled(true);
}
releaseKeyboard();
emit modified();