AntiMicroX
eventhandlerfactory.h
Go to the documentation of this file.
1 /* antimicrox Gamepad to KB+M event mapper
2  * Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
3  * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14 
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef EVENTHANDLERFACTORY_H
20 #define EVENTHANDLERFACTORY_H
21 
22 #include <QObject>
23 #include <QStringList>
24 
25 #ifdef WITH_UINPUT
27 #endif
28 
29 #ifdef WITH_XTEST
31 #endif
32 
33 #ifdef Q_OS_WIN
35 
36  #ifdef WITH_VMULTI
38  #endif
39 #endif
40 
41 #ifdef Q_OS_WIN
42  #define ADD_SENDINPUT 1
43  #ifdef WITH_VMULTI
44  #define ADD_VMULTI 1
45  #else
46  #define ADD_VMULTI 0
47  #endif
48 
49  #define NUM_BACKENDS (ADD_SENDINPUT + ADD_VMULTI)
50 #else
51  #ifdef WITH_XTEST
52  #define ADD_XTEST 1
53  #else
54  #define ADD_XTEST 0
55  #endif
56 
57  #ifdef WITH_UINPUT
58  #define ADD_UINPUT 1
59  #else
60  #define ADD_UINPUT 0
61  #endif
62 
63  #define NUM_BACKENDS (ADD_XTEST + ADD_UINPUT)
64 #endif
65 
66 #if (NUM_BACKENDS > 1)
67  #define BACKEND_ELSE_IF else if
68 #else
69  #define BACKEND_ELSE_IF if
70 #endif
71 
72 class BaseEventHandler;
73 
74 class EventHandlerFactory : public QObject
75 {
76  Q_OBJECT
77 
78  public:
79  static EventHandlerFactory *getInstance(QString handler = "");
80  void deleteInstance();
82  static QString fallBackIdentifier();
83  static QStringList buildEventGeneratorList();
84  static QString handlerDisplayName(QString handler);
85 
86  protected:
87  explicit EventHandlerFactory(QString handler, QObject *parent = nullptr);
88 
91 };
92 
93 #endif // EVENTHANDLERFACTORY_H
buildDisplayNames
static QHash< QString, QString > buildDisplayNames()
Definition: eventhandlerfactory.cpp:27
XTestEventHandler
Definition: xtesteventhandler.h:26
winvmultieventhandler.h
WinSendInputEventHandler
Input event handler class for Windows.
Definition: winsendinputeventhandler.h:33
xtesteventhandler.h
EventHandlerFactory::EventHandlerFactory
EventHandlerFactory(QString handler, QObject *parent=nullptr)
Definition: eventhandlerfactory.cpp:46
logger.h
PRINT_STDOUT
#define PRINT_STDOUT()
Macro used for printing messages to stdout.
Definition: logger.h:38
EventHandlerFactory::fallBackIdentifier
static QString fallBackIdentifier()
Definition: eventhandlerfactory.cpp:97
EventHandlerFactory::buildEventGeneratorList
static QStringList buildEventGeneratorList()
Definition: eventhandlerfactory.cpp:137
BaseEventHandler
Base class for input event handlers.
Definition: baseeventhandler.h:32
eventhandlerfactory.h
EventHandlerFactory::instance
static EventHandlerFactory * instance
Definition: eventhandlerfactory.h:90
EventHandlerFactory
Definition: eventhandlerfactory.h:74
EventHandlerFactory::eventHandler
BaseEventHandler * eventHandler
Definition: eventhandlerfactory.h:89
EventHandlerFactory::deleteInstance
void deleteInstance()
Definition: eventhandlerfactory.cpp:86
EventHandlerFactory::handler
BaseEventHandler * handler()
Definition: eventhandlerfactory.cpp:95
handlerDisplayNames
QHash< QString, QString > handlerDisplayNames
Definition: eventhandlerfactory.cpp:42
baseeventhandler.h
EventHandlerFactory::getInstance
static EventHandlerFactory * getInstance(QString handler="")
Definition: eventhandlerfactory.cpp:71
UInputEventHandler
Input event handler class using uinput files.
Definition: uinputeventhandler.h:34
uinputeventhandler.h
winsendinputeventhandler.h
EventHandlerFactory::handlerDisplayName
static QString handlerDisplayName(QString handler)
Definition: eventhandlerfactory.cpp:150