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 <QLabel>
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
00036 inputWidget = new QWidget(this);
00037 outputWidget = new QWidget(this);
00038 inputVboxLayout = new QVBoxLayout(inputWidget);
00039 outputVboxLayout = new QVBoxLayout(outputWidget);
00040 inputVboxLayout->setSpacing(0);
00041 outputVboxLayout->setSpacing(0);
00042
00043 tabWidget = new QTabWidget(this);
00044 tabWidget->addTab(inputWidget, "input properties");
00045 tabWidget->addTab(outputWidget, "output properties");
00046
00047 vboxLayout = new QVBoxLayout(this);
00048 vboxLayout->setSpacing(0);
00049 vboxLayout->addWidget(tabWidget);
00050
00051
00052 QVWorker *worker;
00053 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL)
00054 foreach(QString property, worker->getTriggerList())
00055 inputVboxLayout->addWidget(new QVWorkerTriggerWidget(worker, property, this));
00056
00057 bool haveInputWidgets = false;
00058 bool haveOutputWidgets = false;
00059 foreach(QString property, holder->getPropertyList()) {
00060 if(not holder->isLinkedInput(property) && holder->isInput(property) && not holder->isGUIInvisible(property)) {
00061 if(holder->isType<int>(property))
00062 {
00063 QVIntParamWidget *int_widget = new QVIntParamWidget(holder,this,property);
00064 inputVboxLayout->addWidget(int_widget);
00065 haveInputWidgets = true;
00066 writeOutputProperties();
00067 connect(int_widget,SIGNAL(valueChanged(int)),this,SLOT(somePropertyChanged()));
00068 }
00069 else if(holder->isType<double>(property))
00070 {
00071 QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00072 inputVboxLayout->addWidget(double_widget);
00073 haveInputWidgets = true;
00074 writeOutputProperties();
00075 connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00076 }
00077 else if(holder->isType<bool>(property))
00078 {
00079 QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00080 inputVboxLayout->addWidget(bool_widget);
00081 haveInputWidgets = true;
00082 writeOutputProperties();
00083 connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00084 }
00085 else if(holder->isType<QString>(property))
00086 {
00087 QVStringParamWidget *st_widget = new QVStringParamWidget(holder,this,property);
00088 inputVboxLayout->addWidget(st_widget);
00089 haveInputWidgets = true;
00090 writeOutputProperties();
00091 connect(st_widget,SIGNAL(valueChanged(QString)),this,SLOT(somePropertyChanged()));
00092 }
00093 else if(holder->isType<QVIndexedStringList>(property))
00094 {
00095 QVStringListParamWidget *sl_widget = new QVStringListParamWidget(holder,this,property);
00096 inputVboxLayout->addWidget(sl_widget);
00097 haveInputWidgets = true;
00098 writeOutputProperties();
00099 connect(sl_widget,SIGNAL(valueChanged(QVIndexedStringList)),this,SLOT(somePropertyChanged()));
00100 }
00101 else if(holder->isType<QColor>(property))
00102 {
00103 QVColorParamWidget *sl_widget = new QVColorParamWidget(holder,this,property);
00104 inputVboxLayout->addWidget(sl_widget);
00105 haveInputWidgets = true;
00106 writeOutputProperties();
00107 connect(sl_widget,SIGNAL(valueChanged(QColor)),this,SLOT(somePropertyChanged()));
00108 }
00109 else if(holder->isType<QSize>(property))
00110 {
00111 QVSizeParamWidget *sl_widget = new QVSizeParamWidget(holder,this,property);
00112 inputVboxLayout->addWidget(sl_widget);
00113 haveInputWidgets = true;
00114 writeOutputProperties();
00115 connect(sl_widget,SIGNAL(valueChanged(QSize)),this,SLOT(somePropertyChanged()));
00116 }
00117 else if(holder->isType<QPoint>(property))
00118 {
00119 QVPointParamWidget *sl_widget = new QVPointParamWidget(holder,this,property);
00120 inputVboxLayout->addWidget(sl_widget);
00121 haveInputWidgets = true;
00122 writeOutputProperties();
00123 connect(sl_widget,SIGNAL(valueChanged(QPoint)),this,SLOT(somePropertyChanged()));
00124 }
00125
00126 else if(holder->isType<IppiMaskSize>(property))
00127 {
00128 QVIppiMaskSizeParamWidget *sl_widget = new QVIppiMaskSizeParamWidget(holder,this,property);
00129 inputVboxLayout->addWidget(sl_widget);
00130 haveInputWidgets = true;
00131 writeOutputProperties();
00132 connect(sl_widget,SIGNAL(valueChanged(IppiMaskSize)),this,SLOT(somePropertyChanged()));
00133 }
00134 else if(holder->isType<IppCmpOp>(property))
00135 {
00136 QVIppCmpOpParamWidget *sl_widget = new QVIppCmpOpParamWidget(holder,this,property);
00137 inputVboxLayout->addWidget(sl_widget);
00138 haveInputWidgets = true;
00139 writeOutputProperties();
00140 connect(sl_widget,SIGNAL(valueChanged(IppCmpOp)),this,SLOT(somePropertyChanged()));
00141 }
00142 else if(holder->isType<IppRoundMode>(property))
00143 {
00144 QVIppRoundModeParamWidget *sl_widget = new QVIppRoundModeParamWidget(holder,this,property);
00145 inputVboxLayout->addWidget(sl_widget);
00146 haveInputWidgets = true;
00147 writeOutputProperties();
00148 connect(sl_widget,SIGNAL(valueChanged(IppRoundMode)),this,SLOT(somePropertyChanged()));
00149 }
00150
00151 }
00152 else if(not holder->isLinkedOutput(property) && holder->isOutput(property) && not holder->isGUIInvisible(property)) {
00153 if(holder->isType<int>(property))
00154 {
00155 QVWorker* worker;
00156 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL) {
00157 QVOutputIntParamWidget *int_widget = new QVOutputIntParamWidget(worker,this,property);
00158 outputVboxLayout->addWidget(int_widget);
00159 haveOutputWidgets = true;
00160 connect(worker,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00161 connect(worker,SIGNAL(endIteration(uint, int)),int_widget,SLOT(update()));
00162 }
00163 }
00164 else if(holder->isType<double>(property))
00165 {
00166 QVWorker* worker;
00167 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL) {
00168 QVOutputDoubleParamWidget *double_widget = new QVOutputDoubleParamWidget(worker,this,property);
00169 outputVboxLayout->addWidget(double_widget);
00170 haveOutputWidgets = true;
00171 connect(worker,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00172 connect(worker,SIGNAL(endIteration(uint, int)),double_widget,SLOT(update()));
00173 }
00174 }
00175 else if(holder->isType<bool>(property))
00176 {
00177 QVWorker* worker;
00178 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL) {
00179 QVOutputBoolParamWidget *bool_widget = new QVOutputBoolParamWidget(worker,this,property);
00180 outputVboxLayout->addWidget(bool_widget);
00181 haveOutputWidgets = true;
00182 connect(worker,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00183 connect(worker,SIGNAL(endIteration(uint, int)),bool_widget,SLOT(update()));
00184 }
00185 }
00186 else if(holder->isType<QString>(property))
00187 {
00188 QVWorker* worker;
00189 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL) {
00190 QVOutputStringParamWidget *st_widget = new QVOutputStringParamWidget(worker,this,property);
00191 outputVboxLayout->addWidget(st_widget);
00192 haveOutputWidgets = true;
00193 connect(worker,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00194 connect(worker,SIGNAL(endIteration(uint, int)),st_widget,SLOT(update()));
00195 }
00196 }
00197 else if(holder->isType<QVIndexedStringList>(property))
00198 {
00199 QVWorker* worker;
00200 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL) {
00201 QVOutputStringListParamWidget *sl_widget = new QVOutputStringListParamWidget(worker,this,property);
00202 outputVboxLayout->addWidget(sl_widget);
00203 haveOutputWidgets = true;
00204 connect(worker,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00205 connect(worker,SIGNAL(endIteration(uint, int)),sl_widget,SLOT(update()));
00206 }
00207 }
00208 else if(holder->isType<QColor>(property))
00209 {
00210 QVWorker* worker;
00211 if((worker = dynamic_cast<QVWorker*>(holder)) != NULL) {
00212 QVOutputColorParamWidget *sl_widget = new QVOutputColorParamWidget(worker,this,property);
00213 outputVboxLayout->addWidget(sl_widget);
00214 haveOutputWidgets = true;
00215 connect(worker,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00216 connect(worker,SIGNAL(endIteration(uint, int)),sl_widget,SLOT(update()));
00217 }
00218 }
00219 }
00220 }
00221
00222 if (!haveInputWidgets) inputVboxLayout->addWidget(new QLabel("\n\tThis container has no\n\teditable input properties."));
00223 if (!haveOutputWidgets) outputVboxLayout->addWidget(new QLabel("\n\tThis container has no\n\tvisible output properties."));
00224
00225 inputVboxLayout->addStretch();
00226 }
00227
00228 void QVParamsInspectorWidget::somePropertyChanged()
00229 {
00230 writeOutputProperties();
00231 }
00232
00233 void QVParamsInspectorWidget::somePropertyUpdate()
00234 {
00235 readInputProperties();
00236 }