Qt: Add refresh button to controller editing
Jeffrey Pfau jeffrey@endrift.com
Mon, 30 May 2016 15:26:54 -0700
3 files changed,
24 insertions(+),
11 deletions(-)
M
CHANGES
→
CHANGES
@@ -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.cpp
→
src/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.h
→
src/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: