Line data Source code
1 : // DUNE DAQ modification notice:
2 : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3 : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
4 : // Renamed since fork: no.
5 :
6 : #include "dbe/BatchChangeWidget.hpp"
7 :
8 : #include "ui_BatchChangeWidget.h"
9 :
10 : #include "dbe/MainWindow.hpp"
11 : #include "dbe/config_api.hpp"
12 : #include "dbe/config_api_set.hpp"
13 : #include "dbe/config_api_get.hpp"
14 : #include "dbe/config_api_graph.hpp"
15 : #include "dbe/messenger.hpp"
16 :
17 : #include <QApplication>
18 : #include <boost/scope_exit.hpp>
19 :
20 : namespace dbegraph = dbe::config::api::graph;
21 :
22 0 : dbe::BatchChangeWidget::~BatchChangeWidget() = default;
23 :
24 0 : dbe::BatchChangeWidget::BatchChangeWidget ( QWidget * parent )
25 : :
26 : QWidget ( parent ),
27 0 : ui ( new Ui::BatchChangeWidget ),
28 0 : UseTable ( false ),
29 0 : ClassChanged ( true ),
30 0 : TableClass ( "" ),
31 0 : m_filter_table ( nullptr )
32 : {
33 0 : ui->setupUi ( this );
34 0 : ui->TitleLabel->setStyleSheet (
35 : "QLabel { background-color:green; color:beige; font:bold14px; border-style:outset; border-width:2px;"
36 : "border-radius:10px; border-color:beige; font:bold14px; min-width:10em; padding:6px}" );
37 0 : ui->FirstStepLabel->setStyleSheet ( "QLabel { color:#DB5816; font: bold 14px;}" );
38 0 : ui->SecondStepLabel->setStyleSheet ( "QLabel { color:#DE8A14; font: bold 14px;}" );
39 0 : ui->ThirdStepLabel->setStyleSheet ( "QLabel { color:#8DAA2E; font: bold 14px;}" );
40 0 : setWindowTitle ( "Batch Change" );
41 :
42 0 : QStringList ListOfClasses ( dbe::config::api::info::onclass::allnames<QStringList>() );
43 0 : ui->ClassCombo->addItems ( ListOfClasses );
44 0 : ui->ClassCombo->setEditable ( true );
45 0 : ui->ClassCombo->setEditText ( "Type/Select Classes" );
46 :
47 0 : ui->AttributeBox->setEnabled ( false );
48 0 : ui->RelationshipBox->setEnabled ( false );
49 0 : ui->NewAttributeGroupBox->setEnabled ( false );
50 0 : ui->NewRelationshipGroupBox->setEnabled ( false );
51 0 : ui->MatchButton->setEnabled ( false );
52 0 : ui->FilterUid->setText ( "*" );
53 0 : ui->AttributeValueFilter->setText ( "*" );
54 :
55 0 : SetController();
56 0 : }
57 :
58 0 : dbe::BatchChangeWidget::BatchChangeWidget ( bool ObjectsFromTable, QString ClassName,
59 0 : std::vector<dref> & Objects, QWidget * parent )
60 : :
61 0 : BatchChangeWidget ( parent )
62 : {
63 0 : ClassChanged = false;
64 :
65 0 : TableObjects = Objects;
66 0 : UseTable = ObjectsFromTable;
67 0 : TableClass = ClassName;
68 :
69 0 : ui->ClassCombo->setCurrentIndex ( ui->ClassCombo->findText ( TableClass ) );
70 0 : ui->SubclassesCheckBox->setEnabled ( false );
71 0 : FillInfo ( TableClass );
72 :
73 0 : if ( UseTable )
74 : {
75 0 : setWindowTitle ( "Batch change - Table" );
76 0 : ui->FilterGroupBox->hide();
77 0 : ui->Label1->hide();
78 0 : ui->Label2->hide();
79 0 : ui->FirstStepLabel->hide();
80 0 : ui->SecondStepLabel->hide();
81 0 : ui->ThirdStepLabel->hide();
82 0 : ui->Line1->hide();
83 0 : ui->Line2->hide();
84 0 : ui->TitleLabel->setText ( "Batch Change of multiple objects - Table" );
85 0 : resize ( 540, 280 );
86 : }
87 0 : }
88 :
89 0 : void dbe::BatchChangeWidget::SetController()
90 : {
91 0 : connect ( ui->ClassCombo, SIGNAL ( activated ( QString ) ), this,
92 : SLOT ( FillInfo ( const QString & ) ) );
93 :
94 0 : connect ( ui->ChangeButton, SIGNAL ( clicked() ), this, SLOT ( MakeChanges() ) );
95 :
96 0 : connect ( ui->MatchButton, SIGNAL ( clicked() ), this, SLOT ( FindMatching() ) );
97 :
98 0 : connect ( ui->NewRelationshipComboBox, SIGNAL ( activated ( QString ) ), this,
99 : SLOT ( EnableCheckBox ( QString ) ) );
100 0 : connect ( ui->CancelButton, SIGNAL ( clicked() ), this, SLOT ( close() ) );
101 :
102 0 : connect ( ui->RelationshipComboBox, SIGNAL ( activated ( int ) ), this,
103 : SLOT ( UpdateRelationshipFilter ( int ) ) );
104 :
105 0 : connect ( ui->NewRelationshipComboBox, SIGNAL ( activated ( int ) ), this,
106 : SLOT ( UpdateRelationshipNewValues ( int ) ) );
107 :
108 0 : MainWindow * mainwin = MainWindow::findthis();
109 :
110 0 : if ( mainwin != nullptr )
111 : {
112 0 : connect ( this, SIGNAL ( sig_batch_change_start() ), mainwin,
113 : SLOT ( slot_batch_change_start() ), Qt::UniqueConnection );
114 0 : connect ( this, SIGNAL ( sig_batch_change_stop(const QList<QPair<QString, QString>>&) ), mainwin,
115 : SLOT ( slot_batch_change_stop(const QList<QPair<QString, QString>>&) ),
116 : Qt::UniqueConnection );
117 : }
118 0 : }
119 :
120 0 : void dbe::BatchChangeWidget::keyPressEvent(QKeyEvent* event) {
121 0 : if (event->key() == Qt::Key_Escape) {
122 0 : close();
123 : }
124 0 : QWidget::keyPressEvent(event);
125 0 : }
126 :
127 0 : void dbe::BatchChangeWidget::filter ( std::vector<dref> & objs, const QString & cname )
128 : {
129 :
130 0 : dunedaq::conffwk::class_t const & cinfo = dbe::config::api::info::onclass::definition (
131 0 : cname.toStdString(), false );
132 0 : std::vector<dunedaq::conffwk::attribute_t> const & attributes = cinfo.p_attributes;
133 0 : std::vector<dunedaq::conffwk::relationship_t> const & relations = cinfo.p_relationships;
134 :
135 : // Filtering UID
136 0 : std::vector<dref> filtered;
137 :
138 0 : if ( !ui->FilterUid->text().isEmpty() )
139 : {
140 0 : QRegExp uidfilter ( ui->FilterUid->text() );
141 0 : uidfilter.setPatternSyntax ( QRegExp::Wildcard );
142 :
143 0 : for ( dbe::dref const & it : objs )
144 : {
145 :
146 0 : if ( uidfilter.exactMatch ( QString::fromStdString ( it.ref().UID() ) ) )
147 : {
148 0 : filtered.push_back ( it );
149 : }
150 : }
151 :
152 0 : objs = filtered;
153 0 : filtered.clear();
154 0 : }
155 :
156 : /// Filtering Attributes
157 0 : QRegExp attribute_filter ( ui->AttributeValueFilter->text() );
158 0 : attribute_filter.setPatternSyntax ( QRegExp::Wildcard );
159 :
160 0 : std::string selected_attribute_name = ui->AttributeComboBox->currentText().toStdString();
161 :
162 0 : std::vector<dunedaq::conffwk::attribute_t>::const_iterator attrdef = std::find_if (
163 : std::begin ( attributes ), std::end ( attributes ),
164 0 : [&selected_attribute_name] ( dunedaq::conffwk::attribute_t const & attr )
165 : {
166 0 : return attr.p_name == selected_attribute_name;
167 : } );
168 :
169 0 : if ( attrdef != std::end ( attributes ) )
170 : {
171 0 : for ( dbe::dref const & it : objs )
172 : {
173 0 : QStringList values
174 0 : { dbe::config::api::get::attribute::list<QStringList> ( it.ref(), *attrdef ) };
175 :
176 0 : for ( QString & v : values )
177 0 : if ( attribute_filter.exactMatch ( v ) )
178 : {
179 0 : filtered.push_back ( it );
180 : break;
181 : }
182 0 : }
183 :
184 : }
185 :
186 0 : objs = filtered;
187 0 : filtered.clear();
188 :
189 : // Filter on Relationship
190 :
191 0 : std::string selected_relation_name =
192 0 : ui->RelationshipComboBox->currentText().toStdString();
193 :
194 0 : std::vector<dunedaq::conffwk::relationship_t>::const_iterator relationdef = std::find_if (
195 : std::begin ( relations ), std::end ( relations ),
196 0 : [&selected_relation_name] ( dunedaq::conffwk::relationship_t const & rel )
197 : {
198 0 : return rel.p_name == selected_relation_name;
199 : } );
200 :
201 0 : if ( relationdef != std::end ( relations ) )
202 : {
203 0 : QRegExp relation_filter ( ui->RelationshipValueFilter->currentText() );
204 0 : relation_filter.setPatternSyntax ( QRegExp::Wildcard );
205 :
206 0 : for ( dbe::dref const & it : objs )
207 : {
208 0 : QStringList ValueList
209 : {
210 : dbegraph::linked::through::relation<QStringList> (
211 0 : it.ref(), *relationdef ) };
212 :
213 0 : if ( ValueList.isEmpty() and ( ui->RelationshipValueFilter->currentText() == "*"
214 0 : or ui->RelationshipValueFilter->currentText() == "" ) )
215 : {
216 0 : filtered.push_back ( it );
217 : }
218 : else
219 : {
220 0 : for ( QString const & v : ValueList )
221 0 : if ( relation_filter.exactMatch ( v ) )
222 : {
223 0 : filtered.push_back ( it );
224 : break;
225 : }
226 : }
227 0 : }
228 :
229 0 : }
230 :
231 0 : objs = filtered;
232 0 : filtered.clear();
233 0 : }
234 :
235 0 : void dbe::BatchChangeWidget::FillInfo ( const QString & Name )
236 : {
237 0 : ui->AttributeBox->setEnabled ( false );
238 0 : ui->RelationshipBox->setEnabled ( false );
239 0 : ui->NewAttributeGroupBox->setEnabled ( false );
240 0 : ui->NewRelationshipGroupBox->setEnabled ( false );
241 :
242 0 : const dunedaq::conffwk::class_t & ClassInfo = dbe::config::api::info::onclass::definition (
243 0 : Name.toStdString(),
244 0 : false );
245 0 : const std::vector<dunedaq::conffwk::attribute_t> AttributeList = ClassInfo.p_attributes;
246 0 : const std::vector<dunedaq::conffwk::relationship_t> RelationshipList = ClassInfo
247 0 : .p_relationships;
248 :
249 0 : QStringList ValueList;
250 :
251 0 : for ( dunedaq::conffwk::attribute_t Attribute : AttributeList )
252 : {
253 0 : ValueList.append ( QString ( Attribute.p_name.c_str() ) );
254 0 : }
255 :
256 0 : ui->AttributeComboBox->clear();
257 0 : ui->NewAttributeComboBox->clear();
258 0 : ui->AttributeComboBox->addItems ( ValueList );
259 0 : ui->NewAttributeComboBox->addItems ( ValueList );
260 :
261 0 : if ( !AttributeList.empty() && !UseTable )
262 : {
263 0 : ui->AttributeBox->setEnabled ( true );
264 0 : ui->NewAttributeGroupBox->setEnabled ( true );
265 0 : ui->MatchButton->setEnabled ( true );
266 : }
267 :
268 0 : if ( !AttributeList.empty() && UseTable )
269 : {
270 0 : ui->NewAttributeGroupBox->setEnabled ( true );
271 : }
272 :
273 0 : ValueList.clear();
274 :
275 0 : for ( dunedaq::conffwk::relationship_t Relationship : RelationshipList )
276 : {
277 0 : ValueList.append ( QString ( Relationship.p_name.c_str() ) );
278 0 : }
279 :
280 0 : ui->RelationshipComboBox->clear();
281 0 : ui->NewRelationshipComboBox->clear();
282 0 : ui->RelationshipComboBox->addItems ( ValueList );
283 0 : ui->NewRelationshipComboBox->addItems ( ValueList );
284 :
285 0 : if ( !RelationshipList.empty() && !UseTable )
286 : {
287 0 : ui->RelationshipBox->setEnabled ( true );
288 0 : ui->NewRelationshipGroupBox->setEnabled ( true );
289 0 : ui->MatchButton->setEnabled ( true );
290 : }
291 :
292 0 : if ( !RelationshipList.empty() && UseTable )
293 : {
294 0 : ui->NewRelationshipGroupBox->setEnabled ( true );
295 : }
296 :
297 0 : if ( !UseTable )
298 : {
299 0 : UpdateRelationshipFilter ( 0 );
300 0 : UpdateRelationshipNewValues ( 0 );
301 0 : ui->RelationshipValueFilter->setCurrentIndex ( 0 );
302 0 : ui->RelationshipEdit->setCurrentIndex ( -1 );
303 : }
304 : else
305 : {
306 0 : UpdateRelationshipNewValues ( 0 );
307 0 : ui->RelationshipEdit->setCurrentIndex ( -1 );
308 : }
309 :
310 0 : if ( ClassChanged )
311 : {
312 0 : UseTable = false;
313 : }
314 :
315 0 : ClassChanged = true;
316 0 : }
317 :
318 0 : void dbe::BatchChangeWidget::MakeChanges()
319 : {
320 0 : std::vector<dref> Objects;
321 :
322 0 : BOOST_SCOPE_EXIT(&Objects, this_)
323 : {
324 0 : QList<QPair<QString, QString>> objs;
325 0 : for(const auto& o : Objects) {
326 0 : objs.append(QPair<QString, QString>(QString::fromStdString(o.class_name()),
327 0 : QString::fromStdString(o.UID())));
328 : }
329 :
330 0 : this_->emit sig_batch_change_stop(objs);
331 :
332 :
333 0 : QApplication::restoreOverrideCursor();
334 0 : this_->ui->ChangeButton->setEnabled(true);
335 0 : confaccessor::ref().blockSignals(false);
336 0 : }
337 0 : BOOST_SCOPE_EXIT_END
338 :
339 0 : ui->ChangeButton->setEnabled(false);
340 0 : QApplication::setOverrideCursor(Qt::WaitCursor);
341 0 : confaccessor::ref().blockSignals(true);
342 :
343 0 : bool SubClasses = ui->SubclassesCheckBox->isChecked();
344 0 : QString ClassName = ui->ClassCombo->currentText();
345 :
346 0 : std::unique_ptr<dbe::interface::messenger::batch_guard> batchmode (
347 0 : interface::messenger::qt::batchmode() );
348 :
349 0 : emit sig_batch_change_start();
350 :
351 0 : if ( not UseTable )
352 : {
353 0 : std::vector<tref> const & tmprefs = dbe::config::api::info::onclass::objects (
354 0 : ClassName.toStdString(), SubClasses );
355 :
356 0 : std::copy ( tmprefs.begin(), tmprefs.end(), std::back_inserter ( Objects ) );
357 :
358 0 : if ( not Objects.empty() )
359 : {
360 0 : filter ( Objects, ClassName );
361 : }
362 0 : }
363 : else
364 : {
365 0 : Objects = TableObjects;
366 : }
367 :
368 0 : if ( Objects.empty() ) QMessageBox::information ( this, tr ( "Message" ),
369 0 : tr ( "No objects match filter!" ) );
370 : else
371 : {
372 0 : const dunedaq::conffwk::class_t & ClassInfo = dbe::config::api::info::onclass::definition (
373 0 : ClassName.toStdString(), false );
374 0 : const std::vector<dunedaq::conffwk::attribute_t> AttributeList = ClassInfo.p_attributes;
375 0 : const std::vector<dunedaq::conffwk::relationship_t> RelationshipList = ClassInfo
376 0 : .p_relationships;
377 0 : dunedaq::conffwk::attribute_t AttributeChange;
378 0 : dunedaq::conffwk::relationship_t RelationshipChange;
379 :
380 0 : for ( dunedaq::conffwk::attribute_t i : AttributeList )
381 0 : if ( i.p_name == ui->NewAttributeComboBox->currentText().toStdString() )
382 : {
383 0 : AttributeChange = i;
384 0 : break;
385 0 : }
386 :
387 0 : for ( dunedaq::conffwk::relationship_t i : RelationshipList )
388 0 : if ( i.p_name == ui->NewRelationshipComboBox->currentText().toStdString() )
389 : {
390 0 : RelationshipChange = i;
391 0 : break;
392 0 : }
393 :
394 0 : QStringList AttributeChangeList;
395 :
396 0 : if ( !ui->AttributeEdit->text().isEmpty() ) AttributeChangeList
397 0 : << ui->AttributeEdit->text();
398 :
399 0 : for ( auto objects_iter = Objects.begin(); objects_iter != Objects.end(); ++objects_iter )
400 : {
401 0 : tref Object = objects_iter->ref();
402 :
403 0 : QStringList RelationshipChangeList;
404 :
405 0 : if ( ui->ChangeAtrributeCheckBox->isChecked() )
406 : {
407 0 : if ( !AttributeChangeList.isEmpty() )
408 : {
409 0 : dbe::config::api::set::attribute ( Object, AttributeChange, AttributeChangeList );
410 : }
411 : }
412 :
413 0 : if ( ui->ChangeRelationshipCheckBox->isChecked() )
414 : {
415 0 : if ( ui->AddCheckBox->isChecked() )
416 : {
417 0 : RelationshipChangeList =
418 0 : dbegraph::linked::through::relation<QStringList> (
419 0 : Object, RelationshipChange );
420 : }
421 :
422 0 : RelationshipChangeList << ui->RelationshipEdit->currentText();
423 0 : dbe::config::api::set::relation ( Object, RelationshipChange, RelationshipChangeList );
424 : }
425 0 : }
426 0 : }
427 0 : }
428 :
429 0 : void dbe::BatchChangeWidget::FindMatching()
430 : {
431 0 : QString ClassName = ui->ClassCombo->currentText();
432 0 : bool SubClasses = ui->SubclassesCheckBox->isChecked();
433 :
434 0 : std::vector<tref> const & tmprefs = dbe::config::api::info::onclass::objects (
435 0 : ClassName.toStdString(), SubClasses );
436 :
437 0 : std::vector<dref> candidates;
438 0 : std::copy ( tmprefs.begin(), tmprefs.end(), std::back_inserter ( candidates ) );
439 :
440 0 : if ( !candidates.empty() )
441 : {
442 0 : filter ( candidates, ClassName );
443 : }
444 :
445 0 : if ( candidates.empty() )
446 : {
447 0 : QMessageBox::information ( this, tr ( "Message" ), tr ( "No objects match filter!" ) );
448 : }
449 : else
450 : {
451 0 : int NumberOfColumns = 1;
452 0 : bool AttributeEnabled = false;
453 0 : bool RelationshipEnabled = false;
454 :
455 0 : if ( ui->AttributeComboBox->isEnabled() )
456 : {
457 0 : AttributeEnabled = true;
458 0 : NumberOfColumns++;
459 : }
460 :
461 0 : if ( ui->RelationshipComboBox->isEnabled() )
462 : {
463 0 : RelationshipEnabled = true;
464 0 : NumberOfColumns++;
465 : }
466 :
467 0 : m_filter_table = std::unique_ptr<QTableWidget> ( new QTableWidget() );
468 0 : m_filter_table->setWindowTitle ( tr ( "Objects matching filter" ) );
469 0 : m_filter_table->setColumnCount ( NumberOfColumns );
470 0 : m_filter_table->setRowCount ( candidates.size() );
471 :
472 0 : for ( size_t i = 0; i < candidates.size(); i++ )
473 : {
474 0 : QTableWidgetItem * AttributeValue;
475 0 : QTableWidgetItem * RelationshipValue;
476 :
477 0 : QTableWidgetItem * ObjectUid = new QTableWidgetItem (
478 0 : tr ( "%1@%2" ).arg ( candidates.at ( i ).UID().c_str() ).arg (
479 0 : candidates.at ( i ).class_name().c_str() ) );
480 0 : m_filter_table->setItem ( i, 0, ObjectUid );
481 :
482 0 : if ( AttributeEnabled )
483 : {
484 0 : dunedaq::conffwk::attribute_t Attribute = dbe::config::api::info::attributematch (
485 0 : ui->AttributeComboBox->currentText(), ClassName );
486 :
487 0 : QStringList AttributeValueList
488 : {
489 0 : dbe::config::api::get::attribute::list<QStringList> ( candidates.at ( i ).ref(),
490 0 : Attribute ) };
491 :
492 0 : AttributeValue = new QTableWidgetItem ( AttributeValueList.join ( " " ) );
493 0 : m_filter_table->setItem ( i, 1, AttributeValue );
494 0 : }
495 :
496 0 : if ( RelationshipEnabled )
497 : {
498 0 : dunedaq::conffwk::relationship_t Relationship = config::api::info::relation::match (
499 0 : ui->RelationshipComboBox->currentText(), ClassName );
500 :
501 0 : QStringList RelationshipList
502 : {
503 : dbegraph::linked::through::relation<QStringList> (
504 0 : candidates.at ( i ).ref(), Relationship ) };
505 :
506 0 : RelationshipValue = new QTableWidgetItem ( RelationshipList.join ( " " ) );
507 0 : m_filter_table->setItem ( i, 2, RelationshipValue );
508 0 : }
509 : }
510 :
511 0 : QStringList Headers;
512 0 : Headers << "Object Id";
513 :
514 0 : if ( AttributeEnabled )
515 : {
516 0 : Headers << ui->AttributeComboBox->currentText();
517 : }
518 :
519 0 : if ( RelationshipEnabled )
520 : {
521 0 : Headers << ui->RelationshipComboBox->currentText();
522 : }
523 :
524 0 : m_filter_table->setHorizontalHeaderLabels ( Headers );
525 :
526 0 : QHeaderView * HeaderView = m_filter_table->horizontalHeader();
527 0 : HeaderView->setStretchLastSection ( true );
528 0 : m_filter_table->resize ( 500, 300 );
529 0 : m_filter_table->show();
530 0 : }
531 0 : }
532 :
533 0 : void dbe::BatchChangeWidget::EnableCheckBox ( QString RelationshipName )
534 : {
535 0 : QString ClassName = ui->ClassCombo->currentText();
536 0 : const dunedaq::conffwk::class_t & ClassInfo = dbe::config::api::info::onclass::definition (
537 0 : ClassName.toStdString(), false );
538 0 : std::vector<dunedaq::conffwk::relationship_t> RelationshipList = ClassInfo.p_relationships;
539 :
540 0 : for ( dunedaq::conffwk::relationship_t & i : RelationshipList )
541 : {
542 0 : if ( i.p_name == RelationshipName.toStdString() )
543 : {
544 0 : if ( ( i.p_cardinality == dunedaq::conffwk::zero_or_many ) || ( i.p_cardinality
545 : == dunedaq::conffwk::one_or_many ) )
546 : {
547 0 : ui->AddCheckBox->setEnabled ( true );
548 : }
549 : else
550 : {
551 0 : ui->AddCheckBox->setEnabled ( false );
552 : }
553 :
554 : break;
555 : }
556 : }
557 0 : }
558 :
559 0 : void dbe::BatchChangeWidget::UpdateRelationshipFilter ( int )
560 : {
561 0 : ui->RelationshipValueFilter->clear();
562 0 : ui->RelationshipValueFilter->addItem ( "*" );
563 :
564 0 : QString ClassName = ui->ClassCombo->currentText();
565 0 : QString RelationshipName = ui->RelationshipComboBox->currentText();
566 :
567 0 : const dunedaq::conffwk::class_t & ClassInfo = dbe::config::api::info::onclass::definition (
568 0 : ClassName.toStdString(), false );
569 0 : std::vector<dunedaq::conffwk::relationship_t> RelationshipList = ClassInfo.p_relationships;
570 :
571 0 : if ( RelationshipList.size() != 0 )
572 : {
573 0 : dunedaq::conffwk::relationship_t ChosenRelationship;
574 :
575 0 : for ( dunedaq::conffwk::relationship_t & i : RelationshipList )
576 : {
577 0 : if ( i.p_name == RelationshipName.toStdString() )
578 : {
579 0 : ChosenRelationship = i;
580 : break;
581 : }
582 : }
583 :
584 0 : std::vector<tref> const & Objects = dbe::config::api::info::onclass::objects (
585 0 : ChosenRelationship.p_type );
586 :
587 0 : QStringList ObjectsUid;
588 :
589 0 : for ( tref const & Object : Objects )
590 : {
591 0 : ObjectsUid.append ( Object.UID().c_str() );
592 : }
593 :
594 0 : ui->RelationshipValueFilter->addItems ( ObjectsUid );
595 0 : }
596 0 : }
597 :
598 0 : void dbe::BatchChangeWidget::UpdateRelationshipNewValues ( int )
599 : {
600 0 : ui->RelationshipEdit->clear();
601 :
602 0 : QString ClassName = ui->ClassCombo->currentText();
603 0 : QString RelationshipName = ui->NewRelationshipComboBox->currentText();
604 :
605 0 : const dunedaq::conffwk::class_t & ClassInfo = dbe::config::api::info::onclass::definition (
606 0 : ClassName.toStdString(), false );
607 0 : std::vector<dunedaq::conffwk::relationship_t> RelationshipList = ClassInfo.p_relationships;
608 :
609 0 : if ( RelationshipList.size() != 0 )
610 : {
611 0 : dunedaq::conffwk::relationship_t ChosenRelationship;
612 :
613 0 : for ( dunedaq::conffwk::relationship_t & i : RelationshipList )
614 : {
615 0 : if ( i.p_name == RelationshipName.toStdString() )
616 : {
617 0 : ChosenRelationship = i;
618 : break;
619 : }
620 : }
621 :
622 0 : std::vector<tref> const & Objects = dbe::config::api::info::onclass::objects (
623 0 : ChosenRelationship.p_type );
624 :
625 0 : QStringList ObjectsUid;
626 :
627 0 : for ( tref const & Object : Objects )
628 : {
629 0 : ObjectsUid.append ( Object.UID().c_str() );
630 : }
631 :
632 0 : ui->RelationshipEdit->addItems ( ObjectsUid );
633 0 : }
634 0 : }
|