all repos — mgba @ 24b1fb7b30fba98e624b26c4d7e63bcbea376525

mGBA Game Boy Advance Emulator

Qt: Fix some button binding bugs
Jeffrey Pfau jeffrey@endrift.com
Sun, 31 May 2015 13:38:40 -0700
commit

24b1fb7b30fba98e624b26c4d7e63bcbea376525

parent

67e13114ef407dfe6a7cc27fc88ddcf4301a6859

2 files changed, 6 insertions(+), 2 deletions(-)

jump to
M src/platform/qt/ShortcutController.cppsrc/platform/qt/ShortcutController.cpp

@@ -224,11 +224,11 @@ return;

} ShortcutItem* item = itemAt(index); int oldButton = item->button(); - item->setButton(button); if (oldButton >= 0) { m_buttons.take(oldButton); } updateAxis(index, -1, GamepadAxisEvent::NEUTRAL); + item->setButton(button); if (button >= 0) { m_buttons[button] = item; }

@@ -249,7 +249,6 @@ }

ShortcutItem* item = itemAt(index); int oldAxis = item->axis(); GamepadAxisEvent::Direction oldDirection = item->direction(); - item->setAxis(axis, direction); if (oldAxis >= 0) { m_axes.take(qMakePair(oldAxis, oldDirection)); }

@@ -257,6 +256,7 @@ if (axis >= 0 && direction != GamepadAxisEvent::NEUTRAL) {

updateButton(index, -1); m_axes[qMakePair(axis, direction)] = item; } + item->setAxis(axis, direction); if (m_config) { char d = '\0'; if (direction == GamepadAxisEvent::POSITIVE) {
M src/platform/qt/ShortcutView.cppsrc/platform/qt/ShortcutView.cpp

@@ -61,11 +61,15 @@ } else if (index.column() == 2) {

m_ui.gamepadButton->click(); } if (m_ui.gamepadButton->isChecked()) { + bool blockSignals = m_ui.keyEdit->blockSignals(true); m_ui.keyEdit->setFocus(); m_ui.keyEdit->setValueButton(-1); // There are no default bindings + m_ui.keyEdit->blockSignals(blockSignals); } else { + bool blockSignals = m_ui.keySequenceEdit->blockSignals(true); m_ui.keySequenceEdit->setFocus(); m_ui.keySequenceEdit->setKeySequence(sequence); + m_ui.keySequenceEdit->blockSignals(blockSignals); } }