PARP Research Group University of Murcia, Spain


src/qvgui/qvdesigner/qvdesignergui.h

00001 /*
00002  *      Copyright (C) 2008. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
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 #include "qvgui/qvgui.h"
00030 #include "facade/itemproperties.h"
00031 #include "facade/itemfactory.h"
00032 #include "slate/slatewindow.h"
00033 #include "slate/informer.h"
00034 
00035 #ifndef DOXYGEN_IGNORE_THIS
00036 
00037 class QVPropertyContainer;
00038 class QVPropertyContainerChange;
00039 
00040 // Clase que se encargará de hacer de intermediario entre la vista y el modelo (el slate y la QVAplication)
00041 class QVDesignerGUI: QObject, QVGUI
00042 {
00043         Q_OBJECT
00044         
00045         public:
00046                 QVDesignerGUI();
00047 
00049 
00051                 virtual void init();
00052         
00054                 void show();
00055 
00056 
00058 
00059                 // devuelve la lista de Items disponibles en el sistema, cada uno de estos items es un elemento del diseño de los programas de QVision
00060                 QList<QString> getItemTypes() const;
00061         
00062                 // devuelve la lista de Items de entrada disponibles en el sistema, cada uno de estos items es un elemento del diseño de los programas de QVision
00063                 QList<QString> getInputItemTypes() const;
00064         
00065                 // devuelve la lista de Items intermedios disponibles en el sistema, cada uno de estos items es un elemento del diseño de los programas de QVision
00066                 QList<QString> getMiddleItemTypes() const;
00067         
00068                 // devuelve la lista de Items de salida disponibles en el sistema, cada uno de estos items es un elemento del diseño de los programas de QVision
00069                 QList<QString> getOutputItemTypes() const;
00070 
00071                 QString getCppText() const;
00072 
00073                 QString getXMLText() const;
00074 
00075 
00077 
00078                 // crea y registra un item, del tipo especificado y nombre concreto, en el sistema
00079                 bool addItem(const QString type, const QString name);
00080         
00081                 // crea y registra un link entre dos items del sistema
00082                 bool addLink(const QString fromName, const QString fromProp, const QString toName, const QString toProp, const bool synchronous, const bool sequential);
00083 
00084                 // borra y desregistra un item
00085                 bool delItem(const QString name);
00086         
00087                 // borra y desregistra un link
00088                 bool delLink(const QString fromName, const QString fromProp, const QString toName, const QString toProp);
00089 
00090                 // establece el valor de la propiedad de un item del sistema
00091                 template <class Type> bool setProperty(const QString fromName, const QString fromProp, const Type &value);
00092 
00093                 void showProperties(const QString itemName);
00094 
00096 
00097                 // lanza un sistema como el compuesto en la pizarra
00098                 void run();
00099         
00100                 // para el sistema lanzado
00101                 void stop();
00102 
00103         public slots:
00104                 void quit();
00105                 void processChange(QVPropertyContainerChange change);
00106                 void dialogChange(QVPropertyContainerChange change);
00107 
00108         private:
00109                 bool createDialog(const QString itemName);
00110                 void deleteDialog(const QString itemName);
00111                 QString getLinkName(QVPropertyContainerChange change);
00112                 QString getLinkName(QString fromName, QString fromProp, QString toName, QString toProp);
00113                 QString getAbsPropName(QString fromName, QString fromProp);
00114 
00115                 ItemFactory factory;
00116                 SlateWindow slate;
00117                 Informer informer;
00118 
00119                 QMap<QString, QVPropertyContainer *> containers;
00120                 QMap<QString, QVPropertyContainer *> initialContainers;
00121                 QMap<QString, QDialog *> dialogs;
00122 
00123                         class CreatedLink
00124                                 {
00125                                 public:
00126                                         CreatedLink(const QString _fromName, const QString _fromProp, const QString _toName, const QString _toProp, const bool _sync, const bool _sequ):
00127                                                 fromName(_fromName), fromProp(_fromProp), toName(_toName), toProp(_toProp), synchronous(_sync), sequential(_sequ) { }
00128 
00129                                         QString fromName, fromProp, toName, toProp;
00130                                         bool synchronous;
00131                                         bool sequential;
00132                                 };
00133 
00134                         class CreatedItem
00135                                 {
00136                                 public:
00137                                         CreatedItem(const QString _type, const QString _name): type(_type), name(_name) { }
00138 
00139                                         QString type, name;
00140                                 };
00141 
00142                         class PropertyChange
00143                                 {
00144                                 public:
00145                                         PropertyChange(const QString cont, const QString prop, const QVariant val): contName(cont), propName(prop), value(val) { }
00146 
00147                                         QString contName, propName;
00148                                         QVariant value;
00149                                 };
00150 
00151                 QMap<QString, CreatedLink> createdLinks; // the key is "fromName[fromProp] => toName[toProp]"
00152                 QMap<QString, CreatedItem> createdItems;
00153                 QMap<QString, PropertyChange> propertyChanges; // the key is "contName[propName]"
00154 };
00155 
00156 #endif
00157 
00158 #endif
00159 



QVision framework. PARP research group, copyright 2007, 2008.