diff options
Diffstat (limited to 'logic/win32-shortcuts.cpp')
-rw-r--r-- | logic/win32-shortcuts.cpp | 244 |
1 files changed, 123 insertions, 121 deletions
diff --git a/logic/win32-shortcuts.cpp b/logic/win32-shortcuts.cpp index 114bb46d..af50b949 100644 --- a/logic/win32-shortcuts.cpp +++ b/logic/win32-shortcuts.cpp @@ -18,130 +18,132 @@ #include <QDebug> QList<win_key> windows_key_mods = - QList<win_key>({ - win_key(DIK_LCONTROL, Qt::Key::Key_Control), - win_key(DIK_RCONTROL, Qt::Key::Key_Control), - win_key(DIK_LALT, Qt::Key::Key_Alt), - win_key(DIK_RALT, Qt::Key::Key_Alt), - win_key(DIK_LSHIFT, Qt::Key::Key_Shift), - win_key(DIK_RSHIFT, Qt::Key::Key_Shift), - win_key(DIK_LWIN, Qt::Key::Key_unknown), - win_key(DIK_RWIN, Qt::Key::Key_unknown) - }); + QList<win_key>{ + {DIK_LCONTROL, Qt::Key_Control}, + {DIK_RCONTROL, Qt::Key_Control}, + {DIK_LALT, Qt::Key_Alt}, + {DIK_RALT, Qt::Key_Alt}, + {DIK_LSHIFT, Qt::Key_Shift}, + {DIK_RSHIFT, Qt::Key_Shift}, + {DIK_LWIN, Qt::Key_Super_L}, + {DIK_RWIN, Qt::Key_Super_R}, + }; QList<win_key> windows_key_sequences = - QList<win_key>({ - win_key(DIK_F1, Qt::Key::Key_F1 ), - win_key(DIK_F2, Qt::Key::Key_F2 ), - win_key(DIK_F3, Qt::Key::Key_F3 ), - win_key(DIK_F4, Qt::Key::Key_F4 ), - win_key(DIK_F5, Qt::Key::Key_F5 ), - win_key(DIK_F6, Qt::Key::Key_F6 ), - win_key(DIK_F7, Qt::Key::Key_F7 ), - win_key(DIK_F8, Qt::Key::Key_F8 ), - win_key(DIK_F9, Qt::Key::Key_F9 ), - win_key(DIK_F10, Qt::Key::Key_F10 ), - win_key(DIK_F11, Qt::Key::Key_F11 ), - win_key(DIK_F12, Qt::Key::Key_F12 ), - win_key(DIK_LEFT, Qt::Key::Key_Left ), - win_key(DIK_RIGHT, Qt::Key::Key_Right ), - win_key(DIK_UP, Qt::Key::Key_Up ), - win_key(DIK_DOWN, Qt::Key::Key_Down ), - win_key(DIK_PRIOR, Qt::Key::Key_PageUp ), - win_key(DIK_NEXT, Qt::Key::Key_PageDown ), - win_key(DIK_HOME, Qt::Key::Key_Home ), - win_key(DIK_END, Qt::Key::Key_End ), - win_key(DIK_BACK, Qt::Key::Key_Backspace ), - win_key(DIK_COMMA, Qt::Key::Key_Comma ), - win_key(DIK_PERIOD, Qt::Key::Key_Period ), - win_key(DIK_LBRACKET, Qt::Key::Key_BracketLeft ), - win_key(DIK_RBRACKET, Qt::Key::Key_BracketRight ), - win_key(DIK_SEMICOLON, Qt::Key::Key_Semicolon ), - win_key(DIK_SLASH, Qt::Key::Key_Slash ), - win_key(DIK_BACKSLASH, Qt::Key::Key_Backslash ), - win_key(DIK_BACKSPACE, Qt::Key::Key_Backspace ), - win_key(DIK_APOSTROPHE, Qt::Key::Key_Apostrophe ), - win_key(DIK_GRAVE, Qt::Key::Key_QuoteLeft ), - win_key(DIK_MINUS, Qt::Key::Key_Minus ), - win_key(DIK_EQUALS, Qt::Key::Key_Equal ), - win_key(DIK_PERIOD, Qt::Key::Key_Period ), - win_key(DIK_F1, Qt::Key::Key_F1 ), - win_key(DIK_F2, Qt::Key::Key_F2 ), - win_key(DIK_F3, Qt::Key::Key_F3 ), - win_key(DIK_F4, Qt::Key::Key_F4 ), - win_key(DIK_F5, Qt::Key::Key_F5 ), - win_key(DIK_F6, Qt::Key::Key_F6 ), - win_key(DIK_F7, Qt::Key::Key_F7 ), - win_key(DIK_F8, Qt::Key::Key_F8 ), - win_key(DIK_F9, Qt::Key::Key_F9 ), - win_key(DIK_F10, Qt::Key::Key_F10 ), - win_key(DIK_F11, Qt::Key::Key_F11 ), - win_key(DIK_F12, Qt::Key::Key_F12 ), - win_key(DIK_0, Qt::Key::Key_0 ), - win_key(DIK_1, Qt::Key::Key_1 ), - win_key(DIK_2, Qt::Key::Key_2 ), - win_key(DIK_3, Qt::Key::Key_3 ), - win_key(DIK_4, Qt::Key::Key_4 ), - win_key(DIK_5, Qt::Key::Key_5 ), - win_key(DIK_6, Qt::Key::Key_6 ), - win_key(DIK_7, Qt::Key::Key_7 ), - win_key(DIK_8, Qt::Key::Key_8 ), - win_key(DIK_9, Qt::Key::Key_9 ), - win_key(DIK_A, Qt::Key::Key_A ), - win_key(DIK_B, Qt::Key::Key_B ), - win_key(DIK_C, Qt::Key::Key_C ), - win_key(DIK_D, Qt::Key::Key_D ), - win_key(DIK_E, Qt::Key::Key_E ), - win_key(DIK_F, Qt::Key::Key_F ), - win_key(DIK_G, Qt::Key::Key_G ), - win_key(DIK_H, Qt::Key::Key_H ), - win_key(DIK_I, Qt::Key::Key_I ), - win_key(DIK_J, Qt::Key::Key_J ), - win_key(DIK_K, Qt::Key::Key_K ), - win_key(DIK_L, Qt::Key::Key_L ), - win_key(DIK_M, Qt::Key::Key_M ), - win_key(DIK_N, Qt::Key::Key_N ), - win_key(DIK_O, Qt::Key::Key_O ), - win_key(DIK_P, Qt::Key::Key_P ), - win_key(DIK_Q, Qt::Key::Key_Q ), - win_key(DIK_R, Qt::Key::Key_R ), - win_key(DIK_S, Qt::Key::Key_S ), - win_key(DIK_T, Qt::Key::Key_T ), - win_key(DIK_U, Qt::Key::Key_U ), - win_key(DIK_V, Qt::Key::Key_V ), - win_key(DIK_W, Qt::Key::Key_W ), - win_key(DIK_X, Qt::Key::Key_X ), - win_key(DIK_Y, Qt::Key::Key_Y ), - win_key(DIK_Z, Qt::Key::Key_Z ), - win_key(DIK_RETURN, Qt::Key::Key_Return), - win_key(DIK_INSERT, Qt::Key::Key_Insert), - win_key(DIK_DELETE, Qt::Key::Key_Delete), - win_key(DIK_SPACE, Qt::Key::Key_Space), - win_key(DIK_SYSRQ, Qt::Key::Key_Print), - win_key(DIK_SCROLL, Qt::Key::Key_ScrollLock), - win_key(DIK_PAUSE, Qt::Key::Key_Pause), - win_key(DIK_NUMLOCK, Qt::Key::Key_NumLock), + QList<win_key>{ + {DIK_F1, Qt::Key_F1 }, + {DIK_F2, Qt::Key_F2 }, + {DIK_F3, Qt::Key_F3 }, + {DIK_F4, Qt::Key_F4 }, + {DIK_F5, Qt::Key_F5 }, + {DIK_F6, Qt::Key_F6 }, + {DIK_F7, Qt::Key_F7 }, + {DIK_F8, Qt::Key_F8 }, + {DIK_F9, Qt::Key_F9 }, + {DIK_F10, Qt::Key_F10 }, + {DIK_F11, Qt::Key_F11 }, + {DIK_F12, Qt::Key_F12 }, + {DIK_LEFT, Qt::Key_Left }, + {DIK_RIGHT, Qt::Key_Right }, + {DIK_UP, Qt::Key_Up }, + {DIK_DOWN, Qt::Key_Down }, + {DIK_PRIOR, Qt::Key_PageUp }, + {DIK_NEXT, Qt::Key_PageDown }, + {DIK_HOME, Qt::Key_Home }, + {DIK_END, Qt::Key_End }, + {DIK_BACK, Qt::Key_Backspace }, + {DIK_COMMA, Qt::Key_Comma }, + {DIK_PERIOD, Qt::Key_Period }, + {DIK_LBRACKET, Qt::Key_BracketLeft }, + {DIK_RBRACKET, Qt::Key_BracketRight }, + {DIK_SEMICOLON, Qt::Key_Semicolon }, + {DIK_SLASH, Qt::Key_Slash }, + {DIK_BACKSLASH, Qt::Key_Backslash }, + {DIK_BACKSPACE, Qt::Key_Backspace }, + {DIK_APOSTROPHE, Qt::Key_Apostrophe }, + {DIK_GRAVE, Qt::Key_QuoteLeft }, + {DIK_MINUS, Qt::Key_Minus }, + {DIK_EQUALS, Qt::Key_Equal }, + {DIK_PERIOD, Qt::Key_Period }, + {DIK_F1, Qt::Key_F1 }, + {DIK_F2, Qt::Key_F2 }, + {DIK_F3, Qt::Key_F3 }, + {DIK_F4, Qt::Key_F4 }, + {DIK_F5, Qt::Key_F5 }, + {DIK_F6, Qt::Key_F6 }, + {DIK_F7, Qt::Key_F7 }, + {DIK_F8, Qt::Key_F8 }, + {DIK_F9, Qt::Key_F9 }, + {DIK_F10, Qt::Key_F10 }, + {DIK_F11, Qt::Key_F11 }, + {DIK_F12, Qt::Key_F12 }, + {DIK_0, Qt::Key_0 }, + {DIK_1, Qt::Key_1 }, + {DIK_2, Qt::Key_2 }, + {DIK_3, Qt::Key_3 }, + {DIK_4, Qt::Key_4 }, + {DIK_5, Qt::Key_5 }, + {DIK_6, Qt::Key_6 }, + {DIK_7, Qt::Key_7 }, + {DIK_8, Qt::Key_8 }, + {DIK_9, Qt::Key_9 }, + {DIK_A, Qt::Key_A }, + {DIK_B, Qt::Key_B }, + {DIK_C, Qt::Key_C }, + {DIK_D, Qt::Key_D }, + {DIK_E, Qt::Key_E }, + {DIK_F, Qt::Key_F }, + {DIK_G, Qt::Key_G }, + {DIK_H, Qt::Key_H }, + {DIK_I, Qt::Key_I }, + {DIK_J, Qt::Key_J }, + {DIK_K, Qt::Key_K }, + {DIK_L, Qt::Key_L }, + {DIK_M, Qt::Key_M }, + {DIK_N, Qt::Key_N }, + {DIK_O, Qt::Key_O }, + {DIK_P, Qt::Key_P }, + {DIK_Q, Qt::Key_Q }, + {DIK_R, Qt::Key_R }, + {DIK_S, Qt::Key_S }, + {DIK_T, Qt::Key_T }, + {DIK_U, Qt::Key_U }, + {DIK_V, Qt::Key_V }, + {DIK_W, Qt::Key_W }, + {DIK_X, Qt::Key_X }, + {DIK_Y, Qt::Key_Y }, + {DIK_Z, Qt::Key_Z }, + {DIK_TAB, Qt::Key_Tab }, + {DIK_RETURN, Qt::Key_Return}, + {DIK_INSERT, Qt::Key_Insert}, + {DIK_DELETE, Qt::Key_Delete}, + {DIK_SPACE, Qt::Key_Space}, + {DIK_SYSRQ, Qt::Key_Print}, + {DIK_SCROLL, Qt::Key_ScrollLock}, + {DIK_PAUSE, Qt::Key_Pause}, + {DIK_NUMLOCK, Qt::Key_NumLock}, + {DIK_CAPSLOCK, Qt::Key_CapsLock}, #define mod(x, y) static_cast<Qt::Key>(x | y) - win_key(DIK_NUMPAD0, mod(Qt::Key::Key_0, Qt::KeypadModifier)), - win_key(DIK_NUMPAD0, mod(Qt::Key::Key_0, Qt::KeypadModifier)), - win_key(DIK_NUMPAD1, mod(Qt::Key::Key_1, Qt::KeypadModifier)), - win_key(DIK_NUMPAD2, mod(Qt::Key::Key_2, Qt::KeypadModifier)), - win_key(DIK_NUMPAD3, mod(Qt::Key::Key_3, Qt::KeypadModifier)), - win_key(DIK_NUMPAD4, mod(Qt::Key::Key_4, Qt::KeypadModifier)), - win_key(DIK_NUMPAD5, mod(Qt::Key::Key_5, Qt::KeypadModifier)), - win_key(DIK_NUMPAD6, mod(Qt::Key::Key_6, Qt::KeypadModifier)), - win_key(DIK_NUMPAD7, mod(Qt::Key::Key_7, Qt::KeypadModifier)), - win_key(DIK_NUMPAD8, mod(Qt::Key::Key_8, Qt::KeypadModifier)), - win_key(DIK_NUMPAD9, mod(Qt::Key::Key_9, Qt::KeypadModifier)), - win_key(DIK_NUMPADCOMMA, mod(Qt::Key::Key_Comma, Qt::KeypadModifier)), - win_key(DIK_NUMPADENTER, mod(Qt::Key::Key_Enter, Qt::KeypadModifier)), - win_key(DIK_NUMPADEQUALS, mod(Qt::Key::Key_Equal, Qt::KeypadModifier)), - win_key(DIK_NUMPADMINUS, mod(Qt::Key::Key_Minus, Qt::KeypadModifier)), - win_key(DIK_NUMPADPERIOD, mod(Qt::Key::Key_Period, Qt::KeypadModifier)), - win_key(DIK_NUMPADPLUS, mod(Qt::Key::Key_Plus, Qt::KeypadModifier)), - win_key(DIK_NUMPADSLASH, mod(Qt::Key::Key_Slash, Qt::KeypadModifier)), - win_key(DIK_NUMPADSTAR, mod(Qt::Key::Key_multiply, Qt::KeypadModifier)), - }); + {DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)}, + {DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)}, + {DIK_NUMPAD1, mod(Qt::Key_1, Qt::KeypadModifier)}, + {DIK_NUMPAD2, mod(Qt::Key_2, Qt::KeypadModifier)}, + {DIK_NUMPAD3, mod(Qt::Key_3, Qt::KeypadModifier)}, + {DIK_NUMPAD4, mod(Qt::Key_4, Qt::KeypadModifier)}, + {DIK_NUMPAD5, mod(Qt::Key_5, Qt::KeypadModifier)}, + {DIK_NUMPAD6, mod(Qt::Key_6, Qt::KeypadModifier)}, + {DIK_NUMPAD7, mod(Qt::Key_7, Qt::KeypadModifier)}, + {DIK_NUMPAD8, mod(Qt::Key_8, Qt::KeypadModifier)}, + {DIK_NUMPAD9, mod(Qt::Key_9, Qt::KeypadModifier)}, + {DIK_NUMPADCOMMA, mod(Qt::Key_Comma, Qt::KeypadModifier)}, + {DIK_NUMPADENTER, mod(Qt::Key_Enter, Qt::KeypadModifier)}, + {DIK_NUMPADEQUALS, mod(Qt::Key_Equal, Qt::KeypadModifier)}, + {DIK_NUMPADMINUS, mod(Qt::Key_Minus, Qt::KeypadModifier)}, + {DIK_NUMPADPERIOD, mod(Qt::Key_Period, Qt::KeypadModifier)}, + {DIK_NUMPADPLUS, mod(Qt::Key_Plus, Qt::KeypadModifier)}, + {DIK_NUMPADSLASH, mod(Qt::Key_Slash, Qt::KeypadModifier)}, + {DIK_NUMPADSTAR, mod(Qt::Key_multiply, Qt::KeypadModifier)}, + }; bool win_key::to_qt(const Key& k, QKeySequence& qt_, Qt::KeyboardModifiers &mods) { |