Go to the documentation of this file.
2 #include <QCoreApplication>
7 #include "libmythbase/mythconfig.h"
15 #ifdef USE_JOYSTICK_MENU
20 #ifdef USING_APPLEREMOTE
28 #if defined (USE_LIRC) || defined (USING_APPLEREMOTE)
32 #define LOC QString("InputHandler: ")
54 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Starting");
61 config = QDir::homePath() +
"/.lircrc";
64 QString socket =
"/dev/lircd";
66 socket =
"/var/run/lirc/lircd";
81 #ifdef USE_JOYSTICK_MENU
84 QString config =
GetConfDir() +
"/joystickmenurc";
91 #ifdef USING_APPLEREMOTE
117 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Stopping");
121 m_cecAdapter.Close();
124 #ifdef USING_APPLEREMOTE
134 #ifdef USE_JOYSTICK_MENU
168 #ifdef USING_APPLEREMOTE
171 if (
Event->type() == QEvent::WindowActivate)
173 if (
Event->type() == QEvent::WindowDeactivate)
182 m_cecAdapter.Action(
Action);
189 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Locking input devices");
191 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Unlocking input devices");
194 m_cecAdapter.IgnoreKeys(Ignore);
213 QScopedPointer<QKeyEvent> key {
new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier) };
214 QObject* target =
nullptr;
217 #ifdef USE_JOYSTICK_MENU
224 int keycode = jke->
key();
227 key.reset(
new QKeyEvent(jke->keyAction(), keycode, jke->keyModifiers()));
232 error = jke->getJoystickMenuText();
237 #if defined(USE_LIRC) || defined(USING_APPLEREMOTE)
246 error = lke->lirctext();
250 key.reset(
new QKeyEvent(lke->keytype(), lke->key(), lke->modifiers(), lke->text()));
256 if (!
error.isEmpty())
258 LOG(VB_GENERAL, LOG_WARNING,
LOC +
259 QString(
"Attempt to convert key sequence '%1' to a Qt key sequence failed.").arg(
error));
266 QCoreApplication::sendEvent(target, key.data());
static AppleRemote * Get()
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
static void error(const char *str,...)
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
static const Type kEventType
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
An action (for this plugin) consists of a description, and a set of key sequences.
static const Type kEventType
virtual void deleteLater(void)
static const unsigned kLIRCInvalidKeyCombo
QObject * GetTarget(QKeyEvent &Key)
static bool IsScreensaverAsleep()
bool isRunning(void) const
static void ResetScreensaver()
bool isListeningToRemote()
Interface between mythtv and lircd.
void setListener(Listener *listener)