42 setWindowTitle ( QString (
"Attribute Editor : %1" ).arg (
43 SchemaAttribute->get_name().c_str() ) );
44 setObjectName ( QString::fromStdString ( SchemaAttribute->get_name() ) );
45 ui->AttributeNameLineEdit->setText ( QString::fromStdString (
46 SchemaAttribute->get_name() ) );
47 ui->AttributeTypeComboBox->setCurrentIndex (
48 ui->AttributeTypeComboBox->findData ( QString::fromStdString (
49 SchemaAttribute->get_type() ),
52 if ( SchemaAttribute->get_is_multi_values() )
53 ui->AttributeIsMultivariable->setCurrentIndex (
57 ui->AttributeIsMultivariable->setCurrentIndex ( 1 );
60 if ( SchemaAttribute->get_is_no_null() )
62 ui->AttributeIsNotNull->setCurrentIndex ( 0 );
66 ui->AttributeIsNotNull->setCurrentIndex ( 1 );
69 ui->AttributeDescriptionTextBox->setPlainText (
70 QString::fromStdString ( SchemaAttribute->get_description() ) );
71 ui->AttributeRangeLineEdit->setText ( QString::fromStdString (
72 SchemaAttribute->get_range() ) );
73 ui->AttributeInitialValue->setText (
74 QString::fromStdString ( SchemaAttribute->get_init_value() ) );
76 int Index = ui->AttributeTypeComboBox->currentIndex();
78 if ( Index == 0 || Index >= 9 )
80 ui->FormatLayout->setEnabled (
false );
81 ui->FormatLabel->hide();
82 ui->AttributeFormatComboBox->hide();
86 ui->FormatLayout->setEnabled (
true );
87 ui->FormatLabel->show();
88 ui->AttributeFormatComboBox->show();
91 ui->AttributeFormatComboBox->setCurrentIndex (
94 ui->AttributeFormatComboBox->setCurrentIndex (
98 ui->AttributeFormatComboBox->setCurrentIndex ( 2 );
121 connect ( ui->AttributeTypeComboBox, SIGNAL ( currentIndexChanged (
int ) ),
this,
122 SLOT ( ToggleFormat (
int ) ) );
123 connect ( ui->buttonBox, SIGNAL ( accepted() ),
this, SLOT ( ProxySlot() ) );
124 connect ( ui->buttonBox, SIGNAL ( rejected() ),
this, SLOT ( close() ) );
126 SLOT ( ClassUpdated ( QString ) ) );
142 bool Changed =
false;
143 std::string AttributeName = ui->AttributeNameLineEdit->text().toStdString();
144 std::string AttributeType = ui->AttributeTypeComboBox->currentText().toStdString();
145 char AttributeFormatChar = ( ui->AttributeFormatComboBox->currentText().toStdString() ) [0];
149 switch ( AttributeFormatChar )
152 AttributeFormat = OksAttribute::Format::Dec;
156 AttributeFormat = OksAttribute::Format::Oct;
160 AttributeFormat = OksAttribute::Format::Hex;
164 AttributeFormat = OksAttribute::Format::Dec;
169 int Index = ui->AttributeTypeComboBox->currentIndex();
171 if ( Index == 0 || Index >= 9 )
173 AttributeFormat = OksAttribute::Format::Dec;
176 bool IsMultivariable =
false;
178 switch ( ui->AttributeIsMultivariable->currentIndex() )
181 IsMultivariable =
true;
185 IsMultivariable =
false;
189 IsMultivariable =
false;
193 bool IsNotNull =
false;
195 switch ( ui->AttributeIsNotNull->currentIndex() )
210 std::string AttributeDescription =
211 ui->AttributeDescriptionTextBox->toPlainText().toStdString();
212 std::string AttributeRange = ui->AttributeRangeLineEdit->text().toStdString();
213 std::string AttributeInitial = ui->AttributeInitialValue->text().toStdString();
215 if ( AttributeName != SchemaAttribute->get_name() )
221 if ( AttributeType != SchemaAttribute->get_type() )
227 if ( AttributeFormat != SchemaAttribute->get_format() )
235 if ( IsMultivariable != SchemaAttribute->get_is_multi_values() )
243 if ( IsNotNull != SchemaAttribute->get_is_no_null() )
249 if ( AttributeDescription != SchemaAttribute->get_description() )
253 AttributeDescription );
257 if ( AttributeRange != SchemaAttribute->get_range() )
265 if ( AttributeInitial != SchemaAttribute->get_init_value() )
283 std::string AttributeName = ui->AttributeNameLineEdit->text().toStdString();
284 std::string AttributeType = ui->AttributeTypeComboBox->currentText().toStdString();
285 char AttributeFormatChar = ( ui->AttributeFormatComboBox->currentText().toStdString() ) [0];
289 switch ( AttributeFormatChar )
292 AttributeFormat = OksAttribute::Format::Dec;
296 AttributeFormat = OksAttribute::Format::Oct;
300 AttributeFormat = OksAttribute::Format::Hex;
304 AttributeFormat = OksAttribute::Format::Dec;
309 int Index = ui->AttributeTypeComboBox->currentIndex();
311 if ( Index == 0 || Index >= 9 )
313 AttributeFormat = OksAttribute::Format::Dec;
316 bool IsMultivariable =
false;
318 switch ( ui->AttributeIsMultivariable->currentIndex() )
321 IsMultivariable =
true;
325 IsMultivariable =
false;
329 IsMultivariable =
false;
333 bool IsNotNull =
false;
335 switch ( ui->AttributeIsNotNull->currentIndex() )
350 std::string AttributeDescription =
351 ui->AttributeDescriptionTextBox->toPlainText().toStdString();
352 std::string AttributeRange = ui->AttributeRangeLineEdit->text().toStdString();
353 std::string AttributeInitial = ui->AttributeInitialValue->text().toStdString();
357 AttributeType, IsMultivariable,
358 AttributeRange, AttributeInitial,
359 AttributeDescription, IsNotNull,
379 int Index = ui->AttributeTypeComboBox->currentIndex();
381 if ( Index == 0 || Index >= 9 )
383 ui->FormatLayout->setEnabled (
false );
384 ui->FormatLabel->hide();
385 ui->AttributeFormatComboBox->hide();
389 ui->FormatLayout->setEnabled (
true );
390 ui->FormatLabel->show();
391 ui->AttributeFormatComboBox->show();
void PushAddAttributeCommand(dunedaq::oks::OksClass *Class, std::string name, std::string type, bool is_mv, std::string range, std::string init_values, std::string description, bool is_null, dunedaq::oks::OksAttribute::Format format=dunedaq::oks::OksAttribute::Format::Dec)