DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::ObjectCreator Class Reference

#include <ObjectCreator.hpp>

Inheritance diagram for dbe::ObjectCreator:
[legend]
Collaboration diagram for dbe::ObjectCreator:
[legend]

Signals

void stateChanged ()
 

Public Member Functions

 ~ObjectCreator ()
 
 ObjectCreator (dunedaq::conffwk::class_t const &classinfo, QWidget *parent=0)
 
 ObjectCreator (tref const &clonefrom, dunedaq::conffwk::relationship_t const &relation, QWidget *parent=0)
 
 ObjectCreator (tref const &clonefrom, QWidget *parent=0)
 
bool CanClose ()
 

Private Slots

void AddInclude ()
 
void UpdateActions ()
 
void UpdateActions (QString)
 
void CreateObject (bool openEditor=false)
 
void CreateOpenObject ()
 
void SetObjectChanged ()
 
void ActiveFileChanged (QString const &)
 
void MustPressReturn (QString const &)
 
void SetUID ()
 

Private Member Functions

void setup_editor ()
 
void setup_copy_editor ()
 
void SetComboClass ()
 
void SetController ()
 
void BuildFileModel ()
 
void SetStatusBar ()
 
QString GetMessage ()
 
bool GetState (int Flags)
 
void BuildContextMenu ()
 
void FillUidComboBox ()
 
void closeEvent (QCloseEvent *event)
 

Private Attributes

std::unique_ptr< dbe::Ui::ObjectCreator > ui
 
dunedaq::conffwk::class_t this_object_class
 
std::unique_ptr< trefthis_src_object
 
std::unique_ptr< trefthis_target_object
 
dunedaq::conffwk::relationship_t this_relation
 
QSortFilterProxyModel this_sort
 
FileModelthis_files
 
QStatusBar * this_status_bar
 
int this_state
 
bool UidSet
 
QString this_newuid
 
QString this_file_for_new_object
 
ObjectEditorthis_associated_editor
 
QMenu * ContextMenu
 
bool this_is_temporary
 
bool this_object_changed
 
bool this_create_copy
 
QUuid const uuid
 

Detailed Description

Definition at line 24 of file ObjectCreator.hpp.

Constructor & Destructor Documentation

◆ ~ObjectCreator()

dbe::ObjectCreator::~ObjectCreator ( )
default

◆ ObjectCreator() [1/3]

dbe::ObjectCreator::ObjectCreator ( dunedaq::conffwk::class_t const & classinfo,
QWidget * parent = 0 )

Create a new object of class

Parameters
classinfodescribes the class for which an object is to be created
parentof this widget

Definition at line 40 of file ObjectCreator.cpp.

41 :
42 QWidget ( parent ),
43 ui ( new Ui::ObjectCreator ),
44 this_object_class ( cinfo ),
45 this_target_object ( nullptr ),
47 this_files ( nullptr ),
48 this_status_bar ( nullptr ),
49 this_state ( 0 ),
50 UidSet ( false ),
51 this_associated_editor ( nullptr ),
52 ContextMenu ( nullptr ),
53 this_is_temporary ( false ),
54 this_object_changed ( false ),
55 this_create_copy ( false ),
56 uuid ( QUuid::createUuid() )
57{
58 ui->setupUi ( this );
59 this_status_bar = new QStatusBar ( ui->StatusFrame );
60
61 QString cname = QString::fromStdString ( this_object_class.p_name );
62 setWindowTitle ( QString ( "Create New Object of Class %1" ).arg ( cname ) );
63
65 ui->LineEditUID->setToolTip ( QString ( "Type Object unique ID and press ENTER" ) );
66
67 ui->ComboBoxForbiddenUid->hide();
68 ui->SetFileButton->hide();
69
74
75 int index = ui->ComboBoxClass->findText ( cname );
76 ui->ComboBoxClass->setCurrentIndex ( 1 ); // If index is 0 somehow this doesnt work
77 ui->ComboBoxClass->setCurrentIndex ( index ); // Now set it to the right value posssibly 0
79 ui->ComboBoxClass->setEditText ( cname );
80
81 ui->SetUidButton->setVisible ( false );
83
84 QSize SplitterSize = ui->splitter->size();
85 int Width = SplitterSize.width() / 2;
86
87 QList<int> List;
88 List.push_back ( Width );
89 List.push_back ( Width );
90
91 ui->splitter->setSizes ( List );
92}
ObjectEditor * this_associated_editor
dunedaq::conffwk::relationship_t this_relation
std::unique_ptr< dbe::Ui::ObjectCreator > ui
dunedaq::conffwk::class_t this_object_class
std::unique_ptr< tref > this_target_object
QStatusBar * this_status_bar

◆ ObjectCreator() [2/3]

dbe::ObjectCreator::ObjectCreator ( tref const & clonefrom,
dunedaq::conffwk::relationship_t const & relation,
QWidget * parent = 0 )

Clone an object of a given relation type

Parameters
anobjectis a reference to another object
relationis a relation to set
parentof this widget

Definition at line 100 of file ObjectCreator.cpp.

103 :
105 config::api::info::onclass::definition ( clonefrom.class_name(), false ), parent )
106{
107 this_target_object.reset ( new tref ( clonefrom ) );
108 this_relation = the_relation;
109}
ObjectCreator(dunedaq::conffwk::class_t const &classinfo, QWidget *parent=0)
static dunedaq::conffwk::class_t definition(std::string const &cn, bool direct_only)
inner::configobject::tref tref
Definition tref.hpp:30

◆ ObjectCreator() [3/3]

dbe::ObjectCreator::ObjectCreator ( tref const & clonefrom,
QWidget * parent = 0 )

Clone from a given object

Parameters
copyfromis the object to copy from
parent

Setting the same file as the object being copied

Definition at line 114 of file ObjectCreator.cpp.

115 :
116 QWidget ( parent ),
117 ui ( new Ui::ObjectCreator ),
119 config::api::info::onclass::definition ( clonefrom.class_name(), false ) ),
120 this_src_object ( new tref ( clonefrom ) ),
121 this_files ( nullptr ),
122 this_status_bar ( nullptr ),
123 UidSet ( false ),
124 this_associated_editor ( nullptr ),
125 ContextMenu ( nullptr ),
126 this_is_temporary ( false ),
127 this_object_changed ( false ),
128 this_create_copy ( true ),
129 uuid ( QUuid::createUuid() )
130{
131 ui->setupUi ( this );
132 this_status_bar = new QStatusBar ( ui->StatusFrame );
133
134 setWindowTitle (
135 QString ( "Create New Object of Class %1" ).arg (
136 QString::fromStdString ( this_object_class.p_name ) ) );
137
139 ui->LineEditUID->setToolTip ( QString ( "Type Object unique ID and press ENTER" ) );
140
141 ui->ComboBoxForbiddenUid->hide();
142 ui->SetFileButton->hide();
143
146 SetStatusBar();
148
149 int index = ui->ComboBoxClass->findText ( QString::fromStdString (
150 clonefrom.class_name() ) );
151
152 ui->ComboBoxClass->setCurrentIndex ( index );
154
156 QString const & fn = QString::fromStdString ( this_src_object->contained_in() );
157 QFileInfo fileinfo ( fn );
158 QModelIndexList ListOfMatch = this_files->match (
159 this_files->index ( 0, 0 ),
160 Qt::DisplayRole, fileinfo.fileName(), 1000,
161 Qt::MatchContains | Qt::MatchWrap | Qt::MatchRecursive );
162
163 ui->FileView->selectRow ( ListOfMatch.at ( 0 ).row() );
164
165 ActiveFileChanged ( fn );
166
167 // Set uid to the that of the object being copied
168 ui->LineEditUID->setText ( QString::fromStdString ( clonefrom.UID() ) );
169 ui->ComboBoxClass->setEditText ( QString::fromStdString ( clonefrom.class_name() ) );
170
171 ui->SetUidButton->setVisible ( false );
173
174 QSize spliter_size = ui->splitter->size();
175 int w = spliter_size.width() / 2;
176 ui->splitter->setSizes ( QList<int>
177 { w, w } );
178}
void ActiveFileChanged(QString const &)
std::unique_ptr< tref > this_src_object

Member Function Documentation

◆ ActiveFileChanged

void dbe::ObjectCreator::ActiveFileChanged ( QString const & fname)
privateslot

Definition at line 456 of file ObjectCreator.cpp.

457{
458 if ( fname.isEmpty() or not confaccessor::check_file_rw ( fname ) )
459 {
460 this_file_for_new_object = QString();
461 emit stateChanged();
462 return;
463 }
464
466 ui->FileView->setToolTip (
467 QString ( "Activate file which will store the new object: " ).append (
469 QString setFilesWithPath = QString ( "Selected File: %1" ).arg ( this_file_for_new_object );
470 QString setOnlyFiles = QString ( "Selected File: %1" ).arg (
471 QFileInfo ( this_file_for_new_object ).fileName() );
472 ui->FileLabel->setText ( setOnlyFiles );
473 ui->FileLabel->setToolTip ( setFilesWithPath );
474 ui->FileView->setStyleSheet ( "selection-background-color : rgb(190,238,158)" );
475 emit stateChanged();
476}
static bool check_file_rw(const QString &FileName)

◆ AddInclude

void dbe::ObjectCreator::AddInclude ( )
privateslot

Definition at line 376 of file ObjectCreator.cpp.

377{}

◆ BuildContextMenu()

void dbe::ObjectCreator::BuildContextMenu ( )
private

Definition at line 369 of file ObjectCreator.cpp.

370{
371 ContextMenu = new QMenu ( this );
372 ContextMenu->addAction ( tr ( "&Edit Include Files" ), this, SLOT ( AddInclude() ),
373 QKeySequence ( tr ( "Ctrl+Z" ) ) );
374}

◆ BuildFileModel()

void dbe::ObjectCreator::BuildFileModel ( )
private

Definition at line 230 of file ObjectCreator.cpp.

231{
232 if ( not confaccessor::db_implementation_name().contains ( "roksconflibs" ) )
233 {
234 if ( this_files != nullptr )
235 {
236 delete this_files;
237 this_files = nullptr;
238 }
239
240 this_files = new FileModel ( confaccessor::ref().GetIncludedFileCache() );
241
242 this_sort.setSourceModel ( this_files );
243 ui->FileView->setModel ( &this_sort );
244 ui->FileView->sortByColumn ( 2, Qt::DescendingOrder );
245
246 // ui->FileView->HideReadOnlyFilesSlot(true);
247 ui->FileView->setColumnHidden(2, true);
248 ui->FileView->setColumnHidden(3, true);
249 ui->FileView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
250 }
251}
QSortFilterProxyModel this_sort
static confaccessor & ref()
static QString db_implementation_name()

◆ CanClose()

bool dbe::ObjectCreator::CanClose ( )

Definition at line 623 of file ObjectCreator.cpp.

624{
625
626 if ( ( this_object_changed and ui->CreateObjectButton->isEnabled() ) or
628 {
629 int ret =
630 QMessageBox::question (
631 0,
632 tr ( "DBE - ObjectCreate" ),
633 QString ( "There are pending actions for this dialogue" ),
634 QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel );
635
636 if ( ret == QMessageBox::Discard )
637 {
638 this_object_changed = false;
640
641 try
642 {
645 uuid );
646 }
647 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
648 {
649 // nothing specific handle needed in this , it is possible that there is no resul
650 }
651
652 return true;
653 }
654 else if ( ret == QMessageBox::Cancel )
655 {
656 return false;
657 }
658
659 return true;
660 }
661 else
662 {
663 return true;
664 }
665}
bool WasObjectChanged() const
static configobject::tref get(dbe::cokey const &desc)
bool delobj(inner::configobject::tref obj, QUuid const &src)

◆ closeEvent()

void dbe::ObjectCreator::closeEvent ( QCloseEvent * event)
private

Definition at line 667 of file ObjectCreator.cpp.

668{
669 if ( CanClose() )
670 {
672 {
673 this_associated_editor->close();
674 this_associated_editor = nullptr;
675 }
676
677 event->accept();
678 }
679 else
680 {
681 event->ignore();
682 }
683}

◆ CreateObject

void dbe::ObjectCreator::CreateObject ( bool openEditor = false)
privateslot

Called from ui when the create button has been pressed

Definition at line 412 of file ObjectCreator.cpp.

413{
414 setCursor ( Qt::WaitCursor );
415
416 BOOST_SCOPE_EXIT(this_)
417 {
418 this_->unsetCursor();
419 }
420 BOOST_SCOPE_EXIT_END
421
422 if ( this_file_for_new_object.isEmpty() )
423 {
424 ERROR ( "Object creation not feasible", "Object file must be selected" )
425 }
426 else if ( this_newuid.isEmpty() )
427 {
428 ERROR ( "Object creation not feasible", "Object name (uid) cannot be an empty string" );
429 }
430 else if ( this_associated_editor )
431 {
433
434 bool done = this_associated_editor->ParseToCreate ( this_newuid.toStdString(),
435 this_file_for_new_object.toStdString() );
438 this_object_changed = false;
439
440 if ( done )
441 {
442 close();
443
444 if ( openEditor == true ) {
445 ( new ObjectEditor ( dbe::inner::dbcontroller::get({this_newuid.toStdString(), this_object_class.p_name}) ) )->show();
446 }
447 }
448 }
449}
void SetUsedForCopy(bool Used)
bool ParseToCreate(std::string const &name, std::string const &filename)
#define ERROR(...)
Definition messenger.hpp:88

◆ CreateOpenObject

void dbe::ObjectCreator::CreateOpenObject ( )
privateslot

Definition at line 408 of file ObjectCreator.cpp.

408 {
409 CreateObject(true);
410}
void CreateObject(bool openEditor=false)

◆ FillUidComboBox()

void dbe::ObjectCreator::FillUidComboBox ( )
private

Definition at line 379 of file ObjectCreator.cpp.

380{
381 ui->ComboBoxForbiddenUid->clear();
382
383 QStringList listOfUID;
384 QString nameOfClass = QString ( this_object_class.p_name.c_str() );
385
386 std::vector<tref> const & vec = dbe::config::api::info::onclass::objects (
387 nameOfClass.toStdString(),
388 false );
389
390 for ( size_t i = 0; i < vec.size(); ++i )
391 {
392 ui->ComboBoxForbiddenUid->addItem ( QString ( vec.at ( i ).UID().c_str() ) );
393 listOfUID << QString ( vec.at ( i ).UID().c_str() );
394 }
395
396 if ( !listOfUID.isEmpty() )
397 {
398 ui->ComboBoxForbiddenUid->setToolTip (
399 QString ( "Already used object unique ID of class %1 " ).arg ( nameOfClass ) );
400 ui->ComboBoxForbiddenUid->show();
401 }
402
403 QVariant varFromList ( listOfUID );
404 ValidatorAcceptNoMatch * myval = new ValidatorAcceptNoMatch ( varFromList, this );
405 ui->LineEditUID->SetValidator ( myval );
406}
static std::vector< dbe::inner::configobject::tref > objects(std::string const &cname, bool const keep_inherited=true)

◆ GetMessage()

QString dbe::ObjectCreator::GetMessage ( )
private

Definition at line 337 of file ObjectCreator.cpp.

338{
339 if ( this_state == editorOk )
340 return QString (
341 "Now you can create object '%1' of class '%2'." ).arg ( this_newuid ).arg (
342 QString ( ( this_object_class.p_name ).c_str() ) );
344 return QString (
345 "Select class, set unique ID, select file where to create object and set obligatory attributes and relationships!" );
346 else if ( GetState ( classNotSelected ) )
347 {
348 return QString ( "First select class!" );
349 }
350 else if ( GetState ( fileNotSet ) )
351 return QString (
352 "Set active file where to create new object" );
353 else if ( GetState ( uidNotSet ) )
354 {
355 return QString ( "Set the object UID" );
356 }
357 else if ( GetState ( nullNotFilled ) )
358 return QString (
359 "All NOT NULL attributes or relationships must be set!" );
360
361 return QString ( "Problem to process Object Create operation!" );
362}
@ editorOk
@ nullNotFilled
@ classNotSelected
@ uidNotSet
@ fileNotSet
bool GetState(int Flags)

◆ GetState()

bool dbe::ObjectCreator::GetState ( int Flags)
private

Definition at line 364 of file ObjectCreator.cpp.

365{
366 return ( ( this_state & Flags ) == Flags );
367}

◆ MustPressReturn

void dbe::ObjectCreator::MustPressReturn ( QString const & )
privateslot

Definition at line 614 of file ObjectCreator.cpp.

615{
616 QPalette yellow;
617 yellow.setColor ( QPalette::Active, QPalette::Window, QColor ( "yellow" ) );
618
619 this_status_bar->setPalette ( yellow );
620 this_status_bar->showMessage ( QString ( "Press ENTER to set new UID!" ) );
621}

◆ SetComboClass()

void dbe::ObjectCreator::SetComboClass ( )
private

Definition at line 183 of file ObjectCreator.cpp.

184{
185 QStringList ListOfClasses ( dbe::config::api::info::onclass::allnames<QStringList>() );
186 ui->ComboBoxClass->addItems ( ListOfClasses );
187
188 QCompleter * completer = new QCompleter ( ui->ComboBoxClass->model(), ui->ComboBoxClass );
189 completer->setCaseSensitivity ( Qt::CaseInsensitive );
190 completer->setFilterMode(Qt::MatchContains);
191 ui->ComboBoxClass->setCompleter ( completer );
192 ui->ComboBoxClass->setEditable ( true );
193
194 QVariant VarFromList ( ListOfClasses );
195 ValidatorAcceptMatch * Validator = new ValidatorAcceptMatch ( VarFromList, this );
196 ui->ComboBoxClass->setValidator ( Validator );
197}

◆ SetController()

void dbe::ObjectCreator::SetController ( )
private

Definition at line 200 of file ObjectCreator.cpp.

201{
202 connect ( ui->FileView, SIGNAL ( stateChanged ( const QString & ) ),
203 this, SLOT ( ActiveFileChanged ( const QString & ) ),
204 Qt::UniqueConnection );
205
206 connect ( ui->CreateObjectButton, SIGNAL ( clicked() ), this, SLOT ( CreateObject() ),
207 Qt::UniqueConnection );
208
209 connect ( ui->CreateOpenObjectButton, SIGNAL ( clicked() ), this, SLOT ( CreateOpenObject() ),
210 Qt::UniqueConnection );
211
212 connect ( ui->ExitButton, SIGNAL ( clicked() ), this, SLOT ( close() ),
213 Qt::UniqueConnection );
214
215 connect ( ui->LineEditUID, SIGNAL ( textChanged ( QString ) ), this,
216 SLOT ( UpdateActions ( QString ) ),
217 Qt::UniqueConnection );
218
219 connect ( ui->LineEditUID, SIGNAL ( textEdited ( const QString & ) ),
220 this, SLOT ( MustPressReturn ( const QString & ) ),
221 Qt::UniqueConnection );
222
223 connect ( this, SIGNAL ( stateChanged() ), this, SLOT ( UpdateActions() ),
224 Qt::UniqueConnection );
225
226 connect ( this, SIGNAL ( stateChanged() ), this, SLOT ( SetObjectChanged() ),
227 Qt::UniqueConnection );
228}
void MustPressReturn(QString const &)

◆ SetObjectChanged

void dbe::ObjectCreator::SetObjectChanged ( )
privateslot

Definition at line 451 of file ObjectCreator.cpp.

452{
453 this_object_changed = true;
454}

◆ SetStatusBar()

void dbe::ObjectCreator::SetStatusBar ( )
private

Definition at line 253 of file ObjectCreator.cpp.

254{
255 this_status_bar->setSizeGripEnabled ( false );
256 this_status_bar->setAutoFillBackground ( true );
257 this_status_bar->showMessage (
258 QString ( "Select class, set new object UID, select file where to create object!" ) );
259 ui->StatusFrame->setFrameStyle ( QFrame::NoFrame );
260 ui->StatusLayout->addWidget ( this_status_bar );
261}

◆ SetUID

void dbe::ObjectCreator::SetUID ( )
privateslot

Definition at line 581 of file ObjectCreator.cpp.

582{
583 if ( this_file_for_new_object.isEmpty() )
584 {
585 ERROR ( "Object creation is not feasible", "Database file not selected" );
586 return;
587 }
588
589 if ( ui->LineEditUID->IsValid() )
590 {
591 this_newuid = ui->LineEditUID->text();
592
593 QString textForUser = QString ( "New Object ID: %1" ).arg ( this_newuid );
594 ui->UidLabel->setText ( textForUser );
595 }
596 else
597 {
598 WARN ( "Object creation is not feasible", "Invalid UID provided" );
599 return;
600 }
601
602 if ( !this_file_for_new_object.isEmpty() )
603 {
604 UidSet = true;
605 this_associated_editor->setDisabled ( false );
606 emit stateChanged();
607 }
608 else
609 {
610 TLOG_DEBUG(0) << "active file empty!! check!!" ;
611 }
612}
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
#define WARN(...)
Definition messenger.hpp:80

◆ setup_copy_editor()

void dbe::ObjectCreator::setup_copy_editor ( )
private

Definition at line 544 of file ObjectCreator.cpp.

545{
546 if ( ui->ComboBoxClass->IsValid() )
547 {
548 QString cname = QString::fromStdString ( this_object_class.p_name );
549
550 ui->ClassLabel->setText ( QString ( "Selected Class: %1" ).arg ( cname ) );
551 setWindowTitle ( QString ( "Create New Object of Class %1" ).arg ( cname ) );
552
553 this_associated_editor = new ObjectEditor ( *this_src_object, this, true );
554 this_associated_editor->setWindowModality ( Qt::NonModal );
557 this_associated_editor->setDisabled ( true );
558
559 ui->EditorLayout->addWidget ( this_associated_editor );
560 connect ( this_associated_editor, SIGNAL ( WidgetUpdated() ), this,
561 SLOT ( UpdateActions() ),
562 Qt::UniqueConnection );
563
565 ui->ComboBoxForbiddenUid->hide();
566
567 QString tmpSt = ui->LineEditUID->text();
568
569 if ( !tmpSt.isEmpty() )
570 {
571 ui->LineEditUID->clear();
572 ui->LineEditUID->setText ( tmpSt );
573 SetUID();
574 }
575
576 emit stateChanged();
577 this_object_changed = false;
578 }
579}
void HideDetailWidget(bool Hide)

◆ setup_editor()

void dbe::ObjectCreator::setup_editor ( )
private

To anyone wondering this is a list of all the uids that cannot be used(at some point i thought this could be useful to show to the user) // – that was a very stupid idea!

Definition at line 478 of file ObjectCreator.cpp.

479{
480 if ( ui->ComboBoxClass->IsValid() )
481 {
482
483 this_newuid = QString();
484 QString cname = QString::fromStdString ( this_object_class.p_name );
485
486 // Create the editor for the new object to be able to modify attributes before creation
487 this_associated_editor = new ObjectEditor ( cname.toStdString(), this );
488 this_associated_editor->setWindowModality ( Qt::NonModal );
490 this_associated_editor->setDisabled ( true );
491 ui->EditorLayout->addWidget ( this_associated_editor );
492
493 {
494 // Set appropriately the stretch factor such that contents are resized
495 // favoring the object editor side
496 QSizePolicy pol = ui->splitter->widget ( 1 )->sizePolicy();
497 pol.setHorizontalStretch ( 2 );
498// pol.setHorizontalPolicy(QSizePolicy::Maximum);
499 ui->splitter->widget ( 1 )->setSizePolicy ( pol );
500 }
501
502 {
503 // Set horizontal size of the editor pane to the first widget size
504 this_associated_editor->resize ( this_associated_editor->sizeHint() );
505 QList<QTableWidget *> const & editor_widgets
506 {
507 this_associated_editor->findChildren<QTableWidget *>()
508 };
509
510 this_associated_editor->setMinimumWidth ( editor_widgets[0]->width() / 2 );
511
512 QRect this_widget_geometry = this->geometry();
513 this_widget_geometry.setWidth ( editor_widgets[0]->width() +
514 ui->ObjectCreatorWidget->width() );
515 this->setGeometry ( this_widget_geometry );
516
517 }
518
519 // Set the labels to the class name
520 ui->ClassLabel->setText ( QString ( "Selected Class: %1" ).arg ( cname ) );
521 setWindowTitle ( QString ( "Create New Object of class %1" ).arg ( cname ) );
522
523 connect ( this_associated_editor, SIGNAL ( WidgetUpdated() ), this,
524 SLOT ( UpdateActions() ),
525 Qt::UniqueConnection );
526
528 ui->ComboBoxForbiddenUid->hide();
529
530 QString const & linetext = ui->LineEditUID->text();
531
532 if ( !linetext.isEmpty() )
533 {
534 ui->LineEditUID->clear();
535 ui->LineEditUID->setText ( linetext );
536 SetUID();
537 }
538
539 emit stateChanged();
540 this_object_changed = false;
541 }
542}

◆ stateChanged

void dbe::ObjectCreator::stateChanged ( )
signal

◆ UpdateActions [1/2]

void dbe::ObjectCreator::UpdateActions ( )
privateslot

Definition at line 263 of file ObjectCreator.cpp.

264{
265 bool ReleaseEditor = true;
267
268 if ( !ui->LineEditUID->IsValid() || ui->LineEditUID->text().isEmpty() )
269 {
271 ReleaseEditor = false;
272 this_newuid = QString();
273 }
274 else
275 {
276 this_state &= ~uidNotSet;
277 this_newuid = ui->LineEditUID->text();
278 }
279
280 if ( this_file_for_new_object.isEmpty() )
281 {
283 ReleaseEditor = false;
284 }
285 else
286 {
287 this_state &= ~fileNotSet;
288 }
289
290 if ( ReleaseEditor )
291 {
292 this_associated_editor->setEnabled ( true );
293 }
294
295 if ( this_associated_editor != nullptr )
296 {
298 {
300 }
301 else
302 {
303 this_state &= ~nullNotFilled;
304 }
305 }
306
307 if ( this_state == editorOk )
308 {
309 ui->CreateObjectButton->setEnabled ( true );
310 ui->CreateObjectButton->setPalette ( StyleUtility::PaleGreenPalleteButton );
311
312 ui->CreateOpenObjectButton->setEnabled ( true );
313 ui->CreateOpenObjectButton->setPalette ( StyleUtility::PaleGreenPalleteButton );
314
315 this_status_bar->setPalette ( QApplication::palette ( this ) );
316 this_status_bar->showMessage ( GetMessage() );
317 }
318 else
319 {
320 ui->CreateObjectButton->setEnabled ( false );
321 ui->CreateOpenObjectButton->setEnabled ( false );
322 QPalette buttonAlert;
323 buttonAlert.setColor ( QPalette::Disabled, QPalette::Button, QColor ( "grey" ) );
324 ui->CreateObjectButton->setPalette ( buttonAlert );
325 ui->CreateOpenObjectButton->setPalette ( buttonAlert );
327 this_status_bar->showMessage ( GetMessage() );
328 }
329}
bool IsEditorValid() const
static QPalette PaleGreenPalleteButton
static QPalette WarningStatusBarPalleteWindow

◆ UpdateActions [2/2]

void dbe::ObjectCreator::UpdateActions ( QString Dummy)
privateslot

Definition at line 331 of file ObjectCreator.cpp.

332{
333 Q_UNUSED ( Dummy )
335}

Member Data Documentation

◆ ContextMenu

QMenu* dbe::ObjectCreator::ContextMenu
private

Definition at line 110 of file ObjectCreator.hpp.

◆ this_associated_editor

ObjectEditor* dbe::ObjectCreator::this_associated_editor
private

Definition at line 109 of file ObjectCreator.hpp.

◆ this_create_copy

bool dbe::ObjectCreator::this_create_copy
private

Definition at line 114 of file ObjectCreator.hpp.

◆ this_file_for_new_object

QString dbe::ObjectCreator::this_file_for_new_object
private

Definition at line 108 of file ObjectCreator.hpp.

◆ this_files

FileModel* dbe::ObjectCreator::this_files
private

Definition at line 100 of file ObjectCreator.hpp.

◆ this_is_temporary

bool dbe::ObjectCreator::this_is_temporary
private

Definition at line 112 of file ObjectCreator.hpp.

◆ this_newuid

QString dbe::ObjectCreator::this_newuid
private

Definition at line 107 of file ObjectCreator.hpp.

◆ this_object_changed

bool dbe::ObjectCreator::this_object_changed
private

Definition at line 113 of file ObjectCreator.hpp.

◆ this_object_class

dunedaq::conffwk::class_t dbe::ObjectCreator::this_object_class
private

Definition at line 93 of file ObjectCreator.hpp.

◆ this_relation

dunedaq::conffwk::relationship_t dbe::ObjectCreator::this_relation
private

Definition at line 97 of file ObjectCreator.hpp.

◆ this_sort

QSortFilterProxyModel dbe::ObjectCreator::this_sort
private

Definition at line 99 of file ObjectCreator.hpp.

◆ this_src_object

std::unique_ptr<tref> dbe::ObjectCreator::this_src_object
private

Definition at line 95 of file ObjectCreator.hpp.

◆ this_state

int dbe::ObjectCreator::this_state
private

Definition at line 104 of file ObjectCreator.hpp.

◆ this_status_bar

QStatusBar* dbe::ObjectCreator::this_status_bar
private

Definition at line 102 of file ObjectCreator.hpp.

◆ this_target_object

std::unique_ptr<tref> dbe::ObjectCreator::this_target_object
private

Definition at line 96 of file ObjectCreator.hpp.

◆ ui

std::unique_ptr<dbe::Ui::ObjectCreator> dbe::ObjectCreator::ui
private

Definition at line 91 of file ObjectCreator.hpp.

◆ UidSet

bool dbe::ObjectCreator::UidSet
private

Definition at line 106 of file ObjectCreator.hpp.

◆ uuid

QUuid const dbe::ObjectCreator::uuid
private

Definition at line 116 of file ObjectCreator.hpp.


The documentation for this class was generated from the following files: