AntiMicroX
Loading...
Searching...
No Matches
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
46class AntKeyMapper : public QObject
47{
48 Q_OBJECT
49
50 public:
58 static AntKeyMapper *getInstance(QString handler = "");
59 void deleteInstance();
60
66 int returnVirtualKey(int qkey);
67
74 int returnQtKey(int key, int scancode = 0);
75
81 bool isModifierKey(int qkey);
84 bool hasNativeKeyMapper();
85
86 protected:
88
89 private:
90 explicit AntKeyMapper(QString handler = "", QObject *parent = nullptr);
91
94};
95
96#endif // ANTKEYMAPPER_H
Singleton facade for platform key mapping selection.
Definition antkeymapper.h:47
void deleteInstance()
Definition antkeymapper.cpp:93
int returnVirtualKey(int qkey)
Translate a Qt key to a platform virtual key code.
Definition antkeymapper.cpp:104
QtKeyMapperBase * nativeKeyMapper
Definition antkeymapper.h:93
static AntKeyMapper * _instance
Definition antkeymapper.h:87
QtKeyMapperBase * getKeyMapper() const
Definition antkeymapper.cpp:110
QtKeyMapperBase * internalMapper
Definition antkeymapper.h:92
bool hasNativeKeyMapper()
Definition antkeymapper.cpp:112
QtKeyMapperBase * getNativeKeyMapper() const
Definition antkeymapper.cpp:108
static AntKeyMapper * getInstance(QString handler="")
Obtain the singleton instance.
Definition antkeymapper.cpp:80
bool isModifierKey(int qkey)
Check if a given Qt key is treated as a modifier key.
Definition antkeymapper.cpp:106
int returnQtKey(int key, int scancode=0)
Translate a platform virtual key to a Qt key.
Definition antkeymapper.cpp:102
Base class for platform-specific Qt key mappers.
Definition qtkeymapperbase.h:42