AntiMicroX
joytabwidgethelper.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 JOYTABWIDGETHELPER_H
20 #define JOYTABWIDGETHELPER_H
21 
22 #include <QObject>
23 
24 class InputDevice;
25 class XMLConfigReader;
26 class XMLConfigWriter;
27 
28 class JoyTabWidgetHelper : public QObject
29 {
30  Q_OBJECT
31 
32  public:
33  explicit JoyTabWidgetHelper(InputDevice *device, QObject *parent = nullptr);
35 
36  bool hasReader();
38 
39  bool hasWriter();
41 
42  bool hasError();
43  QString getErrorString();
44 
45  protected:
50  QString lastErrorString;
51 
52  public slots:
53  bool readConfigFile(QString filepath);
54  bool readConfigFileWithRevert(QString filepath);
55  bool writeConfigFile(QString filepath);
56  void reInitDevice();
58 };
59 
60 #endif // JOYTABWIDGETHELPER_H
JoyTabWidgetHelper::getReader
XMLConfigReader * getReader()
Definition: joytabwidgethelper.cpp:59
XMLConfigWriter::write
void write(InputDeviceXml *joystickXml)
Write input device config from the current object into XML file.
Definition: xmlconfigwriter.cpp:63
VERBOSE
#define VERBOSE()
Definition: logger.h:42
JoyTabWidgetHelper::reInitDeviceWithRevert
void reInitDeviceWithRevert()
Definition: joytabwidgethelper.cpp:146
xmlconfigreader.h
InputDevice::transferReset
void transferReset()
Obtain current joystick element values, create new SetJoystick objects, and then transfer most recent...
Definition: inputdevice.cpp:84
JoyTabWidgetHelper::hasWriter
bool hasWriter()
Definition: joytabwidgethelper.cpp:61
InputDevice::getActiveSetNumber
int getActiveSetNumber()
Definition: inputdevice.cpp:561
logger.h
JoyTabWidgetHelper::device
InputDevice * device
Definition: joytabwidgethelper.h:46
JoyTabWidgetHelper::lastErrorString
QString lastErrorString
Definition: joytabwidgethelper.h:50
InputDevice
Abstract class representing a hardware input device, e.g a joystick or controller.
Definition: inputdevice.h:50
XMLConfigWriter::setFileName
void setFileName(QString filename)
Sets the filename of the to be written XML file.
Definition: xmlconfigwriter.cpp:91
xmlconfigwriter.h
inputdevicexml.h
XMLConfigReader::configJoystick
void configJoystick(InputDevice *joystick)
Read input device config from the current XML file into the InputDevice object.
Definition: xmlconfigreader.cpp:91
JoyTabWidgetHelper
Definition: joytabwidgethelper.h:28
InputDeviceXml
Generic InputDevice XML serialization/deserialization helper class Reads data from the supplied Input...
Definition: inputdevicexml.h:37
joybuttonslot.h
JoyTabWidgetHelper::writeConfigFile
bool writeConfigFile(QString filepath)
XML write entry point for the GUI.
Definition: joytabwidgethelper.cpp:110
JoyTabWidgetHelper::~JoyTabWidgetHelper
~JoyTabWidgetHelper()
Definition: joytabwidgethelper.cpp:42
XMLConfigReader::setFileName
void setFileName(QString filename)
Sets the filename of the to be read XML file.
Definition: xmlconfigreader.cpp:73
JoyTabWidgetHelper::hasError
bool hasError()
Definition: joytabwidgethelper.cpp:65
InputDevice::reInitButtons
void reInitButtons()
Definition: inputdevice.cpp:108
joytabwidgethelper.h
InputDevice::establishPropertyUpdatedConnection
void establishPropertyUpdatedConnection()
Definition: inputdevice.cpp:1236
JoyTabWidgetHelper::errorOccurred
bool errorOccurred
Definition: joytabwidgethelper.h:49
XMLConfigReader
Main XML config reader class.
Definition: xmlconfigreader.h:33
inputdevice.h
joybutton.h
JoyTabWidgetHelper::getWriter
XMLConfigWriter * getWriter()
Definition: joytabwidgethelper.cpp:63
JoyTabWidgetHelper::writer
XMLConfigWriter * writer
Definition: joytabwidgethelper.h:48
JoyTabWidgetHelper::reader
XMLConfigReader * reader
Definition: joytabwidgethelper.h:47
JoyTabWidgetHelper::readConfigFileWithRevert
bool readConfigFileWithRevert(QString filepath)
Definition: joytabwidgethelper.cpp:100
InputDevice::revertProfileEdited
void revertProfileEdited()
Definition: inputdevice.cpp:1218
JoyTabWidgetHelper::readConfigFile
bool readConfigFile(QString filepath)
XML read entry point for the GUI.
Definition: joytabwidgethelper.cpp:72
InputDevice::disconnectPropertyUpdatedConnection
void disconnectPropertyUpdatedConnection()
Definition: inputdevice.cpp:1241
JoyTabWidgetHelper::getErrorString
QString getErrorString()
Definition: joytabwidgethelper.cpp:67
XMLConfigWriter::hasError
bool hasError()
Definition: xmlconfigwriter.cpp:98
XMLConfigReader::hasError
bool hasError()
Definition: xmlconfigreader.cpp:187
InputDevice::setActiveSetNumber
void setActiveSetNumber(int index)
Definition: inputdevice.cpp:144
JoyTabWidgetHelper::reInitDevice
void reInitDevice()
Definition: joytabwidgethelper.cpp:130
XMLConfigWriter
Definition: xmlconfigwriter.h:29
InputDevice::resetButtonDownCount
void resetButtonDownCount()
Definition: inputdevice.cpp:1123
JoyTabWidgetHelper::hasReader
bool hasReader()
Definition: joytabwidgethelper.cpp:57
JoyTabWidgetHelper::JoyTabWidgetHelper
JoyTabWidgetHelper(InputDevice *device, QObject *parent=nullptr)
Definition: joytabwidgethelper.cpp:31