00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include "qvparamwidget.h"
00026 #include "qvparamsinspectorwidget.h"
00027 #include <QLabel>
00028
00029 #include <QVProcessingBlock>
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 QVProcessingBlock *block;
00053 if((block = dynamic_cast<QVProcessingBlock*>(holder)) != NULL)
00054 foreach(QString property, block->getTriggerList())
00055 inputVboxLayout->addWidget(new QVProcessingBlockTriggerWidget(block, 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 QVSIntParamWidget *int_widget = new QVSIntParamWidget(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<unsigned int>(property))
00070 {
00071 QVUIntParamWidget *int_widget = new QVUIntParamWidget(holder,this,property);
00072 inputVboxLayout->addWidget(int_widget);
00073 haveInputWidgets = true;
00074 writeOutputProperties();
00075 connect(int_widget,SIGNAL(valueChanged(unsigned int)),this,SLOT(somePropertyChanged()));
00076 }
00077 else if(holder->isType<char>(property))
00078 {
00079 QVSCharParamWidget *int_widget = new QVSCharParamWidget(holder,this,property);
00080 inputVboxLayout->addWidget(int_widget);
00081 haveInputWidgets = true;
00082 writeOutputProperties();
00083 connect(int_widget,SIGNAL(valueChanged(char)),this,SLOT(somePropertyChanged()));
00084 }
00085 else if(holder->isType<unsigned char>(property))
00086 {
00087 QVUCharParamWidget *int_widget = new QVUCharParamWidget(holder,this,property);
00088 inputVboxLayout->addWidget(int_widget);
00089 haveInputWidgets = true;
00090 writeOutputProperties();
00091 connect(int_widget,SIGNAL(valueChanged(unsigned char)),this,SLOT(somePropertyChanged()));
00092 }
00093 else if(holder->isType<double>(property))
00094 {
00095 QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00096 inputVboxLayout->addWidget(double_widget);
00097 haveInputWidgets = true;
00098 writeOutputProperties();
00099 connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00100 }
00101 else if(holder->isType<float>(property))
00102 {
00103 QVFloatParamWidget *double_widget = new QVFloatParamWidget(holder,this,property);
00104 inputVboxLayout->addWidget(double_widget);
00105 haveInputWidgets = true;
00106 writeOutputProperties();
00107 connect(double_widget,SIGNAL(valueChanged(float)),this,SLOT(somePropertyChanged()));
00108 }
00109 else if(holder->isType<bool>(property))
00110 {
00111 QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00112 inputVboxLayout->addWidget(bool_widget);
00113 haveInputWidgets = true;
00114 writeOutputProperties();
00115 connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00116 }
00117 else if(holder->isType<QString>(property))
00118 {
00119 QVStringParamWidget *st_widget = new QVStringParamWidget(holder,this,property);
00120 inputVboxLayout->addWidget(st_widget);
00121 haveInputWidgets = true;
00122 writeOutputProperties();
00123 connect(st_widget,SIGNAL(valueChanged(QString)),this,SLOT(somePropertyChanged()));
00124 }
00125 else if(holder->isType<QVIndexedStringList>(property))
00126 {
00127 QVStringListParamWidget *sl_widget = new QVStringListParamWidget(holder,this,property);
00128 inputVboxLayout->addWidget(sl_widget);
00129 haveInputWidgets = true;
00130 writeOutputProperties();
00131 connect(sl_widget,SIGNAL(valueChanged(QVIndexedStringList)),this,SLOT(somePropertyChanged()));
00132 }
00133 else if(holder->isType<QColor>(property))
00134 {
00135 QVColorParamWidget *sl_widget = new QVColorParamWidget(holder,this,property);
00136 inputVboxLayout->addWidget(sl_widget);
00137 haveInputWidgets = true;
00138 writeOutputProperties();
00139 connect(sl_widget,SIGNAL(valueChanged(QColor)),this,SLOT(somePropertyChanged()));
00140 }
00141 else if(holder->isType<QSize>(property))
00142 {
00143 QVSizeParamWidget *sl_widget = new QVSizeParamWidget(holder,this,property);
00144 inputVboxLayout->addWidget(sl_widget);
00145 haveInputWidgets = true;
00146 writeOutputProperties();
00147 connect(sl_widget,SIGNAL(valueChanged(QSize)),this,SLOT(somePropertyChanged()));
00148 }
00149 else if(holder->isType<QPoint>(property))
00150 {
00151 QVPointParamWidget *sl_widget = new QVPointParamWidget(holder,this,property);
00152 inputVboxLayout->addWidget(sl_widget);
00153 haveInputWidgets = true;
00154 writeOutputProperties();
00155 connect(sl_widget,SIGNAL(valueChanged(QPoint)),this,SLOT(somePropertyChanged()));
00156 }
00157 #ifdef QVIPP
00158 else if(holder->isType<IppiMaskSize>(property))
00159 {
00160 QVIppiMaskSizeParamWidget *sl_widget = new QVIppiMaskSizeParamWidget(holder,this,property);
00161 inputVboxLayout->addWidget(sl_widget);
00162 haveInputWidgets = true;
00163 writeOutputProperties();
00164 connect(sl_widget,SIGNAL(valueChanged(IppiMaskSize)),this,SLOT(somePropertyChanged()));
00165 }
00166 else if(holder->isType<IppCmpOp>(property))
00167 {
00168 QVIppCmpOpParamWidget *sl_widget = new QVIppCmpOpParamWidget(holder,this,property);
00169 inputVboxLayout->addWidget(sl_widget);
00170 haveInputWidgets = true;
00171 writeOutputProperties();
00172 connect(sl_widget,SIGNAL(valueChanged(IppCmpOp)),this,SLOT(somePropertyChanged()));
00173 }
00174 else if(holder->isType<IppRoundMode>(property))
00175 {
00176 QVIppRoundModeParamWidget *sl_widget = new QVIppRoundModeParamWidget(holder,this,property);
00177 inputVboxLayout->addWidget(sl_widget);
00178 haveInputWidgets = true;
00179 writeOutputProperties();
00180 connect(sl_widget,SIGNAL(valueChanged(IppRoundMode)),this,SLOT(somePropertyChanged()));
00181 }
00182 #endif
00183 }
00184 else if(not holder->isLinkedOutput(property) && holder->isOutput(property) && not holder->isGUIInvisible(property)) {
00185 if(holder->isType<int>(property))
00186 {
00187 QVProcessingBlock* block;
00188 if((block = dynamic_cast<QVProcessingBlock*>(holder)) != NULL) {
00189 QVOutputIntParamWidget *int_widget = new QVOutputIntParamWidget(block,this,property);
00190 outputVboxLayout->addWidget(int_widget);
00191 haveOutputWidgets = true;
00192 connect(block,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00193 connect(block,SIGNAL(endIteration(uint, int)),int_widget,SLOT(update()));
00194 }
00195 }
00196 else if(holder->isType<double>(property))
00197 {
00198 QVProcessingBlock* block;
00199 if((block = dynamic_cast<QVProcessingBlock*>(holder)) != NULL) {
00200 QVOutputDoubleParamWidget *double_widget = new QVOutputDoubleParamWidget(block,this,property);
00201 outputVboxLayout->addWidget(double_widget);
00202 haveOutputWidgets = true;
00203 connect(block,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00204 connect(block,SIGNAL(endIteration(uint, int)),double_widget,SLOT(update()));
00205 }
00206 }
00207 else if(holder->isType<bool>(property))
00208 {
00209 QVProcessingBlock* block;
00210 if((block = dynamic_cast<QVProcessingBlock*>(holder)) != NULL) {
00211 QVOutputBoolParamWidget *bool_widget = new QVOutputBoolParamWidget(block,this,property);
00212 outputVboxLayout->addWidget(bool_widget);
00213 haveOutputWidgets = true;
00214 connect(block,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00215 connect(block,SIGNAL(endIteration(uint, int)),bool_widget,SLOT(update()));
00216 }
00217 }
00218 else if(holder->isType<QString>(property))
00219 {
00220 QVProcessingBlock* block;
00221 if((block = dynamic_cast<QVProcessingBlock*>(holder)) != NULL) {
00222 QVOutputStringParamWidget *st_widget = new QVOutputStringParamWidget(block,this,property);
00223 outputVboxLayout->addWidget(st_widget);
00224 haveOutputWidgets = true;
00225 connect(block,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00226 connect(block,SIGNAL(endIteration(uint, int)),st_widget,SLOT(update()));
00227 }
00228 }
00229 else if(holder->isType<QVIndexedStringList>(property))
00230 {
00231 QVProcessingBlock* block;
00232 if((block = dynamic_cast<QVProcessingBlock*>(holder)) != NULL) {
00233 QVOutputStringListParamWidget *sl_widget = new QVOutputStringListParamWidget(block,this,property);
00234 outputVboxLayout->addWidget(sl_widget);
00235 haveOutputWidgets = true;
00236 connect(block,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00237 connect(block,SIGNAL(endIteration(uint, int)),sl_widget,SLOT(update()));
00238 }
00239 }
00240 else if(holder->isType<QColor>(property))
00241 {
00242 QVProcessingBlock* block;
00243 if((block = dynamic_cast<QVProcessingBlock*>(holder)) != NULL) {
00244 QVOutputColorParamWidget *sl_widget = new QVOutputColorParamWidget(block,this,property);
00245 outputVboxLayout->addWidget(sl_widget);
00246 haveOutputWidgets = true;
00247 connect(block,SIGNAL(endIteration(uint, int)),this,SLOT(somePropertyUpdate()));
00248 connect(block,SIGNAL(endIteration(uint, int)),sl_widget,SLOT(update()));
00249 }
00250 }
00251 }
00252 }
00253
00254 if (!haveInputWidgets) inputVboxLayout->addWidget(new QLabel("\n\tThis container has no\n\teditable input properties."));
00255 if (!haveOutputWidgets) outputVboxLayout->addWidget(new QLabel("\n\tThis container has no\n\tvisible output properties."));
00256
00257 inputVboxLayout->addStretch();
00258 }
00259
00260 void QVParamsInspectorWidget::somePropertyChanged()
00261 {
00262 writeOutputProperties();
00263 }
00264
00265 void QVParamsInspectorWidget::somePropertyUpdate()
00266 {
00267 readInputProperties();
00268 }