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