00001 /****************************************************************************** 00002 * This file is part of the Gluon Development Platform 00003 * Copyright (C) 2008 Sacha Schutz <istdasklar@free.fr> 00004 * Copyright (C) 2010 Kim Jung Nissen <jungnissen@gmail.com> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #include "detectwin.h" 00022 00023 #include "inputthread.h" 00024 00025 #include <core/debughelper.h> 00026 00027 #include <QtCore/QDir> 00028 #include <QtCore/QCoreApplication> 00029 #include <QtGui/QMessageBox> 00030 #include <QtCore/QDebug> 00031 00032 using namespace GluonInput; 00033 00034 class DetectWin::DetectWinPrivate 00035 { 00036 public: 00037 QList<InputDevice*> inputList; 00038 QList<Keyboard*> keyboardList; 00039 QList<Mouse*> mouseList; 00040 QList<Joystick*> joystickList; 00041 QList<Touch*> touchList; 00042 QList<InputDevice*> unknownList; 00043 }; 00044 00045 DetectWin::DetectWin( QObject* parent ) 00046 : Detect( parent ) 00047 , d( new DetectWinPrivate ) 00048 { 00049 } 00050 00051 DetectWin::~DetectWin() 00052 { 00053 } 00054 00055 void DetectWin::detectDevices() 00056 { 00057 } 00058 00059 void DetectWin::setAllEnabled( bool enable ) 00060 { 00061 foreach( InputDevice * input, inputList() ) 00062 { 00063 input->setEnabled( enable ); 00064 } 00065 } 00066 00067 void DetectWin::clear() 00068 { 00069 d->inputList.clear(); 00070 d->keyboardList.clear(); 00071 d->mouseList.clear(); 00072 d->joystickList.clear(); 00073 d->touchList.clear(); 00074 d->unknownList.clear(); 00075 } 00076 00077 void DetectWin::addInput( InputDevice* i ) 00078 { 00079 d->inputList.append( i ); 00080 } 00081 00082 void DetectWin::addKeyboard( InputDevice* i ) 00083 { 00084 Keyboard* keybd = qobject_cast<Keyboard*>( i ); 00085 d->keyboardList.append( keybd ); 00086 } 00087 00088 void DetectWin::addMouse( InputDevice* i ) 00089 { 00090 Mouse* mouse = qobject_cast<Mouse*>( i ); 00091 d->mouseList.append( mouse ); 00092 } 00093 00094 void DetectWin::addJoystick( InputDevice* i ) 00095 { 00096 Joystick* joy = qobject_cast<Joystick*>( i ); 00097 d->joystickList.append( joy ); 00098 } 00099 00100 void DetectWin::addTouch( InputDevice* i ) 00101 { 00102 Touch* touch = qobject_cast<Touch*>( i ); 00103 d->touchList.append( touch ); 00104 } 00105 00106 void DetectWin::addUnknown( InputDevice* i ) 00107 { 00108 d->unknownList.append( i ); 00109 } 00110 00111 QList<InputDevice*> DetectWin::inputList() 00112 { 00113 return d->inputList; 00114 } 00115 00116 QList<Keyboard*> DetectWin::keyboardList() 00117 { 00118 return d->keyboardList; 00119 } 00120 00121 QList<Mouse*> DetectWin::mouseList() 00122 { 00123 return d->mouseList; 00124 } 00125 00126 QList<Joystick*> DetectWin::joystickList() 00127 { 00128 return d->joystickList; 00129 } 00130 00131 QList<Touch*> DetectWin::touchList() 00132 { 00133 return d->touchList; 00134 } 00135 00136 QList<InputDevice*> DetectWin::unknownDeviceList() 00137 { 00138 return d->unknownList; 00139 }