AntiMicroX
Loading...
Searching...
No Matches
xmlconfigreader.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 XMLCONFIGREADER_H
20#define XMLCONFIGREADER_H
21
22#include <QObject>
23#include <QStringList>
24
25class InputDevice;
27class InputDeviceXml;
28class QFile;
29
33class XMLConfigReader : public QObject
34{
36
37 public:
38 explicit XMLConfigReader(QObject *parent = nullptr);
40 void setJoystick(InputDevice *joystick);
41 void setFileName(QString filename);
42 const QString getErrorString();
43 bool hasError();
44 bool read();
45
46 const QXmlStreamReader *getXml();
47 QString const &getFileName();
48 const QFile *getConfigFile();
49 const InputDevice *getJoystick();
51
52 protected:
53 void initDeviceTypes();
54
55 public slots:
56 void configJoystick(InputDevice *joystick);
57
58 private:
64};
65
66#endif // XMLCONFIGREADER_H
Generic InputDevice XML serialization/deserialization helper class Reads data from the supplied Input...
Definition inputdevicexml.h:38
Abstract class representing a hardware input device, e.g a joystick or controller.
Definition inputdevice.h:51
Definition joydpadxml.h:27
Main XML config reader class.
Definition xmlconfigreader.h:34
const InputDevice * getJoystick()
Definition xmlconfigreader.cpp:202
~XMLConfigReader()
Definition xmlconfigreader.cpp:50
QString const & getFileName()
Definition xmlconfigreader.cpp:198
void initDeviceTypes()
Definition xmlconfigreader.cpp:189
QXmlStreamReader * xml
Definition xmlconfigreader.h:59
void configJoystick(InputDevice *joystick)
Read input device config from the current XML file into the InputDevice object.
Definition xmlconfigreader.cpp:91
bool hasError()
Definition xmlconfigreader.cpp:187
QStringList deviceTypes
Definition xmlconfigreader.h:63
QFile * configFile
Definition xmlconfigreader.h:61
const QFile * getConfigFile()
Definition xmlconfigreader.cpp:200
const QString getErrorString()
Definition xmlconfigreader.cpp:177
void setJoystick(InputDevice *joystick)
Definition xmlconfigreader.cpp:68
InputDevice * m_joystick
Definition xmlconfigreader.h:62
void setFileName(QString filename)
Sets the filename of the to be read XML file.
Definition xmlconfigreader.cpp:73
QStringList const & getDeviceTypes()
Definition xmlconfigreader.cpp:204
QString fileName
Definition xmlconfigreader.h:60
const QXmlStreamReader * getXml()
Definition xmlconfigreader.cpp:196
bool read()
Definition xmlconfigreader.cpp:97