104 int NumberOfColumns = 1;
105 WidgetTable->setRowCount ( NumberOfRows );
106 WidgetTable->setColumnCount ( NumberOfColumns );
107 setAttribute ( Qt::WA_DeleteOnClose,
true );
114 ui->DetailsGroupBox->setVisible (
false );
116 WidgetTable->setSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding );
117 WidgetTable->horizontalHeader()->setVisible (
false );
118 WidgetTable->horizontalHeader()->setSectionResizeMode ( QHeaderView::ResizeToContents );
119 WidgetTable->horizontalHeader()->setSectionResizeMode ( 0, QHeaderView::Stretch );
120 WidgetTable->setVerticalHeaderLabels ( HorizontalHeaders );
121 WidgetTable->setSelectionMode ( QAbstractItemView::NoSelection );
123 if ( this_is_in_creation_mode )
125 ui->RenameButton->setDisabled (
true );
126 ui->MoveButton->setDisabled (
true );
130 QString::fromStdString ( Object().contained_in() ));
132 WidgetTable->setDisabled(
true);
133 ui->RenameButton->setDisabled(
true);
134 ui->MoveButton->setDisabled(
true);
137 ui->TableLayout->addWidget ( WidgetTable );
139 ui->ApplyButton->setEnabled (
false );
141 ui->RenameButton->setToolTip (
"Rename object" );
239 connect ( ui->DetailButton, SIGNAL ( toggled (
bool ) ), ui->DetailsGroupBox,
240 SLOT ( setVisible (
bool ) ), Qt::UniqueConnection );
241 connect ( ui->CloseButton, SIGNAL ( clicked (
bool ) ),
this, SLOT ( close() ),
242 Qt::UniqueConnection );
243 connect ( ui->ApplyButton, SIGNAL ( clicked() ),
this, SLOT ( ParseToSave() ),
244 Qt::UniqueConnection );
246 connect ( ui->RenameButton, SIGNAL ( clicked() ),
this, SLOT ( LaunchRenameObject() ) );
247 connect ( ui->MoveButton, SIGNAL ( clicked() ),
this, SLOT ( LaunchMoveObject() ) );
250 SLOT ( UpdateObjectEditor ( QString,
dref ) ) );
253 SLOT ( ShouldCloseThisWindow ( QString,
dref ) ) );
256 if(mainwin !=
nullptr) {
257 connect (mainwin, SIGNAL(signal_batch_change_stopped(
const QList<QPair<QString, QString>>&)),
258 this, SLOT(UpdateObjectEditor(
const QList<QPair<QString, QString>>&)), Qt::UniqueConnection);
259 connect (mainwin, SIGNAL(signal_externalchanges_processed()),
260 this, SLOT(UpdateObjectEditor()), Qt::UniqueConnection);
293 if ( not this_editor_is_owned and m_object_to_edit and Object().UID() == updated_object.
UID()
294 and Object().class_name() == updated_object.
class_name() )
297 m_object_to_edit.reset (
new dref ( updated_object ) );
301 std::vector<dunedaq::conffwk::attribute_t> class_attributes = classdef.
p_attributes;
302 std::vector<dunedaq::conffwk::relationship_t> class_relations = classdef.
p_relationships;
307 this_widgets[QString::fromStdString ( attr.p_name )] )
309 set_attribute_widget ( attr, attreditor );
315 QStringList relvalues;
316 QString relname = QString ( arelation.p_name.c_str() );
321 if ( relwidget->ischanged() )
323 relvalues = relwidget->getdata();
327 std::vector<tref> connected;
333 connected.push_back (
336 catch ( daq::dbe::config_object_retrieval_result_is_null
const & e )
344 dbegraph::linked::through::relation<std::vector<tref>> ( Object(), arelation );
347 std::transform ( connected.begin(), connected.end(), std::back_inserter ( relvalues ),
348 [] ( decltype ( connected ) ::value_type
const & x )
350 return QString::fromStdString ( x.UID() );
357 relwidget->setdata ( relvalues );
358 relwidget->SetEditor();
364 const auto& s = size();
365 resize(s.width() + 1, s.height() +1);
366 resize(s.width(), s.height());
392 std::vector<dunedaq::conffwk::attribute_t> attributes = classdef.
p_attributes;
393 std::vector<dunedaq::conffwk::relationship_t> relations = classdef.
p_relationships;
398 QString name = QString::fromStdString ( attr.p_name );
400 if ( attr.p_is_multi_value )
404 set_attribute_widget ( attr, widget );
406 set_tooltip ( attr, widget );
407 register_attribute_widget ( name, widget );
408 connect ( widget, SIGNAL ( signal_value_change() ),
this, SLOT ( UpdateActions() ),
409 Qt::UniqueConnection );
410 connect ( widget, SIGNAL ( signal_value_change() ),
this, SLOT ( ObjectChanged() ),
411 Qt::UniqueConnection );
412 emit LoadedInitials();
416 switch ( attr.p_type )
424 set_attribute_widget ( attr, Widget );
425 set_tooltip ( attr, Widget );
426 register_attribute_widget ( name, Widget );
427 connect ( Widget->Combo, SIGNAL ( activated ( QString ) ),
this, SLOT ( UpdateActions() ),
428 Qt::UniqueConnection );
429 connect ( Widget, SIGNAL ( signal_value_change() ),
this, SLOT ( ObjectChanged() ),
430 Qt::UniqueConnection );
431 emit LoadedInitials();
457 set_attribute_widget ( attr, Widget );
458 set_tooltip ( attr, Widget );
459 register_attribute_widget ( name, Widget );
460 connect ( Widget, SIGNAL ( signal_value_change() ),
this, SLOT ( UpdateActions() ),
461 Qt::UniqueConnection );
462 connect ( Widget, SIGNAL ( signal_value_change() ),
this, SLOT ( ObjectChanged() ),
463 Qt::UniqueConnection );
464 emit LoadedInitials();
476 set_attribute_widget ( attr, Widget );
477 set_tooltip ( attr, Widget );
478 register_attribute_widget ( name, Widget );
479 connect ( Widget, SIGNAL ( signal_value_change() ),
this, SLOT ( UpdateActions() ),
480 Qt::UniqueConnection );
481 connect ( Widget, SIGNAL ( signal_value_change() ),
this, SLOT ( ObjectChanged() ),
482 Qt::UniqueConnection );
483 emit LoadedInitials();
490 set_attribute_widget ( attr, Widget );
491 set_tooltip ( attr, Widget );
492 register_attribute_widget ( name, Widget );
493 connect ( Widget->Combo, SIGNAL ( activated ( QString ) ),
this, SLOT ( UpdateActions() ),
494 Qt::UniqueConnection );
495 connect ( Widget, SIGNAL ( signal_value_change() ),
this, SLOT ( ObjectChanged() ),
496 Qt::UniqueConnection );
497 emit LoadedInitials();
509 QString name = QString::fromStdString ( arelation.p_name );
512 if ( m_object_to_edit and not Object().is_null() )
514 std::vector<tref> DataList;
521 dbegraph::linked::through::relation<tref> ( Object(), arelation ) );
523 catch ( daq::dbe::config_object_retrieval_result_is_null
const & e )
530 DataList = dbegraph::linked::through::relation<std::vector<tref>> ( Object(), arelation );
533 for (
tref const & i : DataList )
535 if ( not i.is_null() )
537 Data.push_back ( QString::fromStdString ( i.UID() ) );
544 set_tooltip ( arelation, widget );
545 register_relation_widget ( name, widget );
546 connect ( widget, SIGNAL ( signal_value_change() ),
this, SLOT ( UpdateActions() ),
547 Qt::UniqueConnection );
548 connect ( widget, SIGNAL ( signal_value_change() ),
this, SLOT ( ObjectChanged() ),
549 Qt::UniqueConnection );
550 connect ( widget, SIGNAL ( LoadedInitials() ),
this, SLOT ( ResetObjectChanged() ),
551 Qt::UniqueConnection );
552 connect (
this, SIGNAL ( LoadedInitials() ), widget, SLOT ( slot_set_initial_loaded() ),
553 Qt::UniqueConnection );
555 emit LoadedInitials();
691 if ( m_object_to_edit and not Object().is_null() )
693 QString FileName = QString ( Object().contained_in().c_str() );
695 QFileInfo FileInfo = QFileInfo ( FileName );
697 for ( QStringList File : FileCache )
699 if ( FileName.contains ( File.at ( 1 ) ) )
701 FilePermission = File.at ( 2 );
706 ui->FileLabel->setText ( QString (
"File: %1" ).arg ( FileInfo.fileName() ) );
707 ui->DirLabel->setText ( QString (
"Dir: %1" ).arg ( FileInfo.absolutePath() ) );
708 ui->WriteLabel->setText ( QString (
"Permission: %1" ).arg ( FilePermission ) );
736 int NotNullCounter = 0;
737 int NotValidCounter = 0;
739 QStringList NotValidList;
741 for (
auto & i : this_widgets )
743 std::shared_ptr<editor_data_state> Editor = i.second->dataeditor<
editor_data_state>();
745 if ( Editor !=
nullptr )
747 if ( not Editor->is_valid() )
750 NotValidList.append ( i.first );
753 if ( Editor->must_not_be_null() )
760 QLabel * StatusLabel =
new QLabel();
761 StatusLabel->setWordWrap (
true );
762 StatusLabel->setFrameStyle ( QFrame::NoFrame );
764 if ( NotValidCounter == 0 )
766 StatusLabel->setText (
767 QString (
"All minimal necessary attributes and relationships are set" ) );
769 if ( this_is_in_copy_mode or this_is_in_creation_mode or
772 ui->ApplyButton->setEnabled (
true );
779 QString MexHead = QString (
"From %1 NOT NULL attributes/relationships, %2 are not set: " )
780 .arg ( NotNullCounter ).arg ( NotValidCounter );
781 QString Mex = MexHead + NotValidList.join (
"," );
782 StatusLabel->setText ( Mex );
784 ui->ApplyButton->setEnabled (
false );
790 emit WidgetUpdated();
872 if ( RenameWidget ==
nullptr )
874 RenameWidget =
new QDialog (
this );
875 RenameWidget->setSizePolicy ( QSizePolicy::Preferred, QSizePolicy::Preferred );
876 RenameWidget->setToolTip (
"Type string to edit line and press Enter." );
877 RenameWidget->setWindowTitle (
"Choose a new object id" );
879 QHBoxLayout * Layout =
new QHBoxLayout ( RenameWidget );
880 QLabel * Label =
new QLabel ( QString (
"Rename Object:" ), RenameWidget );
881 GoButton =
new QPushButton (
"Rename !" );
883 LineEdit =
new QLineEdit ( RenameWidget );
884 LineEdit->setToolTip (
"Type string and press Enter" );
886 Layout->addWidget ( Label );
887 Layout->addWidget ( LineEdit );
888 Layout->addWidget ( GoButton );
889 RenameWidget->setLayout ( Layout );
891 connect ( LineEdit, SIGNAL ( returnPressed() ),
this, SLOT ( RenameObject() ) );
892 connect ( GoButton, SIGNAL ( clicked() ),
this, SLOT ( RenameObject() ) );
894 SLOT ( slot_external_rename_object ( QString,
dref ) ) );
897 RenameWidget->show();
902 if ( MoveWidget ==
nullptr )
904 MoveWidget =
new QDialog (
this );
905 MoveWidget->setSizePolicy ( QSizePolicy::Preferred, QSizePolicy::Preferred );
906 MoveWidget->setToolTip (
"Choose file and press Move." );
907 MoveWidget->setWindowTitle (
"Choose new file for object" );
909 QVBoxLayout * Layout =
new QVBoxLayout ( MoveWidget );
910 QLabel * Label =
new QLabel ( QString (
"Choose new file" ), MoveWidget );
911 MoveGoButton =
new QPushButton (
"Move !" );
913 if ( IncludedFileModel ==
nullptr )
916 IncludedFileModel =
new FileModel ( List );
920 FileView->setModel ( IncludedFileModel );
921 FileView->horizontalHeader()->setSectionResizeMode ( QHeaderView::Stretch );
923 Layout->addWidget ( Label );
924 Layout->addWidget ( FileView );
925 Layout->addWidget ( MoveGoButton );
927 MoveWidget->setLayout ( Layout );
928 connect ( FileView, SIGNAL ( stateChanged (
const QString & ) ),
this,
929 SLOT ( ActiveFileChanged (
const QString & ) ), Qt::UniqueConnection );
930 connect ( MoveGoButton, SIGNAL ( clicked() ),
this, SLOT ( MoveObject() ) );