not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / libs / kephal / xml / configurations_xml.cpp
blobcfdb3b9bb81a61a1a81cf747b618f90ba8cff286
1 /*
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"
23 #include <QDebug>
24 #include "xmlnodehandler.h"
27 namespace Kephal {
29 class ScreenXMLFactory : public XMLFactory {
30 protected:
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);
42 ConfigurationXML::ConfigurationXML()
43 : m_modifiable(true),
44 m_primaryScreen(0)
45 { }
47 QList<ScreenXML *> & ConfigurationXML::screens() { return m_screens; }
50 class ConfigurationXMLFactory : public XMLFactory {
51 protected:
52 virtual XMLType * newInstance() { return new ConfigurationXML(); }
53 virtual void schema() {
54 STRING_ATTRIBUTE("name", ConfigurationXML, name, setName);
55 INT_ATTRIBUTE("primary", ConfigurationXML, primaryScreen, setPrimaryScreen);
56 BOOL_ATTRIBUTE("modifiable", ConfigurationXML, modifiable, setModifiable);
57 COMPLEX_ELEMENT_LIST("screen", ConfigurationXML, screens, new ScreenXMLFactory(), ScreenXML);
62 class OutputXMLFactory : public XMLFactory {
63 protected:
64 virtual XMLType * newInstance() { return new OutputXML(); }
65 virtual void schema() {
66 STRING_ATTRIBUTE("name", OutputXML, name, setName);
67 INT_ATTRIBUTE("screen", OutputXML, screen, setScreen);
68 STRING_ELEMENT("vendor", OutputXML, vendor, setVendor);
69 INT_ELEMENT("product", OutputXML, product, setProduct);
70 UINT_ELEMENT("serial", OutputXML, serial, setSerial);
71 INT_ELEMENT("width", OutputXML, width, setWidth);
72 INT_ELEMENT("height", OutputXML, height, setHeight);
73 INT_ELEMENT("rotation", OutputXML, rotation, setRotation);
74 BOOL_ELEMENT("reflect-x", OutputXML, reflectX, setReflectX);
75 BOOL_ELEMENT("reflect-y", OutputXML, reflectY, setReflectY);
76 DOUBLE_ELEMENT("refresh-rate", OutputXML, rate, setRate);
81 class OutputsXMLFactory : public XMLFactory {
82 protected:
83 virtual XMLType * newInstance() { return new OutputsXML(); }
84 virtual void schema() {
85 STRING_ATTRIBUTE("configuration", OutputsXML, configuration, setConfiguration);
86 COMPLEX_ELEMENT_LIST("output", OutputsXML, outputs, new OutputXMLFactory(), OutputXML);
91 QList<ConfigurationXML *> & ConfigurationsXML::configurations() { return m_configurations; }
92 QList<OutputsXML *> & ConfigurationsXML::outputs() { return m_outputs; }
94 ConfigurationsXMLFactory::ConfigurationsXMLFactory() : XMLRootFactory("configurations") {
97 XMLType * ConfigurationsXMLFactory::newInstance() {
98 return new ConfigurationsXML();
101 void ConfigurationsXMLFactory::schema() {
102 BOOL_ELEMENT("polling", ConfigurationsXML, polling, setPolling);
103 COMPLEX_ELEMENT_LIST("configuration", ConfigurationsXML, configurations, new ConfigurationXMLFactory(), ConfigurationXML);
104 COMPLEX_ELEMENT_LIST("outputs", ConfigurationsXML, outputs, new OutputsXMLFactory(), OutputsXML);