MythTV  0.26-pre
Public Member Functions | Private Member Functions | Private Attributes
JoystickMenuThread Class Reference

Main object for injecting key strokes based on joystick movements. More...

#include <jsmenu.h>

Inheritance diagram for JoystickMenuThread:
MThread

List of all members.

Public Member Functions

 JoystickMenuThread (QObject *main_window)
 ~JoystickMenuThread ()
int Init (QString &config_file)
 Initialise the class variables with values from the config file.
void ButtonUp (int button)
 Handle a button up event.
void AxisChange (int axis, int value)
 Handle a registered change in a joystick axis.
void EmitKey (QString code)
 Send a keyevent to the main UI loop with the appropriate keycode.
int ReadConfig (QString config_file)
 Read from action to key mappings from flat file config file.
void Stop (void)

Private Member Functions

void run (void)
 This function is the heart of a thread which looks for Joystick input and translates it into key press events.

Private Attributes

QObject * m_mainWindow
QString m_devicename
int m_fd
JoystickMap m_map
unsigned char m_buttonCount
 Track the status of the joystick buttons as we do depend slightly on state.
unsigned char m_axesCount
 Track the status of the joystick axes as we do depend slightly on state.
intm_buttons
intm_axes
volatile bool m_bStop

Detailed Description

Main object for injecting key strokes based on joystick movements.

Definition at line 81 of file jsmenu.h.


Constructor & Destructor Documentation

JoystickMenuThread::JoystickMenuThread ( QObject *  main_window)

Definition at line 53 of file jsmenu.cpp.

Definition at line 62 of file jsmenu.cpp.


Member Function Documentation

int JoystickMenuThread::Init ( QString &  config_file)

Initialise the class variables with values from the config file.

Definition at line 80 of file jsmenu.cpp.

Referenced by MythMainWindow::MythMainWindow().

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 327 of file jsmenu.cpp.

Referenced by run().

void JoystickMenuThread::AxisChange ( int  axis,
int  value 
)

Handle a registered change in a joystick axis.

Definition at line 359 of file jsmenu.cpp.

Referenced by run().

void JoystickMenuThread::EmitKey ( QString  code)

Send a keyevent to the main UI loop with the appropriate keycode.

Definition at line 296 of file jsmenu.cpp.

Referenced by AxisChange(), and ButtonUp().

int JoystickMenuThread::ReadConfig ( QString  config_file)

Read from action to key mappings from flat file config file.

Config file has the following format: # Starts a comment 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 151 of file jsmenu.cpp.

Referenced by Init().

Definition at line 92 of file jsmenu.h.

Referenced by MythMainWindow::~MythMainWindow().

void JoystickMenuThread::run ( void  ) [private, virtual]

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 197 of file jsmenu.cpp.


Member Data Documentation

Definition at line 97 of file jsmenu.h.

Referenced by EmitKey().

Definition at line 98 of file jsmenu.h.

Referenced by Init(), and ReadConfig().

Definition at line 99 of file jsmenu.h.

Referenced by Init(), run(), and ~JoystickMenuThread().

Definition at line 100 of file jsmenu.h.

Referenced by AxisChange(), ButtonUp(), and ReadConfig().

unsigned char JoystickMenuThread::m_buttonCount [private]

Track the status of the joystick buttons as we do depend slightly on state.

Definition at line 106 of file jsmenu.h.

Referenced by Init(), and run().

unsigned char JoystickMenuThread::m_axesCount [private]

Track the status of the joystick axes as we do depend slightly on state.

Definition at line 112 of file jsmenu.h.

Referenced by Init(), and run().

Definition at line 114 of file jsmenu.h.

Referenced by ButtonUp(), Init(), run(), and ~JoystickMenuThread().

Definition at line 115 of file jsmenu.h.

Referenced by AxisChange(), Init(), run(), and ~JoystickMenuThread().

volatile bool JoystickMenuThread::m_bStop [private]

Definition at line 117 of file jsmenu.h.

Referenced by run(), and Stop().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends