1 | diff --git a/mythtv/programs/mythfrontend/services/frontend.cpp b/mythtv/programs/mythfrontend/services/frontend.cpp |
---|
2 | index 19ce0b7..0bc77ff 100644 |
---|
3 | --- a/mythtv/programs/mythfrontend/services/frontend.cpp |
---|
4 | +++ b/mythtv/programs/mythfrontend/services/frontend.cpp |
---|
5 | @@ -403,6 +403,14 @@ void Frontend::InitialiseActions(void) |
---|
6 | LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Action: %1").arg(actions)); |
---|
7 | } |
---|
8 | |
---|
9 | +static QMap <QString, int> kKeyMap = |
---|
10 | +{ |
---|
11 | + { "up", Qt::Key_Up }, |
---|
12 | + { "down", Qt::Key_Down }, |
---|
13 | + { "left", Qt::Key_Left }, |
---|
14 | + // etc |
---|
15 | +}; |
---|
16 | + |
---|
17 | bool Frontend::SendKey(const QString &sKey) |
---|
18 | { |
---|
19 | int keyCode; |
---|
20 | @@ -497,6 +505,18 @@ bool Frontend::SendKey(const QString &sKey) |
---|
21 | if (GetMythMainWindow()->currentWidget()) |
---|
22 | keyDest = GetMythMainWindow()->currentWidget()->focusWidget(); |
---|
23 | |
---|
24 | + // Convert text to Qt keycode |
---|
25 | + QKeySequence seq(sKey); |
---|
26 | + if (seq.isEmpty() || seq[0] == Qt::Key_unknown) |
---|
27 | + LOG(VB_UPNP, LOG_INFO, LOC + QString("KeySeq: Unknown Key = '%1'").arg(sKey)); |
---|
28 | + else |
---|
29 | + { |
---|
30 | + keyCode = seq[0]; |
---|
31 | + LOG(VB_UPNP, LOG_INFO, LOC + QString("KeySeq: Key '%1', Code %2").arg(sKey).arg(keyCode)); |
---|
32 | +// ret = true; |
---|
33 | + } |
---|
34 | + |
---|
35 | + // Redundant |
---|
36 | if (keyMap.contains(sKey.toLower())) |
---|
37 | { |
---|
38 | keyCode = keyMap[sKey.toLower()]; |
---|
39 | @@ -522,7 +542,7 @@ bool Frontend::SendKey(const QString &sKey) |
---|
40 | keyText); |
---|
41 | QCoreApplication::postEvent(keyDest, event); |
---|
42 | |
---|
43 | - msg = QString("SendKey: Sent %1").arg(sKey); |
---|
44 | + msg = QString("SendKey: Sent %1, Code %2").arg(sKey).arg(keyCode); |
---|
45 | } |
---|
46 | |
---|
47 | LOG(VB_UPNP, LOG_INFO, LOC + msg); |
---|