00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <qvgui/qvparamwidget.h>
00026 #include <qvgui/qvparamsinspectorwidget.h>
00027 #include <QtGui/QWidget>
00028 #include <QLabel>
00029
00030 #include <QVWorker>
00031 #include <QVIndexedStringList>
00032
00033 QVParamsInspectorWidget::QVParamsInspectorWidget(QVPropertyContainer *holder, QWidget *parent):
00034 QWidget(parent), QVPropertyContainer("QVParamsInspectorWidget for " + holder->getName())
00035 {
00036
00037 vboxLayout = new QVBoxLayout(this);
00038 vboxLayout->setSpacing(0);
00039
00040 QVWorker *worker;
00041 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL)
00042 foreach(QString property, worker->getTriggerList())
00043 vboxLayout->addWidget(new QVWorkerTriggerWidget(worker, property, this));
00044
00045 bool haveWidgets = false;
00046 foreach(QString property, holder->getPropertyList())
00047 if(holder->isLinkedInput(property) or not holder->isInput(property) or holder->isGUIInvisible(property))
00048 continue;
00049 else if(holder->isType<int>(property))
00050 {
00051 QVIntParamWidget *int_widget = new QVIntParamWidget(holder,this,property);
00052 vboxLayout->addWidget(int_widget);
00053 haveWidgets = true;
00054 writeOutputProperties();
00055 connect(int_widget,SIGNAL(valueChanged(int)),this,SLOT(somePropertyChanged()));
00056 }
00057 else if(holder->isType<double>(property))
00058 {
00059 QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00060 vboxLayout->addWidget(double_widget);
00061 haveWidgets = true;
00062 writeOutputProperties();
00063 connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00064 }
00065 else if(holder->isType<bool>(property))
00066 {
00067 QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00068 vboxLayout->addWidget(bool_widget);
00069 haveWidgets = true;
00070 writeOutputProperties();
00071 connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00072 }
00073 else if(holder->isType<QString>(property))
00074 {
00075 QVStringParamWidget *st_widget = new QVStringParamWidget(holder,this,property);
00076 vboxLayout->addWidget(st_widget);
00077 haveWidgets = true;
00078 writeOutputProperties();
00079 connect(st_widget,SIGNAL(valueChanged(QString)),this,SLOT(somePropertyChanged()));
00080 }
00081 else if(holder->isType<QVIndexedStringList>(property))
00082 {
00083 QVStringListParamWidget *sl_widget = new QVStringListParamWidget(holder,this,property);
00084 vboxLayout->addWidget(sl_widget);
00085 haveWidgets = true;
00086 writeOutputProperties();
00087 connect(sl_widget,SIGNAL(valueChanged(QVIndexedStringList)),this,SLOT(somePropertyChanged()));
00088 }
00089 else if(holder->isType<QColor>(property))
00090 {
00091 QVColorParamWidget *sl_widget = new QVColorParamWidget(holder,this,property);
00092 vboxLayout->addWidget(sl_widget);
00093 haveWidgets = true;
00094 writeOutputProperties();
00095 connect(sl_widget,SIGNAL(valueChanged(QColor)),this,SLOT(somePropertyChanged()));
00096 }
00097
00098 if (!haveWidgets)
00099 vboxLayout->addWidget(new QLabel("This container has no editable input properties."));
00100
00101 vboxLayout->addStretch();
00102 }
00103
00104 void QVParamsInspectorWidget::somePropertyChanged()
00105 {
00106 writeOutputProperties();
00107 }