src/qvgui/qvparamsinspectorwidget.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 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 
00024 
00025 #include <qvgui/qvparamwidget.h>
00026 #include <qvgui/qvparamsinspectorwidget.h>
00027 #include <QtGui/QWidget>
00028 
00029 #include <QVWorker>
00030 #include <QVIndexedStringList>
00031 
00032 QVParamsInspectorWidget::QVParamsInspectorWidget(QVPropertyContainer *holder, QWidget *parent):
00033         QWidget(parent), QVPropertyContainer("QVParamsInspectorWidget for " + holder->getName())
00034         {
00035         //setGeometry(QRect(10, 20, 200, 0));
00036         vboxLayout = new QVBoxLayout(this);
00037         vboxLayout->setSpacing(0);
00038 
00039         QVWorker *worker;
00040         if((worker = dynamic_cast<QVWorker*>(holder)) != NULL)
00041                 foreach(QString property, worker->getTriggerList())
00042                         vboxLayout->addWidget(new QVWorkerTriggerWidget(worker, property, this));
00043 
00044         foreach(QString property, holder->getPropertyList())
00045                 if(holder->isLinkedInput(property) or not holder->isInput(property) or holder->isGUIInvisible(property))
00046                         continue;
00047                 else if(holder->isType<int>(property)) // if the property is int.
00048                         {
00049                         QVIntParamWidget *int_widget = new QVIntParamWidget(holder,this,property);
00050                         vboxLayout->addWidget(int_widget);
00051                         writeOutputProperties();
00052                         connect(int_widget,SIGNAL(valueChanged(int)),this,SLOT(somePropertyChanged()));
00053                         }
00054                 else if(holder->isType<double>(property)) // if the property is double.
00055                         {
00056                         QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00057                         vboxLayout->addWidget(double_widget);
00058                         writeOutputProperties();
00059                         connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00060                         }
00061                 else if(holder->isType<bool>(property)) // if the property is bool.
00062                         {
00063                         QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00064                         vboxLayout->addWidget(bool_widget);
00065                         writeOutputProperties();
00066                         connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00067                         }
00068                 else if(holder->isType<QString>(property)) // if the property is QString.
00069                         {
00070                         QVStringParamWidget *st_widget = new QVStringParamWidget(holder,this,property);
00071                         vboxLayout->addWidget(st_widget);
00072                         writeOutputProperties();
00073                         connect(st_widget,SIGNAL(valueChanged(QString)),this,SLOT(somePropertyChanged()));
00074                         }
00075                 else if(holder->isType<QVIndexedStringList>(property)) // if the property is QVIndexedStringList.
00076                         {
00077                         QVStringListParamWidget *sl_widget = new QVStringListParamWidget(holder,this,property);
00078                         vboxLayout->addWidget(sl_widget);
00079                         writeOutputProperties();
00080                         connect(sl_widget,SIGNAL(valueChanged(QVIndexedStringList)),this,SLOT(somePropertyChanged()));
00081                         }
00082 
00083         vboxLayout->addStretch();
00084         }
00085 
00086 void QVParamsInspectorWidget::somePropertyChanged()
00087         {
00088         writeOutputProperties();
00089         }