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");
60 if (!QFile::exists(config))
61 config = QDir::homePath() +
"/.lircrc";
64 QString socket =
"/dev/lircd";
65 if (!QFile::exists(socket))
66 socket =
"/var/run/lirc/lircd";
81 #ifdef USE_JOYSTICK_MENU
84 QString config =
GetConfDir() +
"/joystickmenurc";
91 #ifdef USING_APPLEREMOTE
118 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Stopping");
122 m_cecAdapter.Close();
125 #ifdef USING_APPLEREMOTE
135 #ifdef USE_JOYSTICK_MENU
169 #ifdef USING_APPLEREMOTE
172 if (
Event->type() == QEvent::WindowActivate)
174 if (
Event->type() == QEvent::WindowDeactivate)
183 m_cecAdapter.Action(
Action);
192 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Locking input devices");
194 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Unlocking input devices");
197 m_cecAdapter.IgnoreKeys(Ignore);
218 QScopedPointer<QKeyEvent> key {
new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier) };
219 QObject* target =
nullptr;
222 #ifdef USE_JOYSTICK_MENU
229 int keycode = jke->
key();
232 key.reset(
new QKeyEvent(jke->keyAction(), keycode, jke->keyModifiers()));
237 error = jke->getJoystickMenuText();
242 #if defined(USE_LIRC) || defined(USING_APPLEREMOTE)
251 error = lke->lirctext();
255 key.reset(
new QKeyEvent(lke->keytype(), lke->key(), lke->modifiers(), lke->text()));
261 if (!
error.isEmpty())
263 LOG(VB_GENERAL, LOG_WARNING,
LOC +
264 QString(
"Attempt to convert key sequence '%1' to a Qt key sequence failed.").arg(
error));
271 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.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
An action (for this plugin) consists of a description, and a set of key sequences.
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)