2
* Copyright 2008 Aike J Sommer <dev@aikesommer.name>
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
6
* published by the Free Software Foundation; either version 2,
7
* or (at your option) any later version.
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
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#include "configurations_xml.h"
24
#include "xmlnodehandler.h"
29
class ScreenXMLFactory : public XMLFactory {
31
virtual XMLType * newInstance() { return new ScreenXML(); }
32
virtual void schema() {
33
INT_ATTRIBUTE("id", ScreenXML, id, setId);
34
BOOL_ELEMENT("privacy", ScreenXML, privacy, setPrivacy);
35
INT_ELEMENT("right-of", ScreenXML, rightOf, setRightOf);
36
INT_ELEMENT("bottom-of", ScreenXML, bottomOf, setBottomOf);
41
class ConfigurationXMLFactory : public XMLFactory {
43
virtual XMLType * newInstance() { return new ConfigurationXML(); }
44
virtual void schema() {
45
STRING_ATTRIBUTE("name", ConfigurationXML, name, setName);
46
INT_ATTRIBUTE("primary", ConfigurationXML, primaryScreen, setPrimaryScreen);
47
BOOL_ATTRIBUTE("modifiable", ConfigurationXML, modifiable, setModifiable);
48
COMPLEX_ELEMENT_LIST("screen", ConfigurationXML, screens, new ScreenXMLFactory(), ScreenXML);
53
class OutputXMLFactory : public XMLFactory {
55
virtual XMLType * newInstance() { return new OutputXML(); }
56
virtual void schema() {
57
STRING_ATTRIBUTE("name", OutputXML, name, setName);
58
INT_ATTRIBUTE("screen", OutputXML, screen, setScreen);
59
STRING_ELEMENT("vendor", OutputXML, vendor, setVendor);
60
INT_ELEMENT("product", OutputXML, product, setProduct);
61
UINT_ELEMENT("serial", OutputXML, serial, setSerial);
62
INT_ELEMENT("width", OutputXML, width, setWidth);
63
INT_ELEMENT("height", OutputXML, height, setHeight);
64
INT_ELEMENT("rotation", OutputXML, rotation, setRotation);
65
BOOL_ELEMENT("reflect-x", OutputXML, reflectX, setReflectX);
66
BOOL_ELEMENT("reflect-y", OutputXML, reflectY, setReflectY);
67
DOUBLE_ELEMENT("refresh-rate", OutputXML, rate, setRate);
72
class OutputsXMLFactory : public XMLFactory {
74
virtual XMLType * newInstance() { return new OutputsXML(); }
75
virtual void schema() {
76
STRING_ATTRIBUTE("configuration", OutputsXML, configuration, setConfiguration);
77
COMPLEX_ELEMENT_LIST("output", OutputsXML, outputs, new OutputXMLFactory(), OutputXML);
81
ScreenXML::ScreenXML(QObject * parent)
82
: XMLType(parent), m_rightOf(-1), m_bottomOf(-1)
86
ScreenXML::~ScreenXML()
90
OutputXML::OutputXML(QObject * parent)
91
: XMLType(parent), m_screen(-1), m_product(-1), m_serial(0),
92
m_width(-1), m_height(-1), m_rotation(0),
93
m_reflectX(false), m_reflectY(false), m_rate(0)
96
OutputXML::~OutputXML()
99
ConfigurationXML::ConfigurationXML(QObject * parent)
100
: XMLType(parent), m_modifiable(true), m_primaryScreen(0)
103
ConfigurationXML::~ConfigurationXML()
107
OutputsXML::OutputsXML(QObject * parent)
112
OutputsXML::~OutputsXML()
116
QList<ScreenXML *> & ConfigurationXML::screens() { return m_screens; }
118
ConfigurationsXML::ConfigurationsXML(QObject * parent)
119
: XMLType(parent), m_polling(false)
123
ConfigurationsXML::~ConfigurationsXML()
127
QList<ConfigurationXML *> & ConfigurationsXML::configurations() { return m_configurations; }
128
QList<OutputsXML *> & ConfigurationsXML::outputs() { return m_outputs; }
130
ConfigurationsXMLFactory::ConfigurationsXMLFactory() : XMLRootFactory("configurations") {
132
ConfigurationsXMLFactory::~ConfigurationsXMLFactory()
136
XMLType * ConfigurationsXMLFactory::newInstance() {
137
return new ConfigurationsXML();
140
void ConfigurationsXMLFactory::schema() {
141
BOOL_ELEMENT("polling", ConfigurationsXML, polling, setPolling);
142
COMPLEX_ELEMENT_LIST("configuration", ConfigurationsXML, configurations, new ConfigurationXMLFactory(), ConfigurationXML);
143
COMPLEX_ELEMENT_LIST("outputs", ConfigurationsXML, outputs, new OutputsXMLFactory(), OutputsXML);