Qt: Fix Apply button for key and controller configurations
Jeffrey Pfau jeffrey@endrift.com
Tue, 20 Dec 2016 21:20:52 -0800
3 files changed,
17 insertions(+),
10 deletions(-)
M
CHANGES
→
CHANGES
@@ -38,6 +38,7 @@ - GBA Video: Fix out of bounds sprite transforms
- 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
M
src/platform/qt/GBAKeyEditor.h
→
src/platform/qt/GBAKeyEditor.h
@@ -32,6 +32,7 @@ virtual ~GBAKeyEditor();
public slots: void setAll(); + void save(); protected: virtual void resizeEvent(QResizeEvent*) override;@@ -42,7 +43,6 @@ virtual bool eventFilter(QObject* obj, QEvent* event) override;
private slots: void setNext(); - void save(); void refresh(); #ifdef BUILD_SDL void setAxisValue(int axis, int32_t value);
M
src/platform/qt/SettingsView.cpp
→
src/platform/qt/SettingsView.cpp
@@ -130,26 +130,32 @@ }
#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);