diff --git a/CHANGES b/CHANGES index cb395fece..bb1824606 100644 --- a/CHANGES +++ b/CHANGES @@ -38,6 +38,7 @@ Bugfixes: - GB: Fix crash when masking savedata - GB Audio: Fix serialization of channel 3 and NR52 properties - GB: Properly initialize sramRealVf variable + - Qt: Fix Apply button for key and controller configurations Misc: - SDL: Remove scancode key input - GBA Video: Clean up unused timers diff --git a/src/platform/qt/GBAKeyEditor.h b/src/platform/qt/GBAKeyEditor.h index e609cf164..bbd839063 100644 --- a/src/platform/qt/GBAKeyEditor.h +++ b/src/platform/qt/GBAKeyEditor.h @@ -32,6 +32,7 @@ public: public slots: void setAll(); + void save(); protected: virtual void resizeEvent(QResizeEvent*) override; @@ -42,7 +43,6 @@ protected: private slots: void setNext(); - void save(); void refresh(); #ifdef BUILD_SDL void setAxisValue(int axis, int32_t value); diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index 53c1d912e..8302ddb34 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -130,27 +130,33 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC #endif connect(m_ui.biosBrowse, SIGNAL(clicked()), this, SLOT(selectBios())); - connect(m_ui.buttonBox, SIGNAL(accepted()), this, SLOT(updateConfig())); - connect(m_ui.buttonBox, &QDialogButtonBox::clicked, [this](QAbstractButton* button) { - if (m_ui.buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) { - updateConfig(); - } - }); GBAKeyEditor* editor = new GBAKeyEditor(inputController, InputController::KEYBOARD, QString(), this); m_ui.stackedWidget->addWidget(editor); m_ui.tabs->addItem("Keyboard"); connect(m_ui.buttonBox, SIGNAL(accepted()), editor, SLOT(save())); + GBAKeyEditor* buttonEditor = nullptr; #ifdef BUILD_SDL inputController->recalibrateAxes(); const char* profile = inputController->profileForType(SDL_BINDING_BUTTON); - editor = new GBAKeyEditor(inputController, SDL_BINDING_BUTTON, profile); - m_ui.stackedWidget->addWidget(editor); + buttonEditor = new GBAKeyEditor(inputController, SDL_BINDING_BUTTON, profile); + m_ui.stackedWidget->addWidget(buttonEditor); m_ui.tabs->addItem("Controllers"); - connect(m_ui.buttonBox, SIGNAL(accepted()), editor, SLOT(save())); + connect(m_ui.buttonBox, SIGNAL(accepted()), buttonEditor, SLOT(save())); #endif + connect(m_ui.buttonBox, SIGNAL(accepted()), this, SLOT(updateConfig())); + connect(m_ui.buttonBox, &QDialogButtonBox::clicked, [this, editor, buttonEditor](QAbstractButton* button) { + if (m_ui.buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) { + updateConfig(); + editor->save(); + if (buttonEditor) { + buttonEditor->save(); + } + } + }); + ShortcutView* shortcutView = new ShortcutView(); shortcutView->setController(shortcutController); shortcutView->setInputController(inputController);