1 #include "ParametersWindow.h"
2 #include "Parameters.h"
3 #include "BlocksToConfigureWidget.h"
4 #include "BlockParameter.h"
5 #include "AbstractBlock.h"
7 ParametersWindow::ParametersWindow(AbstractBlock *_block, Parameters *_params, BlocksToConfigureWidget *btcw, QWidget *parent) :
14 layout = new QGridLayout;
17 value = new QLineEdit;
21 comboBox = new QComboBox;
23 foreach(BlockParameter *param, block->getParameters()){
24 comboBox->addItem(param->getName());
26 connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateData()));
29 saveButton = new QPushButton("Save");
30 connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
32 layout->addWidget(new QLabel("Parameters"), 0, 0);
33 layout->addWidget(comboBox, 0, 1);
35 layout->addWidget(new QLabel(" "), 1, 0);
37 layout->addWidget(new QLabel("Name"), 2, 0);
38 layout->addWidget(name, 2, 1);
39 layout->addWidget(new QLabel("Value"), 3, 0);
40 layout->addWidget(value, 3, 1);
41 layout->addWidget(new QLabel("Context"), 4, 0);
42 layout->addWidget(context, 4, 1);
43 layout->addWidget(new QLabel("Type"), 5, 0);
44 layout->addWidget(type, 5, 1);
46 layout->addWidget(saveButton, 6, 0);
48 this->setLayout(layout);
53 void ParametersWindow::updateData()
55 BlockParameter *param = block->getParameters().at(comboBox->currentIndex());
56 name->setText(param->getName());
57 value->setText(param->getValue().toString());
58 context->setText(param->getContext());
59 type->setText(param->getTypeString());
62 void ParametersWindow::save()
64 BlockParameter *param = block->getParameters().at(comboBox->currentIndex());
65 param->setValue(value->text());
67 //params->parametersValidation();
68 if(confWidget != NULL){
69 confWidget->updateBlocksList();