AntiMicroX
antkeymapper.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 ANTKEYMAPPER_H
20 #define ANTKEYMAPPER_H
21 
22 #include <QObject>
23 
24 #ifdef Q_OS_WIN
25  #include "qtwinkeymapper.h"
26 #else
27  #ifdef WITH_XTEST
28  #include "qtx11keymapper.h"
29  #endif
30 
31  #ifdef WITH_UINPUT
32  #include "qtuinputkeymapper.h"
33  #endif
34 #endif
35 
36 class AntKeyMapper : public QObject
37 {
38  Q_OBJECT
39 
40  public:
41  static AntKeyMapper *getInstance(QString handler = "");
42  void deleteInstance();
43 
44  int returnVirtualKey(int qkey);
45  int returnQtKey(int key, int scancode = 0);
46  bool isModifierKey(int qkey);
49  bool hasNativeKeyMapper();
50 
51  protected:
53 
54  private:
55  explicit AntKeyMapper(QString handler = "", QObject *parent = nullptr);
56 
59 
60 #ifdef Q_OS_WIN
61  QtWinKeyMapper winMapper;
62 #else
63  #if defined(WITH_XTEST)
64  QtX11KeyMapper x11Mapper;
65  #endif
66 
67  #if defined(WITH_UINPUT)
68  QtUInputKeyMapper uinputMapper;
69  #endif
70 #endif
71 };
72 
73 #endif // ANTKEYMAPPER_H
qtuinputkeymapper.h
AntKeyMapper::hasNativeKeyMapper
bool hasNativeKeyMapper()
Definition: antkeymapper.cpp:112
antkeymapper.h
AntKeyMapper::internalMapper
QtKeyMapperBase * internalMapper
Definition: antkeymapper.h:57
AntKeyMapper::nativeKeyMapper
QtKeyMapperBase * nativeKeyMapper
Definition: antkeymapper.h:58
QtUInputKeyMapper
Definition: qtuinputkeymapper.h:24
AntKeyMapper::_instance
static AntKeyMapper * _instance
Definition: antkeymapper.h:52
QtKeyMapperBase::returnQtKey
virtual int returnQtKey(int key, int scancode=0)
Definition: qtkeymapperbase.cpp:32
AntKeyMapper::isModifierKey
bool isModifierKey(int qkey)
Definition: antkeymapper.cpp:106
AntKeyMapper::AntKeyMapper
AntKeyMapper(QString handler="", QObject *parent=nullptr)
Definition: antkeymapper.cpp:46
AntKeyMapper
Definition: antkeymapper.h:36
AntKeyMapper::returnVirtualKey
int returnVirtualKey(int qkey)
Definition: antkeymapper.cpp:104
eventhandlerfactory.h
QtWinKeyMapper
Definition: qtwinkeymapper.h:24
AntKeyMapper::getInstance
static AntKeyMapper * getInstance(QString handler="")
Definition: antkeymapper.cpp:80
BACKEND_ELSE_IF
#define BACKEND_ELSE_IF
Definition: eventhandlerfactory.h:69
QtKeyMapperBase::returnVirtualKey
virtual int returnVirtualKey(int qkey)
Definition: qtkeymapperbase.cpp:39
QtKeyMapperBase
Definition: qtkeymapperbase.h:25
qtwinkeymapper.h
qtx11keymapper.h
QtKeyMapperBase::isModifier
virtual bool isModifier(int qkey)
Definition: qtkeymapperbase.cpp:41
AntKeyMapper::deleteInstance
void deleteInstance()
Definition: antkeymapper.cpp:93
buildEventGeneratorList
static QStringList buildEventGeneratorList()
Definition: antkeymapper.cpp:29
AntKeyMapper::getNativeKeyMapper
QtKeyMapperBase * getNativeKeyMapper() const
Definition: antkeymapper.cpp:108
AntKeyMapper::getKeyMapper
QtKeyMapperBase * getKeyMapper() const
Definition: antkeymapper.cpp:110
AntKeyMapper::returnQtKey
int returnQtKey(int key, int scancode=0)
Definition: antkeymapper.cpp:102
QtX11KeyMapper
Definition: qtx11keymapper.h:24