AntiMicroX
inputdevicexml.h
Go to the documentation of this file.
1 /* antimicrox Gamepad to KB+M event mapper
2  * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13 
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INPUTDEVICEXML_H
19 #define INPUTDEVICEXML_H
20 
21 #include <QMutex>
22 #include <QObject>
23 
24 class QXmlStreamReader;
25 class QXmlStreamWriter;
26 class InputDevice;
27 class AntiMicroSettings;
28 
37 class InputDeviceXml : public QObject
38 {
39  Q_OBJECT
40  public:
41  explicit InputDeviceXml(InputDevice *inputDevice, QObject *parent = nullptr);
42 
43  public slots:
44 
45  void readConfig(QXmlStreamReader *xml); // InputDeviceXml class
46  void writeConfig(QXmlStreamWriter *xml); // InputDeviceXml class
47 
48  signals:
49  void readConfigSig(QXmlStreamReader *xml);
50 
51  private:
53 
54  // ensures that readConfig returns when reading is finished even for reading in different thread
56 };
57 
58 #endif // INPUTDEVICEXML_H
JoyControlStick::getButtons
QHash< JoyStickDirections, JoyControlStickButton * > * getButtons()
Definition: joycontrolstick.cpp:1820
JoyControlStickButton::getRealJoyNumber
virtual int getRealJoyNumber() const
Get a 1 indexed number of button.
Definition: joycontrolstickbutton.cpp:169
JoyControlStick::getAxisY
JoyAxis * getAxisY()
Definition: joycontrolstick.cpp:1824
InputDeviceCalibration::applyCalibrations
void applyCalibrations() const
Applies all applicable stored calibration values to the individual input elements of the parent contr...
Definition: inputdevicecalibration.cpp:111
joycontrolstickbutton.h
DEBUG
#define DEBUG()
Definition: logger.h:41
PadderCommon::programVersion
const QString programVersion
Definition: common.h:152
InputDevice::transferReset
void transferReset()
Obtain current joystick element values, create new SetJoystick objects, and then transfer most recent...
Definition: inputdevice.cpp:84
joycontrolstick.h
InputDeviceCalibration::readConfig
void readConfig(QXmlStreamReader *xml)
Reads all calibration values from the given XML stream into the internal calibration data storage.
Definition: inputdevicecalibration.cpp:136
JoyAxis
Represents single axis of of joystick (or other input)
Definition: joyaxis.h:40
JoyAxis::getRealJoyIndex
int getRealJoyIndex()
Definition: joyaxis.cpp:251
logger.h
SetJoystick::getSensors
const QHash< JoySensorType, JoySensor * > & getSensors() const
Get all sensor objects in this set.
Definition: setjoystick.cpp:1113
JoyControlStick::getStickName
QString getStickName()
Definition: joycontrolstick.cpp:2190
globalvariables.h
SetJoystick::getHats
const QHash< int, JoyDPad * > & getHats() const
Definition: setjoystick.cpp:1105
InputDeviceXml::m_inputDevice
InputDevice * m_inputDevice
Definition: inputdevicexml.h:52
joysensor.h
JoyDPadButton::DpadDown
@ DpadDown
Definition: joydpadbutton.h:46
InputDevice::setVDPadName
void setVDPadName(int vdpadIndex, QString tempName)
Definition: inputdevice.cpp:982
JoyDPadButton::DpadLeft
@ DpadLeft
Definition: joydpadbutton.h:47
InputDevice
Abstract class representing a hardware input device, e.g a joystick or controller.
Definition: inputdevice.h:50
JoyDPadButton::DpadRight
@ DpadRight
Definition: joydpadbutton.h:45
JoyDPadButton::DpadUp
@ DpadUp
Definition: joydpadbutton.h:44
JoyButton::getButtonName
QString getButtonName()
Definition: joybutton.cpp:3598
InputDevice::setStickButtonName
void setStickButtonName(int stickIndex, int buttonIndex, QString tempName)
Definition: inputdevice.cpp:836
InputDeviceXml::writeConfig
void writeConfig(QXmlStreamWriter *xml)
Serializes an InputDevice object into the the given XML stream.
Definition: inputdevicexml.cpp:381
PadderCommon::LATESTCONFIGFILEVERSION
const int LATESTCONFIGFILEVERSION
Definition: common.h:134
InputDevice::getProfileName
QString getProfileName()
Definition: inputdevice.cpp:1306
InputDevice::getXmlName
virtual QString getXmlName() const =0
inputdevicexml.h
JoyDPad::getButtons
QHash< int, JoyDPadButton * > * getButtons()
Definition: joydpad.cpp:223
VDPad::getVButton
JoyButton * getVButton(JoyDPadButton::JoyDPadDirections direction)
Definition: vdpad.cpp:233
JoyDPadButton::getRealJoyNumber
virtual int getRealJoyNumber() const override
Get a 1 indexed number of button.
Definition: joydpadbutton.cpp:80
InputDeviceXml
Generic InputDevice XML serialization/deserialization helper class Reads data from the supplied Input...
Definition: inputdevicexml.h:37
JoyControlStick::getAxisX
JoyAxis * getAxisX()
Definition: joycontrolstick.cpp:1822
AntiMicroSettings
Definition: antimicrosettings.h:26
JoyButton::getRealJoyNumber
virtual int getRealJoyNumber() const
Get a 1 indexed number of button.
Definition: joybutton.cpp:364
InputDevice::setDPadButtonName
void setDPadButtonName(int dpadIndex, int buttonIndex, QString tempName)
Definition: inputdevice.cpp:881
InputDevice::setVDPadButtonName
void setVDPadButtonName(int vdpadIndex, int buttonIndex, QString tempName)
Definition: inputdevice.cpp:900
JoyAxis::getPAxisButton
JoyAxisButton * getPAxisButton()
Definition: joyaxis.cpp:459
JoySensorType
JoySensorType
Definition: joysensortype.h:23
vdpad.h
InputDevice::setAxisName
void setAxisName(int axisIndex, QString tempName)
Definition: inputdevice.cpp:919
InputDevice::setDeviceKeyPressTime
void setDeviceKeyPressTime(int newPressTime)
Definition: inputdevice.cpp:1199
SetJoystick::getVdpads
const QHash< int, VDPad * > & getVdpads() const
Definition: setjoystick.cpp:1115
InputDevice::getCalibrationBackend
InputDeviceCalibration * getCalibrationBackend()
Returns a pointer to the internal calibration storage backend.
Definition: inputdevice.cpp:1738
InputDevice::reInitButtons
void reInitButtons()
Definition: inputdevice.cpp:108
InputDevice::getSDLName
virtual QString getSDLName()=0
JoyControlStickButton
Definition: joycontrolstickbutton.h:28
JoyControlStick::getRealJoyIndex
int getRealJoyIndex()
Definition: joycontrolstick.cpp:745
InputDeviceXml::InputDeviceXml
InputDeviceXml(InputDevice *inputDevice, QObject *parent=nullptr)
Definition: inputdevicexml.cpp:34
VDPad
Definition: vdpad.h:26
VDPad::addVButton
void addVButton(JoyDPadButton::JoyDPadDirections direction, JoyButton *button)
Definition: vdpad.cpp:134
InputDevice::setSensorName
void setSensorName(JoySensorType type, QString tempName)
Sets the name of a sensor in all sets Used during XML loading.
Definition: inputdevice.cpp:953
InputDeviceXml::readConfig
void readConfig(QXmlStreamReader *xml)
Deserializes the given XML stream into an InputDevice object.
Definition: inputdevicexml.cpp:47
InputDeviceXml::readConfigSig
void readConfigSig(QXmlStreamReader *xml)
JoySensorButton::getRealJoyNumber
virtual int getRealJoyNumber() const override
Get a 0 indexed number of button.
Definition: joysensorbutton.cpp:43
InputDevice::setDPadName
void setDPadName(int dpadIndex, QString tempName)
Definition: inputdevice.cpp:968
InputDevice::getDeviceKeyPressTime
int getDeviceKeyPressTime()
Definition: inputdevice.cpp:1205
JoyDPad
Definition: joydpad.h:24
JoySensorButton
Represents a sensor mapping in a SetJoystick.
Definition: joysensorbutton.h:30
InputDeviceCalibration::writeConfig
void writeConfig(QXmlStreamWriter *xml) const
Writes all stored calibration values from the internal storage into the given XML stream.
Definition: inputdevicecalibration.cpp:182
inputdevice.h
JoyDPadButton
Definition: joydpadbutton.h:27
JoyControlStick
Represents stick of a joystick.
Definition: joycontrolstick.h:37
JoyButton
Represents a single joystick button being part of a SetJoystick Contains multiple JoyButtonSlots whic...
Definition: joybutton.h:46
JoyAxisButton
Definition: joyaxisbutton.h:29
JoyDPadButton::JoyDPadDirections
JoyDPadDirections
Definition: joydpadbutton.h:41
common.h
JoyAxis::getAxisName
virtual QString getAxisName()
Definition: joyaxis.cpp:722
JoyButton::getJoyNumber
int getJoyNumber()
Get 0 indexed number of SDL button index.
Definition: joybutton.cpp:358
JoySensorDirection
JoySensorDirection
A bitfield style enum which encodes all possible three dimensional sensor directions....
Definition: joysensordirection.h:27
JoyAxis::getNAxisButton
JoyAxisButton * getNAxisButton()
Definition: joyaxis.cpp:461
WARN
#define WARN()
Definition: logger.h:44
SetJoystick::getButtons
const QHash< int, JoyButton * > & getButtons() const
Definition: setjoystick.cpp:1103
joysensorbutton.h
JoyAxisButton::getAxis
JoyAxis * getAxis() const
Definition: joyaxisbutton.cpp:183
InputDevice::setButtonName
void setButtonName(int index, QString tempName)
Definition: inputdevice.cpp:798
InputDevice::setAxisButtonName
void setAxisButtonName(int axisIndex, int buttonIndex, QString tempName)
Definition: inputdevice.cpp:812
SetJoystick::getAxes
QHash< int, JoyAxis * > * getAxes()
Definition: setjoystick.cpp:1101
SetJoystick::getSticks
const QHash< int, JoyControlStick * > & getSticks() const
Definition: setjoystick.cpp:1107
JoyDPad::getRealJoyNumber
int getRealJoyNumber()
Definition: joydpad.cpp:111
InputDevice::getJoystick_sets
QMap< int, SetJoystick * > & getJoystick_sets()
Definition: inputdevice.cpp:1715
InputDevice::setProfileName
void setProfileName(QString value)
Definition: inputdevice.cpp:1290
number
it is up to the author donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License If the distribution and or use of the Library is restricted in certain countries either by patents or by copyrighted the original copyright holder who places the Library under this License may add an geographical distribution limitation excluding those so that distribution is permitted only in or among countries not thus excluded In such this License incorporates the limitation as if written in the body of this License The Free Software Foundation may publish revised and or new versions of the Lesser General Public License from time to time Such new versions will be similar in spirit to the present but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Library specifies a version number of this License which applies to it and any later you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation If the Library does not specify a license version number
Definition: lgpl-2.1.txt:423
GlobalVariables::InputDevice::DEFAULTKEYPRESSTIME
static const int DEFAULTKEYPRESSTIME
Definition: globalvariables.h:105
InputDeviceXml::m_mutex_read_config
QMutex m_mutex_read_config
Definition: inputdevicexml.h:55
InputDevice::setStickName
void setStickName(int stickIndex, QString tempName)
Definition: inputdevice.cpp:933
InputDevice::getUniqueIDString
virtual QString getUniqueIDString() const =0
InputDevice::setSensorButtonName
void setSensorButtonName(JoySensorType type, JoySensorDirection direction, QString tempName)
Sets the name of a mapped sensor button in all sets Used during XML loading.
Definition: inputdevice.cpp:862
InputDevice::elementsHaveNames
bool elementsHaveNames()
Definition: inputdevice.cpp:1509
InputDevice::getActiveSetJoystick
SetJoystick * getActiveSetJoystick()
Definition: inputdevice.cpp:563
JoyDPad::getDpadName
const QString getDpadName()
Definition: joydpad.cpp:513