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) :
13 layout = new QGridLayout;
16 value = new QLineEdit;
20 comboBox = new QComboBox;
22 cout << "block has " <<block->getParameters().size() << " params" << endl;
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() {
54 BlockParameter *param = block->getParameters().at(comboBox->currentIndex());
55 name->setText(param->getName());
56 value->setText(param->getValue().toString());
57 context->setText(param->getContext());
58 type->setText(param->getTypeString());
61 void ParametersWindow::save() {
62 BlockParameter *param = block->getParameters().at(comboBox->currentIndex());
63 param->setValue(value->text());
65 //params->parametersValidation();
66 if(confWidget != NULL){
67 confWidget->updateBlocksList();