all repos — mgba @ 556a18a0d95e11d2ea4b7270410e0a1e7b37ce9d

mGBA Game Boy Advance Emulator

Qt: Add refresh button to controller editing
Jeffrey Pfau jeffrey@endrift.com
Mon, 30 May 2016 15:26:54 -0700
commit

556a18a0d95e11d2ea4b7270410e0a1e7b37ce9d

parent

2c5c27f8844355a52b5f75ff55447f5f7e963ef7

3 files changed, 24 insertions(+), 11 deletions(-)

jump to
M CHANGESCHANGES

@@ -33,6 +33,7 @@ - All: Allow use of external minizip library

- GBA Video: Null renderer should return proper register values - Libretro: Disable logging game errors, BIOS calls and stubs in release builds - Qt: Canonicalize file paths when loading games + - Qt: Add refresh button to controller editing 0.4.0: (2016-02-02) Features:
M src/platform/qt/GBAKeyEditor.cppsrc/platform/qt/GBAKeyEditor.cpp

@@ -57,19 +57,10 @@ refresh();

#ifdef BUILD_SDL if (type == SDL_BINDING_BUTTON) { - controller->updateJoysticks(); - controller->recalibrateAxes(); - lookupAxes(map); - m_profileSelect = new QComboBox(this); - m_profileSelect->addItems(controller->connectedGamepads(type)); - int activeGamepad = controller->gamepad(type); - selectGamepad(activeGamepad); - if (activeGamepad > 0) { - m_profileSelect->setCurrentIndex(activeGamepad); - } + connect(m_profileSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(selectGamepad(int))); - connect(m_profileSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(selectGamepad(int))); + updateJoysticks(); m_clear = new QWidget(this); QHBoxLayout* layout = new QHBoxLayout;

@@ -97,6 +88,10 @@ bool signalsBlocked = (*m_currentKey)->blockSignals(true);

(*m_currentKey)->clearAxis(); (*m_currentKey)->blockSignals(signalsBlocked); }); + + QPushButton* updateJoysticksButton = new QPushButton(tr("Refresh")); + layout->addWidget(updateJoysticksButton); + connect(updateJoysticksButton, SIGNAL(pressed()), this, SLOT(updateJoysticks())); } #endif

@@ -355,3 +350,19 @@ QSize hint = widget->sizeHint();

widget->setGeometry(s.width() * x - hint.width() / 2.0, s.height() * y - hint.height() / 2.0, hint.width(), hint.height()); } + +#ifdef BUILD_SDL +void GBAKeyEditor::updateJoysticks() { + m_controller->updateJoysticks(); + m_controller->recalibrateAxes(); + + m_profileSelect->clear(); + m_profileSelect->addItems(m_controller->connectedGamepads(m_type)); + int activeGamepad = m_controller->gamepad(m_type); + selectGamepad(activeGamepad); + if (activeGamepad > 0) { + m_profileSelect->setCurrentIndex(activeGamepad); + } + lookupAxes(m_controller->map()); +} +#endif
M src/platform/qt/GBAKeyEditor.hsrc/platform/qt/GBAKeyEditor.h

@@ -47,6 +47,7 @@ void refresh();

#ifdef BUILD_SDL void setAxisValue(int axis, int32_t value); void selectGamepad(int index); + void updateJoysticks(); #endif private: