00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 \
00020 #include "gluonbuttons.h"
00021
00022 #include <QtCore/QMetaEnum>
00023
00024 using namespace GluonInput;
00025
00026 template<> GLUON_INPUT_EXPORT GluonButtons* GluonCore::Singleton<GluonButtons>::m_instance = 0;
00027
00028 GluonButtons::GluonButtons()
00029 {
00030 }
00031
00032 GluonButtons::~GluonButtons()
00033 {
00034 }
00035
00036 QString GluonButtons::buttonName( DeviceFlag deviceType, int code )
00037 {
00038 QString value = "";
00039 switch( deviceType )
00040 {
00041 case KeyboardDevice:
00042 value = metaObject()->enumerator( this->metaObject()->indexOfEnumerator( "KeyboardButton" ) ).valueToKey( code );
00043 return value != "" ? value : "Reserved";
00044 break;
00045 case MouseDevice:
00046 value = metaObject()->enumerator( this->metaObject()->indexOfEnumerator( "MouseButton" ) ).valueToKey( code );
00047 return value != "" ? value : "Unknown";
00048 break;
00049 case JoystickDevice:
00050 value = metaObject()->enumerator( this->metaObject()->indexOfEnumerator( "JoystickButton" ) ).valueToKey( code );
00051 return value != "" ? value : "Unknown";
00052 break;
00053 default:
00054 return "Unknown";
00055 }
00056 }
00057
00058 QString GluonButtons::axisName( DeviceFlag deviceType, int code )
00059 {
00060 QString value = "";
00061 switch( deviceType )
00062 {
00063 case MouseDevice:
00064 value = metaObject()->enumerator( metaObject()->indexOfEnumerator( "RelAbs" ) ).valueToKey( code );
00065 return value != "" ? value : "Unknown";
00066 break;
00067 case JoystickDevice:
00068 value = metaObject()->enumerator( metaObject()->indexOfEnumerator( "RelAbs" ) ).valueToKey( code );
00069 return value != "" ? value : "Unknown";
00070 break;
00071 default:
00072 return "Unknown";
00073 }
00074 }
00075
00076 #include "gluonbuttons.moc"