mirror of https://github.com/PCSX2/pcsx2.git
fix for formatting
This commit is contained in:
parent
0d37ea42f9
commit
f8f8049fd3
|
@ -13,29 +13,51 @@
|
||||||
|
|
||||||
#include <QtGui/QKeyEvent>
|
#include <QtGui/QKeyEvent>
|
||||||
|
|
||||||
uint8_t map_text_to_keycode(const QString& text) {
|
uint8_t map_text_to_keycode(const QString& text)
|
||||||
if (text == "!") return Qt::Key_1;
|
{
|
||||||
if (text == "@") return Qt::Key_2;
|
if (text == "!")
|
||||||
if (text == "#") return Qt::Key_3;
|
return Qt::Key_1;
|
||||||
if (text == "$") return Qt::Key_4;
|
if (text == "@")
|
||||||
if (text == "%") return Qt::Key_5;
|
return Qt::Key_2;
|
||||||
if (text == "^") return Qt::Key_6;
|
if (text == "#")
|
||||||
if (text == "&") return Qt::Key_7;
|
return Qt::Key_3;
|
||||||
if (text == "*") return Qt::Key_8;
|
if (text == "$")
|
||||||
if (text == "(") return Qt::Key_9;
|
return Qt::Key_4;
|
||||||
if (text == ")") return Qt::Key_0;
|
if (text == "%")
|
||||||
if (text == "_") return Qt::Key_Minus;
|
return Qt::Key_5;
|
||||||
if (text == "+") return Qt::Key_Equal;
|
if (text == "^")
|
||||||
if (text == "?") return Qt::Key_Slash;
|
return Qt::Key_6;
|
||||||
if (text == ":") return Qt::Key_Semicolon;
|
if (text == "&")
|
||||||
if (text == "\"") return Qt::Key_Apostrophe;
|
return Qt::Key_7;
|
||||||
if (text == "~") return Qt::Key_QuoteLeft;
|
if (text == "*")
|
||||||
if (text == "<") return Qt::Key_Comma;
|
return Qt::Key_8;
|
||||||
if (text == ">") return Qt::Key_Period;
|
if (text == "(")
|
||||||
if (text == "|") return Qt::Key_Backslash;
|
return Qt::Key_9;
|
||||||
if (text == "{") return Qt::Key_BracketLeft;
|
if (text == ")")
|
||||||
if (text == "}") return Qt::Key_BracketRight;
|
return Qt::Key_0;
|
||||||
return 0; // No remapping
|
if (text == "_")
|
||||||
|
return Qt::Key_Minus;
|
||||||
|
if (text == "+")
|
||||||
|
return Qt::Key_Equal;
|
||||||
|
if (text == "?")
|
||||||
|
return Qt::Key_Slash;
|
||||||
|
if (text == ":")
|
||||||
|
return Qt::Key_Semicolon;
|
||||||
|
if (text == "\"")
|
||||||
|
return Qt::Key_Apostrophe;
|
||||||
|
if (text == "~")
|
||||||
|
return Qt::Key_QuoteLeft;
|
||||||
|
if (text == "<")
|
||||||
|
return Qt::Key_Comma;
|
||||||
|
if (text == ">")
|
||||||
|
return Qt::Key_Period;
|
||||||
|
if (text == "|")
|
||||||
|
return Qt::Key_Backslash;
|
||||||
|
if (text == "{")
|
||||||
|
return Qt::Key_BracketLeft;
|
||||||
|
if (text == "}")
|
||||||
|
return Qt::Key_BracketRight;
|
||||||
|
return 0; // No remapping
|
||||||
}
|
}
|
||||||
|
|
||||||
struct KeyCodeName
|
struct KeyCodeName
|
||||||
|
@ -542,16 +564,18 @@ const char* InputManager::ConvertHostKeyboardCodeToIcon(u32 code)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 QtUtils::KeyEventToCode(const QKeyEvent* ev) {
|
u32 QtUtils::KeyEventToCode(const QKeyEvent* ev)
|
||||||
QString text = ev->text();
|
{
|
||||||
uint8_t keycode = map_text_to_keycode(text); // Map special text symbols to keycodes
|
QString text = ev->text();
|
||||||
int key = ev->key();
|
uint8_t keycode = map_text_to_keycode(text); // Map special text symbols to keycodes
|
||||||
|
int key = ev->key();
|
||||||
|
|
||||||
if (keycode != 0) {
|
if (keycode != 0)
|
||||||
key = keycode; // Override key if mapped
|
{
|
||||||
}
|
key = keycode; // Override key if mapped
|
||||||
|
}
|
||||||
|
|
||||||
Qt::KeyboardModifiers modifiers = ev->modifiers();
|
Qt::KeyboardModifiers modifiers = ev->modifiers();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// On macOS, Qt applies the Keypad modifier regardless of whether the arrow keys, or numpad was pressed.
|
// On macOS, Qt applies the Keypad modifier regardless of whether the arrow keys, or numpad was pressed.
|
||||||
|
@ -567,5 +591,5 @@ u32 QtUtils::KeyEventToCode(const QKeyEvent* ev) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return static_cast<u32>(key) | (static_cast<u32>(modifiers) & static_cast<u32>(Qt::KeypadModifier));
|
return static_cast<u32>(key) | (static_cast<u32>(modifiers) & static_cast<u32>(Qt::KeypadModifier));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue