mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix keys being mapped incorrectly when loading configuration file (fixes #212)
This commit is contained in:
parent
3a134fcda6
commit
181174c810
1
CHANGES
1
CHANGES
|
@ -34,6 +34,7 @@ Bugfixes:
|
|||
- Qt: Fix some potential crashes with the gamepad mapping
|
||||
- Debugger: Fix watchpoints in gdb
|
||||
- ARM7: Fix decoding of some ARM ALU instructions with shifters
|
||||
- Qt: Fix keys being mapped incorrectly when loading configuration file
|
||||
Misc:
|
||||
- Qt: Window size command line options are now supported
|
||||
- Qt: Increase usability of key mapper
|
||||
|
|
|
@ -137,10 +137,13 @@ void ShortcutController::addFunctions(QMenu* menu, std::function<void()> press,
|
|||
smenu->addFunctions(qMakePair(press, release), shortcut, visibleName, name);
|
||||
endInsertRows();
|
||||
ShortcutItem* item = &smenu->items().last();
|
||||
bool loadedShortcut = false;
|
||||
if (m_config) {
|
||||
loadShortcuts(item);
|
||||
loadedShortcut = loadShortcuts(item);
|
||||
}
|
||||
if (!loadedShortcut && !m_heldKeys.contains(shortcut)) {
|
||||
m_heldKeys[shortcut] = item;
|
||||
}
|
||||
m_heldKeys[shortcut] = item;
|
||||
emit dataChanged(createIndex(smenu->items().count() - 1, 0, item),
|
||||
createIndex(smenu->items().count() - 1, 2, item));
|
||||
}
|
||||
|
@ -387,10 +390,11 @@ bool ShortcutController::eventFilter(QObject*, QEvent* event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ShortcutController::loadShortcuts(ShortcutItem* item) {
|
||||
bool ShortcutController::loadShortcuts(ShortcutItem* item) {
|
||||
if (item->name().isNull()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
loadGamepadShortcuts(item);
|
||||
QVariant shortcut = m_config->getQtOption(item->name(), KEY_SECTION);
|
||||
if (!shortcut.isNull()) {
|
||||
if (shortcut.toString().endsWith("+")) {
|
||||
|
@ -398,8 +402,9 @@ void ShortcutController::loadShortcuts(ShortcutItem* item) {
|
|||
} else {
|
||||
updateKey(item, QKeySequence(shortcut.toString())[0]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
loadGamepadShortcuts(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
void ShortcutController::loadGamepadShortcuts(ShortcutItem* item) {
|
||||
|
|
|
@ -128,7 +128,7 @@ protected:
|
|||
private:
|
||||
ShortcutItem* itemAt(const QModelIndex& index);
|
||||
const ShortcutItem* itemAt(const QModelIndex& index) const;
|
||||
void loadShortcuts(ShortcutItem*);
|
||||
bool loadShortcuts(ShortcutItem*);
|
||||
void loadGamepadShortcuts(ShortcutItem*);
|
||||
void onSubitems(ShortcutItem*, std::function<void(ShortcutItem*)> func);
|
||||
void updateKey(ShortcutItem* item, int keySequence);
|
||||
|
|
Loading…
Reference in New Issue