|
@@ -31,55 +31,8 @@ void InputAppleRemote::removeRemote(const QString &name)
|
|
|
QLOG_DEBUG() << "Remove remote:" << name;
|
|
|
}
|
|
|
|
|
|
-///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
-static QString codeToString(HIDRemoteButtonCode code)
|
|
|
-{
|
|
|
- switch (code)
|
|
|
- {
|
|
|
- case kHIDRemoteButtonCodeCenter:
|
|
|
- return INPUT_KEY_SELECT;
|
|
|
- case kHIDRemoteButtonCodeCenterHold:
|
|
|
- return INPUT_KEY_SELECT_LONG;
|
|
|
- case kHIDRemoteButtonCodeDown:
|
|
|
- return INPUT_KEY_DOWN;
|
|
|
- case kHIDRemoteButtonCodeDownHold:
|
|
|
- return INPUT_KEY_DOWN_LONG;
|
|
|
- case kHIDRemoteButtonCodeLeft:
|
|
|
- return INPUT_KEY_LEFT;
|
|
|
- case kHIDRemoteButtonCodeLeftHold:
|
|
|
- return INPUT_KEY_LEFT_LONG;
|
|
|
- case kHIDRemoteButtonCodeRight:
|
|
|
- return INPUT_KEY_RIGHT;
|
|
|
- case kHIDRemoteButtonCodeRightHold:
|
|
|
- return INPUT_KEY_RIGHT_LONG;
|
|
|
- case kHIDRemoteButtonCodeMenu:
|
|
|
- return INPUT_KEY_MENU;
|
|
|
- case kHIDRemoteButtonCodeMenuHold:
|
|
|
- return INPUT_KEY_MENU_LONG;
|
|
|
- case kHIDRemoteButtonCodePlay:
|
|
|
- return INPUT_KEY_PLAY;
|
|
|
- case kHIDRemoteButtonCodePlayHold:
|
|
|
- return INPUT_KEY_PLAY_LONG;
|
|
|
- case kHIDRemoteButtonCodeUp:
|
|
|
- return INPUT_KEY_UP;
|
|
|
- case kHIDRemoteButtonCodeUpHold:
|
|
|
- return INPUT_KEY_UP_LONG;
|
|
|
- default:
|
|
|
- QLOG_WARN() << "could not handle key code:" << code;
|
|
|
- }
|
|
|
- return "";
|
|
|
-}
|
|
|
-
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
void InputAppleRemote::remoteButtonEvent(quint8 code, bool pressed, const QString &name)
|
|
|
{
|
|
|
- if (pressed)
|
|
|
- {
|
|
|
- QString codeStr = codeToString((HIDRemoteButtonCode)code);
|
|
|
- if (!codeStr.isEmpty())
|
|
|
- {
|
|
|
- QLOG_DEBUG() << name << "pressed button:" << codeStr;
|
|
|
- emit receivedInput("AppleRemote", codeStr);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ emit receivedInput("AppleRemote", QString::number(code), pressed);
|
|
|
+}
|