46 auto name = QString::fromStdString(SchemaClass->get_name() +
"::" +
47 SchemaAttribute->get_name());
48 setWindowTitle (name);
50 ui->AttributeNameLineEdit->setText ( QString::fromStdString (
51 SchemaAttribute->get_name() ) );
52 ui->AttributeTypeComboBox->setCurrentIndex (
53 ui->AttributeTypeComboBox->findData ( QString::fromStdString (
54 SchemaAttribute->get_type() ),
57 if ( SchemaAttribute->get_is_multi_values() )
58 ui->AttributeIsMultivariable->setCurrentIndex (
62 ui->AttributeIsMultivariable->setCurrentIndex ( 1 );
65 if ( SchemaAttribute->get_is_no_null() )
67 ui->AttributeIsNotNull->setCurrentIndex ( 0 );
71 ui->AttributeIsNotNull->setCurrentIndex ( 1 );
74 ui->AttributeDescriptionTextBox->setPlainText (
75 QString::fromStdString ( SchemaAttribute->get_description() ) );
76 ui->AttributeRangeLineEdit->setText ( QString::fromStdString (
77 SchemaAttribute->get_range() ) );
78 ui->AttributeInitialValue->setText (
79 QString::fromStdString ( SchemaAttribute->get_init_value() ) );
81 int Index = ui->AttributeTypeComboBox->currentIndex();
83 if ( Index == 0 || Index >= 9 )
85 ui->FormatLayout->setEnabled (
false );
86 ui->FormatLabel->hide();
87 ui->AttributeFormatComboBox->hide();
92 ui->FormatLayout->setEnabled (
true );
94 ui->FormatLabel->show();
95 ui->AttributeFormatComboBox->show();
98 ui->AttributeFormatComboBox->setCurrentIndex (
101 ui->AttributeFormatComboBox->setCurrentIndex (
105 ui->AttributeFormatComboBox->setCurrentIndex ( 2 );
121 "bool",
"s8",
"u8",
"s16",
"u16",
"s32",
"u32",
"s64",
"u64",
"float",
"double",
"date",
122 "time",
"string",
"enum",
"class" };
123 ui->AttributeTypeComboBox->addItems ( Items );
124 auto name = SchemaClass->get_name() +
"::";
125 setWindowTitle ( QString::fromStdString ( name +
" New Attribute" ) );
126 setObjectName ( QString::fromStdString(name) );
129 ui->AttributeTypeComboBox->setEnabled(
false);
130 ui->AttributeIsMultivariable->setEnabled(
false);
131 ui->AttributeIsNotNull->setEnabled(
false);
132 ui->AttributeRangeLineEdit->setEnabled(
false);
133 ui->AttributeInitialValue->setEnabled(
false);
135 ui->AttributeDescriptionTextBox->setReadOnly(
true);
146 connect ( ui->AttributeTypeComboBox, SIGNAL ( currentIndexChanged (
int ) ),
this,
147 SLOT ( ToggleFormat (
int ) ) );
148 connect ( ui->buttonBox, SIGNAL ( accepted() ),
this, SLOT ( ProxySlot() ) );
149 connect ( ui->buttonBox, SIGNAL ( rejected() ),
this, SLOT ( close() ) );
151 SLOT ( ClassUpdated ( QString ) ) );
167 bool Changed =
false;
168 std::string AttributeName = ui->AttributeNameLineEdit->text().toStdString();
169 std::string AttributeType = ui->AttributeTypeComboBox->currentText().toStdString();
170 char AttributeFormatChar = ( ui->AttributeFormatComboBox->currentText().toStdString() ) [0];
174 switch ( AttributeFormatChar )
177 AttributeFormat = OksAttribute::Format::Dec;
181 AttributeFormat = OksAttribute::Format::Oct;
185 AttributeFormat = OksAttribute::Format::Hex;
189 AttributeFormat = OksAttribute::Format::Dec;
194 int Index = ui->AttributeTypeComboBox->currentIndex();
196 if ( Index == 0 || Index >= 9 )
198 AttributeFormat = OksAttribute::Format::Dec;
201 bool IsMultivariable =
false;
203 switch ( ui->AttributeIsMultivariable->currentIndex() )
206 IsMultivariable =
true;
210 IsMultivariable =
false;
214 IsMultivariable =
false;
218 bool IsNotNull =
false;
220 switch ( ui->AttributeIsNotNull->currentIndex() )
235 std::string AttributeDescription =
236 ui->AttributeDescriptionTextBox->toPlainText().toStdString();
237 std::string AttributeRange = ui->AttributeRangeLineEdit->text().toStdString();
238 std::string AttributeInitial = ui->AttributeInitialValue->text().toStdString();
240 if ( AttributeName != SchemaAttribute->get_name() )
246 if ( AttributeType != SchemaAttribute->get_type() )
252 if ( AttributeFormat != SchemaAttribute->get_format() )
260 if ( IsMultivariable != SchemaAttribute->get_is_multi_values() )
268 if ( IsNotNull != SchemaAttribute->get_is_no_null() )
274 if ( AttributeDescription != SchemaAttribute->get_description() )
278 AttributeDescription );
282 if ( AttributeRange != SchemaAttribute->get_range() )
290 if ( AttributeInitial != SchemaAttribute->get_init_value() )
308 std::string AttributeName = ui->AttributeNameLineEdit->text().toStdString();
309 std::string AttributeType = ui->AttributeTypeComboBox->currentText().toStdString();
310 char AttributeFormatChar = ( ui->AttributeFormatComboBox->currentText().toStdString() ) [0];
314 switch ( AttributeFormatChar )
317 AttributeFormat = OksAttribute::Format::Dec;
321 AttributeFormat = OksAttribute::Format::Oct;
325 AttributeFormat = OksAttribute::Format::Hex;
329 AttributeFormat = OksAttribute::Format::Dec;
334 int Index = ui->AttributeTypeComboBox->currentIndex();
336 if ( Index == 0 || Index >= 9 )
338 AttributeFormat = OksAttribute::Format::Dec;
341 bool IsMultivariable =
false;
343 switch ( ui->AttributeIsMultivariable->currentIndex() )
346 IsMultivariable =
true;
350 IsMultivariable =
false;
354 IsMultivariable =
false;
358 bool IsNotNull =
false;
360 switch ( ui->AttributeIsNotNull->currentIndex() )
375 std::string AttributeDescription =
376 ui->AttributeDescriptionTextBox->toPlainText().toStdString();
377 std::string AttributeRange = ui->AttributeRangeLineEdit->text().toStdString();
378 std::string AttributeInitial = ui->AttributeInitialValue->text().toStdString();
382 AttributeType, IsMultivariable,
383 AttributeRange, AttributeInitial,
384 AttributeDescription, IsNotNull,
404 int Index = ui->AttributeTypeComboBox->currentIndex();
406 if ( Index == 0 || Index >= 9 )
408 ui->FormatLayout->setEnabled (
false );
409 ui->FormatLabel->hide();
410 ui->AttributeFormatComboBox->hide();
414 ui->FormatLayout->setEnabled (
true );
415 ui->FormatLabel->show();
416 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)