AntiMicroX
xmlconfigwriter.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 XMLCONFIGWRITER_H
20 #define XMLCONFIGWRITER_H
21 
22 #include <QObject>
23 
24 class InputDevice;
25 class QXmlStreamWriter;
26 class InputDeviceXml;
27 class QFile;
28 
29 class XMLConfigWriter : public QObject
30 {
31  Q_OBJECT
32 
33  public:
34  explicit XMLConfigWriter(QObject *parent = nullptr);
36  void setFileName(QString filename);
37  bool hasError();
38  const QString getErrorString();
39 
40  const QXmlStreamWriter *getXml();
41  QString const &getFileName();
42  const QFile *getConfigFile();
43  const InputDevice *getJoystick();
44 
45  public slots:
46  void write(InputDeviceXml *joystickXml);
47 
48  private:
49  QXmlStreamWriter *xml;
50  QString fileName;
51  QFile *configFile;
56 };
57 
58 #endif // XMLCONFIGWRITER_H
XMLConfigWriter::write
void write(InputDeviceXml *joystickXml)
Write input device config from the current object into XML file.
Definition: xmlconfigwriter.cpp:63
XMLConfigWriter::getErrorString
const QString getErrorString()
Definition: xmlconfigwriter.cpp:100
XMLConfigWriter::fileName
QString fileName
Definition: xmlconfigwriter.h:50
XMLConfigWriter::XMLConfigWriter
XMLConfigWriter(QObject *parent=nullptr)
Definition: xmlconfigwriter.cpp:30
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::writeConfig
void writeConfig(QXmlStreamWriter *xml)
Serializes an InputDevice object into the the given XML stream.
Definition: inputdevicexml.cpp:381
inputdevicexml.h
InputDeviceXml
Generic InputDevice XML serialization/deserialization helper class Reads data from the supplied Input...
Definition: inputdevicexml.h:37
XMLConfigWriter::~XMLConfigWriter
~XMLConfigWriter()
Definition: xmlconfigwriter.cpp:41
XMLConfigWriter::m_joystick
InputDevice * m_joystick
Definition: xmlconfigwriter.h:52
XMLConfigWriter::configFile
QFile * configFile
Definition: xmlconfigwriter.h:51
XMLConfigWriter::m_joystickXml
InputDeviceXml * m_joystickXml
Definition: xmlconfigwriter.h:53
XMLConfigWriter::getFileName
const QString & getFileName()
Definition: xmlconfigwriter.cpp:104
XMLConfigWriter::writerErrorString
QString writerErrorString
Definition: xmlconfigwriter.h:55
inputdevice.h
XMLConfigWriter::getJoystick
const InputDevice * getJoystick()
Definition: xmlconfigwriter.cpp:108
common.h
XMLConfigWriter::getConfigFile
const QFile * getConfigFile()
Definition: xmlconfigwriter.cpp:106
XMLConfigWriter::xml
QXmlStreamWriter * xml
Definition: xmlconfigwriter.h:49
XMLConfigWriter::hasError
bool hasError()
Definition: xmlconfigwriter.cpp:98
XMLConfigWriter::writerError
bool writerError
Definition: xmlconfigwriter.h:54
XMLConfigWriter::getXml
const QXmlStreamWriter * getXml()
Definition: xmlconfigwriter.cpp:102
XMLConfigWriter
Definition: xmlconfigwriter.h:29