Add unhandled Android keys.

Sort case values.

The following new keys were added:
KEYCODE_F1 -- KEYCODE_F12
KEYCODE_NUMPAD_0 -- KEYCODE_NUMPAD_9
KEYCODE_AT
KEYCODE_PAGE_UP
KEYCODE_PAGE_DOWN
KEYCODE_ESCAPE
KEYCODE_CTRL_LEFT
KEYCODE_CTRL_RIGHT
KEYCODE_CAPS_LOCK
KEYCODE_SCROLL_LOCK
KEYCODE_META_LEFT
KEYCODE_META_RIGHT
KEYCODE_SYSRQ
KEYCODE_BREAK
KEYCODE_MOVE_HOME
KEYCODE_MOVE_END
KEYCODE_MOVE_INSERT
KEYCODE_FORWARD
KEYCODE_MEDIA_PLAY
KEYCODE_MEDIA_PAUSE
KEYCODE_NUM_LOCK
KEYCODE_NUMPAD_DIVIDE
KEYCODE_NUMPAD_MULTIPLY
KEYCODE_NUMPAD_SUBTRACT
KEYCODE_NUMPAD_ADD
KEYCODE_NUMPAD_DOT
KEYCODE_NUMPAD_COMMA
KEYCODE_NUMPAD_ENTER
KEYCODE_NUMPAD_EQUALS
KEYCODE_NUMPAD_LEFT_PAREN
KEYCODE_NUMPAD_RIGHT_PAREN
KEYCODE_BOOKMARK
KEYCODE_BRIGHTNESS_DOWN
KEYCODE_BRIGHTNESS_UP
KEYCODE_MEDIA_AUDIO_TRACK

Change-Id: I599e9e46ea720e52004a53747d6b21fc7a44262e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
BogDan Vatra 2014-04-08 15:38:04 +03:00 committed by The Qt Project
parent b490116f82
commit 449a0a2868

View File

@ -47,9 +47,7 @@
#include <QTouchEvent>
#include <QPointer>
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
# include <QDebug>
#endif
#include <QDebug>
using namespace QtAndroid;
@ -277,226 +275,393 @@ namespace QtAndroidInput
if (key >= 0x0000001d && key <= 0x00000036)
return Qt::Key_A + key - 0x0000001d;
// F1--F12 0x00000083 -- 0x0000008e
if (key >= 0x00000083 && key <= 0x0000008e)
return Qt::Key_F1 + key - 0x00000083;
// NUMPAD_0--NUMPAD_9 0x00000090 -- 0x00000099
if (key >= 0x00000090 && key <= 0x00000099)
return Qt::KeypadModifier + Qt::Key_0 + key - 0x00000090;
// BUTTON_1--KEYCODE_BUTTON_16 0x000000bc -- 0x000000cb
switch (key) {
case 0x00000039:
case 0x0000003a:
return Qt::Key_Alt;
case 0x00000000: // KEYCODE_UNKNOWN
return Qt::Key_unknown;
case 0x0000004b:
return Qt::Key_Apostrophe;
case 0x00000001: // KEYCODE_SOFT_LEFT
return Qt::Key_Left;
case 0x00000004: // KEYCODE_BACK
return Qt::Key_Back;
case 0x00000002: // KEYCODE_SOFT_RIGHT
return Qt::Key_Right;
case 0x00000049:
return Qt::Key_Backslash;
// 0x00000003: // KEYCODE_HOME is never delivered to applications.
case 0x00000005:
return Qt::Key_Call;
case 0x00000004: // KEYCODE_BACK
return Qt::Key_Back;
case 0x0000001b: // KEYCODE_CAMERA
return Qt::Key_Camera;
case 0x00000005: // KEYCODE_CALL
return Qt::Key_Call;
case 0x0000001c:
return Qt::Key_Clear;
case 0x00000006: // KEYCODE_ENDCALL
return Qt::Key_Hangup;
case 0x00000037:
return Qt::Key_Comma;
// 0--9 0x00000007 -- 0x00000010
case 0x00000043: // KEYCODE_DEL
return Qt::Key_Backspace;
case 0x00000011: // KEYCODE_STAR
return Qt::Key_Asterisk;
case 0x00000017: // KEYCODE_DPAD_CENTER
return Qt::Key_Enter;
case 0x00000012: // KEYCODE_POUND
return Qt::Key_NumberSign;
case 0x00000014: // KEYCODE_DPAD_DOWN
return Qt::Key_Down;
case 0x00000013: //KEYCODE_DPAD_UP
return Qt::Key_Up;
case 0x00000015: //KEYCODE_DPAD_LEFT
return Qt::Key_Left;
case 0x00000014: // KEYCODE_DPAD_DOWN
return Qt::Key_Down;
case 0x00000016: //KEYCODE_DPAD_RIGHT
return Qt::Key_Right;
case 0x00000015: //KEYCODE_DPAD_LEFT
return Qt::Key_Left;
case 0x00000013: //KEYCODE_DPAD_UP
return Qt::Key_Up;
case 0x00000016: //KEYCODE_DPAD_RIGHT
return Qt::Key_Right;
case 0x00000006: //KEYCODE_ENDCALL
return Qt::Key_Hangup;
case 0x00000017: // KEYCODE_DPAD_CENTER
return Qt::Key_Enter;
case 0x00000042:
return Qt::Key_Return;
case 0x00000018: // KEYCODE_VOLUME_UP
return Qt::Key_VolumeUp;
case 0x00000041: //KEYCODE_ENVELOPE
return Qt::Key_LaunchMail;
case 0x00000019: // KEYCODE_VOLUME_DOWN
return Qt::Key_VolumeDown;
case 0x00000046:
return Qt::Key_Equal;
case 0x0000001a:
return Qt::Key_PowerOff;
case 0x00000040:
return Qt::Key_Explorer;
case 0x0000001b: // KEYCODE_CAMERA
return Qt::Key_Camera;
case 0x00000003:
return Qt::Key_Home;
case 0x0000001c: // KEYCODE_CLEAR
return Qt::Key_Clear;
case 0x00000047:
return Qt::Key_BracketLeft;
// A--Z 0x0000001d -- 0x00000036
case 0x0000005a: // KEYCODE_MEDIA_FAST_FORWARD
return Qt::Key_AudioForward;
case 0x00000037: // KEYCODE_COMMA
return Qt::Key_Comma;
case 0x00000057:
return Qt::Key_MediaNext;
case 0x00000038: // KEYCODE_PERIOD
return Qt::Key_Period;
case 0x00000055:
return Qt::Key_MediaPlay;
case 0x00000039: // KEYCODE_ALT_LEFT
case 0x0000003a: // KEYCODE_ALT_RIGHT
return Qt::Key_Alt;
case 0x00000058:
return Qt::Key_MediaPrevious;
case 0x0000003b: // KEYCODE_SHIFT_LEFT
case 0x0000003c: // KEYCODE_SHIFT_RIGHT
return Qt::Key_Shift;
case 0x00000059: // KEYCODE_MEDIA_REWIND
return Qt::Key_AudioRewind;
case 0x0000003d: // KEYCODE_TAB
return Qt::Key_Tab;
case 0x00000056:
return Qt::Key_MediaStop;
case 0x0000003e: // KEYCODE_SPACE
return Qt::Key_Space;
case 0x00000052: //KEYCODE_MENU
return Qt::Key_Menu;
case 0x0000003f: // KEYCODE_SYM
return Qt::Key_Meta;
case 0x00000045:
return Qt::Key_Minus;
case 0x00000040: // KEYCODE_EXPLORER
return Qt::Key_Explorer;
case 0x0000005b: // KEYCODE_MUTE
return Qt::Key_MicMute;
case 0x00000041: //KEYCODE_ENVELOPE
return Qt::Key_LaunchMail;
case 0x0000004e:
return Qt::Key_NumLock;
case 0x00000042: // KEYCODE_ENTER
return Qt::Key_Return;
case 0x00000038:
return Qt::Key_Period;
case 0x00000043: // KEYCODE_DEL
return Qt::Key_Backspace;
case 0x00000051:
return Qt::Key_Plus;
case 0x00000044: // KEYCODE_GRAVE
return Qt::Key_QuoteLeft;
case 0x0000001a:
return Qt::Key_PowerOff;
case 0x00000045: // KEYCODE_MINUS
return Qt::Key_Minus;
case 0x00000048:
return Qt::Key_BracketRight;
case 0x00000046: // KEYCODE_EQUALS
return Qt::Key_Equal;
case 0x00000054:
return Qt::Key_Search;
case 0x00000047: // KEYCODE_LEFT_BRACKET
return Qt::Key_BracketLeft;
case 0x0000004a:
return Qt::Key_Semicolon;
case 0x00000048: // KEYCODE_RIGHT_BRACKET
return Qt::Key_BracketRight;
case 0x0000003b:
case 0x0000003c:
return Qt::Key_Shift;
case 0x00000049: // KEYCODE_BACKSLASH
return Qt::Key_Backslash;
case 0x0000004c:
return Qt::Key_Slash;
case 0x0000004a: // KEYCODE_SEMICOLON
return Qt::Key_Semicolon;
case 0x00000001:
return Qt::Key_Left;
case 0x0000004b: // KEYCODE_APOSTROPHE
return Qt::Key_Apostrophe;
case 0x00000002:
return Qt::Key_Right;
case 0x0000004c: // KEYCODE_SLASH
return Qt::Key_Slash;
case 0x0000003e:
return Qt::Key_Space;
case 0x0000004d: // KEYCODE_AT
return Qt::Key_At;
case 0x0000003f: // KEYCODE_SYM
return Qt::Key_Meta;
case 0x0000004e: // KEYCODE_NUM
return Qt::Key_Alt;
case 0x0000003d:
return Qt::Key_Tab;
case 0x0000004f: // KEYCODE_HEADSETHOOK
return 0;
case 0x00000019:
return Qt::Key_VolumeDown;
case 0x00000050: // KEYCODE_FOCUS
return Qt::Key_CameraFocus;
case 0x000000a4: // KEYCODE_VOLUME_MUTE
return Qt::Key_VolumeMute;
case 0x00000051: // KEYCODE_PLUS
return Qt::Key_Plus;
case 0x00000018:
return Qt::Key_VolumeUp;
case 0x00000052: // KEYCODE_MENU
return Qt::Key_Menu;
case 0x00000011: // KEYCODE_STAR
return Qt::Key_Asterisk;
case 0x00000053: // KEYCODE_NOTIFICATION
return 0;
case 0x00000012: // KEYCODE_POUND
return Qt::Key_NumberSign;
case 0x00000054: // KEYCODE_SEARCH
return Qt::Key_Search;
case 0x00000050: // KEYCODE_FOCUS
return Qt::Key_CameraFocus;
case 0x00000055: // KEYCODE_MEDIA_PLAY_PAUSE
return Qt::Key_MediaPlay;
case 0x00000070: // KEYCODE_FORWARD_DEL
return Qt::Key_Delete;
case 0x00000056: // KEYCODE_MEDIA_STOP
return Qt::Key_MediaStop;
case 0x00000080: // KEYCODE_MEDIA_CLOSE
return Qt::Key_Close;
case 0x00000057: // KEYCODE_MEDIA_NEXT
return Qt::Key_MediaNext;
case 0x00000081: // KEYCODE_MEDIA_EJECT
return Qt::Key_Eject;
case 0x00000058: // KEYCODE_MEDIA_PREVIOUS
return Qt::Key_MediaPrevious;
case 0x00000082: // KEYCODE_MEDIA_RECORD
return Qt::Key_MediaRecord;
case 0x00000059: // KEYCODE_MEDIA_REWIND
return Qt::Key_AudioRewind;
case 0x000000b7: // KEYCODE_PROG_RED
return Qt::Key_Red;
case 0x0000005a: // KEYCODE_MEDIA_FAST_FORWARD
return Qt::Key_AudioForward;
case 0x000000b8: // KEYCODE_PROG_GREEN
return Qt::Key_Green;
case 0x0000005b: // KEYCODE_MUTE
return Qt::Key_MicMute;
case 0x000000b9: // KEYCODE_PROG_YELLOW
return Qt::Key_Yellow;
case 0x0000005c: // KEYCODE_PAGE_UP
return Qt::Key_PageUp;
case 0x000000ba: // KEYCODE_PROG_BLUE
return Qt::Key_Blue;
case 0x0000005d: // KEYCODE_PAGE_DOWN
return Qt::Key_PageDown;
case 0x000000a5: // KEYCODE_INFO
return Qt::Key_Info;
case 0x0000005e: // KEYCODE_PICTSYMBOLS
return 0;
case 0x000000a6: // KEYCODE_CHANNEL_UP
return Qt::Key_ChannelUp;
case 0x00000060: // KEYCODE_BUTTON_A
case 0x00000061: // KEYCODE_BUTTON_B
case 0x00000062: // KEYCODE_BUTTON_B
case 0x00000063: // KEYCODE_BUTTON_X
case 0x00000064: // KEYCODE_BUTTON_Y
case 0x00000065: // KEYCODE_BUTTON_Z
case 0x00000066: // KEYCODE_BUTTON_L1
case 0x00000067: // KEYCODE_BUTTON_R1
case 0x00000068: // KEYCODE_BUTTON_L2
case 0x00000069: // KEYCODE_BUTTON_R2
case 0x0000006a: // KEYCODE_BUTTON_THUMBL
case 0x0000006b: // KEYCODE_BUTTON_THUMBR
case 0x0000006c: // KEYCODE_BUTTON_START
case 0x0000006d: // KEYCODE_BUTTON_SELECT
case 0x0000006e: // KEYCODE_BUTTON_MODE
return 0;
case 0x000000a7: // KEYCODE_CHANNEL_DOWN
return Qt::Key_ChannelDown;
case 0x0000006f: // KEYCODE_ESCAPE
return Qt::Key_Escape;
case 0x000000a8: // KEYCODE_ZOOM_IN
return Qt::Key_ZoomIn;
case 0x00000070: // KEYCODE_FORWARD_DEL
return Qt::Key_Delete;
case 0x000000a9: // KEYCODE_ZOOM_OUT
return Qt::Key_ZoomOut;
case 0x00000071: // KEYCODE_CTRL_LEFT
case 0x00000072: // KEYCODE_CTRL_RIGHT
return Qt::Key_Control;
case 0x000000ac: // KEYCODE_GUIDE
return Qt::Key_Guide;
case 0x00000073: // KEYCODE_CAPS_LOCK
return Qt::Key_CapsLock;
case 0x000000af: // KEYCODE_CAPTIONS
return Qt::Key_Subtitle;
case 0x00000074: // KEYCODE_SCROLL_LOCK
return Qt::Key_ScrollLock;
case 0x000000b0: // KEYCODE_SETTINGS
return Qt::Key_Settings;
case 0x00000075: // KEYCODE_META_LEFT
case 0x00000076: // KEYCODE_META_RIGHT
return Qt::Key_Meta;
case 0x000000d0: // KEYCODE_CALENDAR
return Qt::Key_Calendar;
case 0x00000077: // KEYCODE_FUNCTION
return 0;
case 0x000000d1: // KEYCODE_MUSIC
return Qt::Key_Music;
case 0x00000078: // KEYCODE_SYSRQ
return Qt::Key_Print;
case 0x000000d2: // KEYCODE_CALCULATOR
return Qt::Key_Calculator;
case 0x00000079: // KEYCODE_BREAK
return Qt::Key_Pause;
case 0x00000000: // KEYCODE_UNKNOWN
return Qt::Key_unknown;
case 0x0000007a: // KEYCODE_MOVE_HOME
return Qt::Key_Home;
case 0x00000053: // KEYCODE_NOTIFICATION ?!?!?
case 0x0000004f: // KEYCODE_HEADSETHOOK ?!?!?
case 0x00000044: // KEYCODE_GRAVE ?!?!?
return Qt::Key_Any;
case 0x0000007b: // KEYCODE_MOVE_END
return Qt::Key_End;
default:
return 0;
case 0x0000007c: // KEYCODE_MOVE_INSERT
return Qt::Key_Insert;
case 0x0000007d: // KEYCODE_FORWARD
return Qt::Key_Forward;
case 0x0000007e: // KEYCODE_MEDIA_PLAY
return Qt::Key_MediaPlay;
case 0x0000007f: // KEYCODE_MEDIA_PAUSE
return Qt::Key_MediaPause;
case 0x00000080: // KEYCODE_MEDIA_CLOSE
case 0x00000081: // KEYCODE_MEDIA_EJECT
return Qt::Key_Eject;
case 0x00000082: // KEYCODE_MEDIA_RECORD
return Qt::Key_MediaRecord;
// F1--F12 0x00000083 -- 0x0000008e
case 0x0000008f: // KEYCODE_NUM_LOCK
return Qt::Key_NumLock;
// NUMPAD_0--NUMPAD_9 0x00000090 -- 0x00000099
case 0x0000009a: // KEYCODE_NUMPAD_DIVIDE
return Qt::KeypadModifier + Qt::Key_Slash;
case 0x0000009b: // KEYCODE_NUMPAD_MULTIPLY
return Qt::KeypadModifier + Qt::Key_Asterisk;
case 0x0000009c: // KEYCODE_NUMPAD_SUBTRACT
return Qt::KeypadModifier + Qt::Key_Minus;
case 0x0000009d: // KEYCODE_NUMPAD_ADD
return Qt::KeypadModifier + Qt::Key_Plus;
case 0x0000009e: // KEYCODE_NUMPAD_DOT
return Qt::KeypadModifier + Qt::Key_Period;
case 0x0000009f: // KEYCODE_NUMPAD_COMMA
return Qt::KeypadModifier + Qt::Key_Comma;
case 0x000000a0: // KEYCODE_NUMPAD_ENTER
return Qt::Key_Enter;
case 0x000000a1: // KEYCODE_NUMPAD_EQUALS
return Qt::KeypadModifier + Qt::Key_Equal;
case 0x000000a2: // KEYCODE_NUMPAD_LEFT_PAREN
return Qt::Key_ParenLeft;
case 0x000000a3: // KEYCODE_NUMPAD_RIGHT_PAREN
return Qt::Key_ParenRight;
case 0x000000a4: // KEYCODE_VOLUME_MUTE
return Qt::Key_VolumeMute;
case 0x000000a5: // KEYCODE_INFO
return Qt::Key_Info;
case 0x000000a6: // KEYCODE_CHANNEL_UP
return Qt::Key_ChannelUp;
case 0x000000a7: // KEYCODE_CHANNEL_DOWN
return Qt::Key_ChannelDown;
case 0x000000a8: // KEYCODE_ZOOM_IN
return Qt::Key_ZoomIn;
case 0x000000a9: // KEYCODE_ZOOM_OUT
return Qt::Key_ZoomOut;
case 0x000000aa: // KEYCODE_TV
case 0x000000ab: // KEYCODE_WINDOW
return 0;
case 0x000000ac: // KEYCODE_GUIDE
return Qt::Key_Guide;
case 0x000000ad: // KEYCODE_DVR
return 0;
case 0x000000ae: // KEYCODE_BOOKMARK
return Qt::Key_AddFavorite;
case 0x000000af: // KEYCODE_CAPTIONS
return Qt::Key_Subtitle;
case 0x000000b0: // KEYCODE_SETTINGS
return Qt::Key_Settings;
case 0x000000b1: // KEYCODE_TV_POWER
case 0x000000b2: // KEYCODE_TV_INPUT
case 0x000000b3: // KEYCODE_STB_POWER
case 0x000000b4: // KEYCODE_STB_INPUT
case 0x000000b5: // KEYCODE_AVR_POWER
case 0x000000b6: // KEYCODE_AVR_INPUT
return 0;
case 0x000000b7: // KEYCODE_PROG_RED
return Qt::Key_Red;
case 0x000000b8: // KEYCODE_PROG_GREEN
return Qt::Key_Green;
case 0x000000b9: // KEYCODE_PROG_YELLOW
return Qt::Key_Yellow;
case 0x000000ba: // KEYCODE_PROG_BLUE
return Qt::Key_Blue;
// 0x000000bb: // KEYCODE_APP_SWITCH is not sent by the Android O.S.
// BUTTON_1--KEYCODE_BUTTON_16 0x000000bc -- 0x000000cb
case 0x000000cc: // KEYCODE_LANGUAGE_SWITCH
case 0x000000cd: // KEYCODE_MANNER_MODE do we need such a thing?
case 0x000000ce: // KEYCODE_3D_MODE
case 0x000000cf: // KEYCODE_CONTACTS
return 0;
case 0x000000d0: // KEYCODE_CALENDAR
return Qt::Key_Calendar;
case 0x000000d1: // KEYCODE_MUSIC
return Qt::Key_Music;
case 0x000000d2: // KEYCODE_CALCULATOR
return Qt::Key_Calculator;
// 0x000000d3 -- 0x000000da some japanese specific keys, someone who understand what is about should check !
// 0x000000db: // KEYCODE_ASSIST not delivered to applications.
case 0x000000dc: // KEYCODE_BRIGHTNESS_DOWN
return Qt::Key_KeyboardBrightnessDown;
case 0x000000dd: // KEYCODE_BRIGHTNESS_UP
return Qt::Key_KeyboardBrightnessUp;
case 0x000000de: // KEYCODE_MEDIA_AUDIO_TRACK
return Qt::Key_AudioCycleTrack;
default:
qWarning() << "Unhandled key code " << key << "!";
return 0;
}
}