source: flair-src/branches/sanscv/tools/FlairGCS/src/XmlWidget.h@ 329

Last change on this file since 329 was 324, checked in by Sanahuja Guillaume, 5 years ago

removing opencv dependency

File size: 2.3 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5#ifndef XMLWIDGET_H
6#define XMLWIDGET_H
7
8#include <QObject>
9#include <stdint.h>
10#include <qdom.h>
11#include <QPalette>
12
13class QWidget;
14class ConnectionLayout;
15
16class XmlWidget : public QObject {
17 Q_OBJECT
18
19public:
20 XmlWidget(QString name, QString type, XmlWidget *parent);
21 ~XmlWidget();
22 QDomDocument XmlDoc(void);
23 void ParseXml(QDomElement *to_parse);
24 void GetFullXml(QDomElement *doc);
25 void GetUpdateXml(QDomElement *doc);
26 void ResetAllChilds(void);
27 virtual bool IsUptodate(void) { return true; };
28 void LoadXml(QDomElement *to_parse);
29 void RenamedFrom(QString old_name);
30 QString Name(void);
31
32private:
33 QDomDocument document;
34 QDomElement write_elem;
35 XmlWidget *GetXmlWidget(QString name, QString type);
36 static void merge(QDomElement *from, QDomElement *into);
37 bool isExpandable; // true if we can receive extra frame for this widget (ex
38 // combobox, plots, layout)
39 bool isContainer; // true if it can contain other widget (ex layout),
40 // isExpandable is also true in this case
41 virtual void SetUptodate(void){};
42 virtual void Reset(void){};
43 XmlWidget *parent_widget;
44
45protected:
46 QList<XmlWidget *> *childs;
47 ConnectionLayout *connectionLayout(void);
48 QWidget *visible_widget;
49 QPalette red_pal, red_pal_greyed;
50 QPalette black_pal, black_pal_greyed;
51 void SetIsContainer(bool status);
52 void SetIsExpandable(bool status);
53 virtual void XmlEvent(QDomElement *dom){};
54 virtual void LoadEvent(QDomElement *dom){};
55 QDomElement *AddXmlChild(QString type);
56 void RemoveXmlChild(QDomElement *element);
57 void ClearDoc(void);
58 void SetValue(QString value);
59 void SetAttribute(const QString &name, const QString &value);
60 void SetAttribute(const QString &name, qlonglong value);
61 void SetAttribute(const QString &name, qulonglong value);
62 inline void SetAttribute(const QString &name, int value) {
63 SetAttribute(name, qlonglong(value));
64 }
65 inline void SetAttribute(const QString &name, uint value) {
66 SetAttribute(name, qulonglong(value));
67 }
68 void SetAttribute(const QString &name, float value);
69 void SetAttribute(const QString &name, double value);
70 void RemoveAllAttributes(); //except name
71 void RemoveAttribute(const QString &name);
72};
73
74#endif // XMLWIDGET_H
Note: See TracBrowser for help on using the repository browser.