|
MythTV master
|
Main object for injecting key strokes based on joystick movements. More...
#include <libmythui/devices/jsmenu.h>
Public Member Functions | |
| JoystickMenuThread (QObject *main_window) | |
| ~JoystickMenuThread () override | |
| bool | Init (QString &config_file) |
| Initialise the class variables with values from the config file. More... | |
| void | ButtonUp (int button) |
| Handle a button up event. More... | |
| void | AxisChange (int axis, int value) |
| Handle a registered change in a joystick axis. More... | |
| void | EmitKey (const QString &code) |
| Send a keyevent to the main UI loop with the appropriate keycode. More... | |
| bool | ReadConfig (const QString &config_file) |
| Read from action to key mappings from flat file config file. More... | |
| void | Stop (void) |
Public Member Functions inherited from MThread | |
| MThread (const QString &objectName) | |
| Standard constructor. More... | |
| MThread (const QString &objectName, QRunnable *runnable) | |
| Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More... | |
| virtual | ~MThread () |
| MThread (const MThread &)=delete | |
| MThread & | operator= (const MThread &)=delete |
| void | RunProlog (void) |
| Sets up a thread, call this if you reimplement run(). More... | |
| void | RunEpilog (void) |
| Cleans up a thread's resources, call this if you reimplement run(). More... | |
| QThread * | qthread (void) |
| Returns the thread, this will always return the same pointer no matter how often you restart the thread. More... | |
| void | setObjectName (const QString &name) |
| QString | objectName (void) const |
| void | setPriority (QThread::Priority priority) |
| QThread::Priority | priority (void) const |
| bool | isFinished (void) const |
| bool | isRunning (void) const |
| void | setStackSize (uint stackSize) |
| uint | stackSize (void) const |
| void | exit (int retcode=0) |
| Use this to exit from the thread if you are using a Qt event loop. More... | |
| void | start (QThread::Priority p=QThread::InheritPriority) |
| Tell MThread to start running the thread in the near future. More... | |
| void | terminate (void) |
| Kill a thread unsafely. More... | |
| void | quit (void) |
| calls exit(0) More... | |
| bool | wait (std::chrono::milliseconds time=std::chrono::milliseconds::max()) |
| Wait for the MThread to exit, with a maximum timeout. More... | |
Private Member Functions | |
| void | run () override |
| This function is the heart of a thread which looks for Joystick input and translates it into key press events. More... | |
Private Attributes | |
| bool | m_configRead {false} |
| bool | m_readError {false} |
| QString | m_configFile |
| QObject * | m_mainWindow {nullptr} |
| QString | m_devicename |
| int | m_fd {-1} |
| JoystickMap | m_map |
| unsigned char | m_buttonCount {0} |
| Track the status of the joystick buttons as we do depend slightly on state. More... | |
| unsigned char | m_axesCount {0} |
| Track the status of the joystick axes as we do depend slightly on state. More... | |
| int * | m_buttons {nullptr} |
| int * | m_axes {nullptr} |
| volatile bool | m_bStop {false} |
Additional Inherited Members | |
Static Public Member Functions inherited from MThread | |
| static void | ThreadSetup (const QString &name) |
| This is to be called on startup in those few threads that haven't been ported to MThread. More... | |
| static void | ThreadCleanup (void) |
| This is to be called on exit in those few threads that haven't been ported to MThread. More... | |
| static void | Cleanup (void) |
| This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More... | |
| static void | GetAllThreadNames (QStringList &list) |
| static void | GetAllRunningThreadNames (QStringList &list) |
Protected Member Functions inherited from MThread | |
| virtual void | run (void) |
| Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More... | |
| int | exec (void) |
| Enters the qt event loop. call exit or quit to exit thread. More... | |
Static Protected Member Functions inherited from MThread | |
| static void | setTerminationEnabled (bool enabled=true) |
Protected Attributes inherited from MThread | |
| MThreadInternal * | m_thread {nullptr} |
| QRunnable * | m_runnable {nullptr} |
| bool | m_prologExecuted {true} |
| bool | m_epilogExecuted {true} |
Main object for injecting key strokes based on joystick movements.
|
inlineexplicit |
|
override |
Definition at line 61 of file jsmenu.cpp.
| void JoystickMenuThread::AxisChange | ( | int | axis, |
| int | value | ||
| ) |
Handle a registered change in a joystick axis.
Definition at line 453 of file jsmenu.cpp.
Referenced by run().
| void JoystickMenuThread::ButtonUp | ( | int | button | ) |
Handle a button up event.
This is mildly complicated by the support for 'chords'; holding down a button and pushing down another can create one type of event.
Definition at line 421 of file jsmenu.cpp.
Referenced by run().
| void JoystickMenuThread::EmitKey | ( | const QString & | code | ) |
Send a keyevent to the main UI loop with the appropriate keycode.
Definition at line 383 of file jsmenu.cpp.
Referenced by AxisChange(), and ButtonUp().
| bool JoystickMenuThread::Init | ( | QString & | config_file | ) |
Initialise the class variables with values from the config file.
Definition at line 79 of file jsmenu.cpp.
Referenced by run().
| bool JoystickMenuThread::ReadConfig | ( | const QString & | config_file | ) |
Read from action to key mappings from flat file config file.
Config file has the following format:
devicename devname - Name of physical joystick device button num keystring - Represents a button chord cnum bnum keystring - A chorded button sequence; hold down cnum and press bnum to generate a key axis num from to keystring - Represents an axis range to trigger a key move that axis into the range and the keystring is sent
Definition at line 158 of file jsmenu.cpp.
Referenced by Init().
|
overrideprivatevirtual |
This function is the heart of a thread which looks for Joystick input and translates it into key press events.
Reimplemented from MThread.
Definition at line 224 of file jsmenu.cpp.
|
private |
Definition at line 127 of file jsmenu.h.
Referenced by AxisChange(), Init(), run(), and ~JoystickMenuThread().
|
private |
|
private |
|
private |
Definition at line 126 of file jsmenu.h.
Referenced by ButtonUp(), Init(), run(), and ~JoystickMenuThread().
|
private |
|
private |
Definition at line 110 of file jsmenu.h.
Referenced by Init(), and ReadConfig().
|
private |
Definition at line 111 of file jsmenu.h.
Referenced by Init(), run(), and ~JoystickMenuThread().
|
private |
|
private |
Definition at line 112 of file jsmenu.h.
Referenced by AxisChange(), ButtonUp(), and ReadConfig().