00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef DESIGNERGUI_H
00023 #define DESIGNERGUI_H
00024
00025 #include <QObject>
00026 #include <QList>
00027 #include <QString>
00028 #include <QMap>
00029 class QXmlStreamReader;
00030 #include "qvgui/qvgui.h"
00031 #include "facade/itemproperties.h"
00032 #include "facade/itemfactory.h"
00033 #include "slate/slatewindow.h"
00034 #include "slate/informer.h"
00035
00036 #ifndef DOXYGEN_IGNORE_THIS
00037
00038 class QVPropertyContainer;
00039 class QVPropertyContainerChange;
00040
00041
00042 class QVDesignerGUI: QObject, QVGUI
00043 {
00044 Q_OBJECT
00045
00046 public:
00047 QVDesignerGUI();
00048
00050
00052 virtual void init();
00053
00055 void show();
00056
00057
00059
00060
00061 QMap<QString, QList<QString> > getItemTypes() const;
00062
00063
00064 QMap<QString, QList<QString> > getInputItemTypes() const;
00065
00066
00067 QMap<QString, QList<QString> > getMiddleItemTypes() const;
00068
00069
00070 QMap<QString, QList<QString> > getOutputItemTypes() const;
00071
00072 QString getCppText() const;
00073
00074 QString getXMLText();
00075
00076 bool loadXML(QString text);
00077
00078
00080
00081
00082 uint addItem(const QString type, const QString name, uint lastId = 0);
00083
00084
00085 bool addLink(const uint fromId, const QString fromProp, const uint toId, const QString toProp, const bool synchronous, const bool sequential);
00086
00087
00088 bool delItem(const uint id);
00089
00090
00091 bool delLink(const uint fromId, const QString fromProp, const uint toId, const QString toProp);
00092
00093
00094 template <class Type> bool setProperty(const uint fromId, const QString fromProp, const Type &value);
00095
00096 bool setName(const uint id, const QString name);
00097
00098 void showProperties(const uint id);
00099
00101
00102
00103 void run();
00104
00105
00106 void stop();
00107
00108 public slots:
00109 void quit();
00110 void processChange(QVPropertyContainerChange change);
00111 void dialogChange(QVPropertyContainerChange change);
00112
00113 private:
00114 bool createDialog(const uint itemId);
00115 void deleteDialog(const uint itemId);
00116 QString getLinkName(QVPropertyContainerChange change);
00117 QString getLinkName(QString fromName, QString fromProp, QString toName, QString toProp);
00118 QString getAbsPropName(QString fromName, QString fromProp);
00119 void createGroups(QList<GroupInfo> &lastGroups, QMap<uint, uint> &oldId_To_NewId);
00120
00121 bool readXMLQVApplication(QXmlStreamReader &xmlReader);
00122 bool readXMLNodes(QXmlStreamReader &xmlReader);
00123 bool readXMLNode(QXmlStreamReader &xmlReader);
00124 bool readXMLProperty(QXmlStreamReader &xmlReader, uint id);
00125 bool readXMLLinks(QXmlStreamReader &xmlReader);
00126 bool readXMLAsynchronousLink(QXmlStreamReader &xmlReader);
00127 bool readXMLSynchronousLink(QXmlStreamReader &xmlReader);
00128 bool readXMLSequentialLink(QXmlStreamReader &xmlReader);
00129 bool readXMLGroups(QXmlStreamReader &xmlReader);
00130 bool readXMLGroup(QXmlStreamReader &xmlReader, QList<GroupInfo> &groupInfos);
00131 bool readXMLChildNode(QXmlStreamReader &xmlReader, GroupInfo &groupInfo);
00132 bool readXMLChildGroup(QXmlStreamReader &xmlReader, GroupInfo &groupInfo);
00133 bool readXMLVisibleNodeLink(QXmlStreamReader &xmlReader, GroupInfo &groupInfo);
00134 bool readXMLVisibleGroupLink(QXmlStreamReader &xmlReader, GroupInfo &groupInfo);
00135 bool readXMLUnknownElement(QXmlStreamReader &xmlReader);
00136
00137 ItemFactory factory;
00138 SlateWindow slate;
00139 Informer informer;
00140
00141 QMap<uint, QVPropertyContainer *> containers;
00142 QMap<uint, QVPropertyContainer *> initialContainers;
00143 QMap<uint, QDialog *> dialogs;
00144 QMap<uint, uint> dialogsToContainers;
00145
00146 class CreatedLink
00147 {
00148 public:
00149 CreatedLink(const uint _fromId, const QString _fromProp, const uint _toId, const QString _toProp, const bool _sync, const bool _sequ):
00150 fromId(_fromId), fromProp(_fromProp), toId(_toId), toProp(_toProp), synchronous(_sync), sequential(_sequ) { }
00151
00152 uint fromId;
00153 QString fromProp;
00154 uint toId;
00155 QString toProp;
00156 bool synchronous;
00157 bool sequential;
00158 };
00159
00160 class CreatedItem
00161 {
00162 public:
00163 CreatedItem(): type(""), name(""), id(0) { }
00164 CreatedItem(const QString _type, const QString _name, uint _id): type(_type), name(_name), id(_id) { }
00165
00166 QString type, name;
00167 uint id;
00168 };
00169
00170 class PropertyChange
00171 {
00172 public:
00173 PropertyChange(const uint contId, const QString prop, const QVariant val): id(contId), propName(prop), value(val) { }
00174
00175 uint id;
00176 QString propName;
00177 QVariant value;
00178 };
00179
00180 QMap<QString, CreatedLink> createdLinks;
00181 QMap<uint, CreatedItem> createdItems;
00182 QMap<QString, PropertyChange> propertyChanges;
00183
00184 QMap<uint, uint> XMLId_To_ContainersId;
00185 };
00186
00187 #endif
00188
00189 #endif
00190