00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <qvgui/qvparamsinspectorwidget.h>
00026
00027 #include <QtGui/QWidget>
00028
00029 #include <qvcore/qvpropertycontainer.h>
00030 #include <qvcore/qvworker.h>
00031 #include <qvgui/qvparamwidget.h>
00032 #include <qvdta/qvindexedstringlist.h>
00033
00034 QVParamsInspectorWidget::QVParamsInspectorWidget(QVPropertyContainer *holder, QWidget *parent):QWidget(parent)
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 foreach(QString property, holder->getPropertyList())
00046 if(holder->isLinkedInput(property) or not holder->isInput(property) or holder->isGUIInvisible(property))
00047 continue;
00048 else if(holder->isType<int>(property))
00049 {
00050 QVIntParamWidget *int_widget = new QVIntParamWidget(holder,this,property);
00051 vboxLayout->addWidget(int_widget);
00052 writeOutputProperties();
00053 connect(int_widget,SIGNAL(valueChanged(int)),this,SLOT(somePropertyChanged()));
00054 }
00055 else if(holder->isType<double>(property))
00056 {
00057 QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00058 vboxLayout->addWidget(double_widget);
00059 writeOutputProperties();
00060 connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00061 }
00062 else if(holder->isType<bool>(property))
00063 {
00064 QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00065 vboxLayout->addWidget(bool_widget);
00066 writeOutputProperties();
00067 connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00068 }
00069 else if(holder->isType<QString>(property))
00070 {
00071 QVStringParamWidget *st_widget = new QVStringParamWidget(holder,this,property);
00072 vboxLayout->addWidget(st_widget);
00073 writeOutputProperties();
00074 connect(st_widget,SIGNAL(valueChanged(QString)),this,SLOT(somePropertyChanged()));
00075 }
00076 else if(holder->isType<QVIndexedStringList>(property))
00077 {
00078 QVStringListParamWidget *sl_widget = new QVStringListParamWidget(holder,this,property);
00079 vboxLayout->addWidget(sl_widget);
00080 writeOutputProperties();
00081 connect(sl_widget,SIGNAL(valueChanged(QVIndexedStringList)),this,SLOT(somePropertyChanged()));
00082 }
00083
00084 vboxLayout->addStretch();
00085 }
00086
00087 void QVParamsInspectorWidget::somePropertyChanged()
00088 {
00089 writeOutputProperties();
00090 }