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 cout << "block has " <<block->getParameters().size() << " params" << endl;
24 foreach(BlockParameter *param, block->getParameters()){
25 comboBox->addItem(param->getName());
27 connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateData()));
30 saveButton = new QPushButton("Save");
31 connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
33 layout->addWidget(new QLabel("Parameters"), 0, 0);
34 layout->addWidget(comboBox, 0, 1);
36 layout->addWidget(new QLabel(" "), 1, 0);
38 layout->addWidget(new QLabel("Name"), 2, 0);
39 layout->addWidget(name, 2, 1);
40 layout->addWidget(new QLabel("Value"), 3, 0);
41 layout->addWidget(value, 3, 1);
42 layout->addWidget(new QLabel("Context"), 4, 0);
43 layout->addWidget(context, 4, 1);
44 layout->addWidget(new QLabel("Type"), 5, 0);
45 layout->addWidget(type, 5, 1);
47 layout->addWidget(saveButton, 6, 0);
49 this->setLayout(layout);
54 void ParametersWindow::updateData()
56 BlockParameter *param = block->getParameters().at(comboBox->currentIndex());
57 name->setText(param->getName());
58 value->setText(param->getValue().toString());
59 context->setText(param->getContext());
60 type->setText(param->getTypeString());
63 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();