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 29 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 45 of file ObjectCreator.cpp.

46 :
47 QWidget ( parent ),
48 ui ( new Ui::ObjectCreator ),
49 this_object_class ( cinfo ),
50 this_target_object ( nullptr ),
51 this_relation ( dunedaq::conffwk::relationship_t() ),
52 this_files ( nullptr ),
53 this_status_bar ( nullptr ),
54 this_state ( 0 ),
55 UidSet ( false ),
56 this_associated_editor ( nullptr ),
57 ContextMenu ( nullptr ),
58 this_is_temporary ( false ),
59 this_object_changed ( false ),
60 this_create_copy ( false ),
61 uuid ( QUuid::createUuid() )
62{
63 ui->setupUi ( this );
64 this_status_bar = new QStatusBar ( ui->StatusFrame );
65
66 QString cname = QString::fromStdString ( this_object_class.p_name );
67 setWindowTitle ( QString ( "Create New Object of Class %1" ).arg ( cname ) );
68
70 ui->LineEditUID->setToolTip ( QString ( "Type Object unique ID and press ENTER" ) );
71
72 ui->ComboBoxForbiddenUid->hide();
73 ui->SetFileButton->hide();
74
79
80 int index = ui->ComboBoxClass->findText ( cname );
81 ui->ComboBoxClass->setCurrentIndex ( 1 ); // If index is 0 somehow this doesnt work
82 ui->ComboBoxClass->setCurrentIndex ( index ); // Now set it to the right value posssibly 0
84 ui->ComboBoxClass->setEditText ( cname );
85
86 ui->SetUidButton->setVisible ( false );
88
89 QSize SplitterSize = ui->splitter->size();
90 int Width = SplitterSize.width() / 2;
91
92 QList<int> List;
93 List.push_back ( Width );
94 List.push_back ( Width );
95
96 ui->splitter->setSizes ( List );
97}
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 105 of file ObjectCreator.cpp.

108 :
110 config::api::info::onclass::definition ( clonefrom.class_name(), false ), parent )
111{
112 this_target_object.reset ( new tref ( clonefrom ) );
113 this_relation = the_relation;
114}
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:35

◆ 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 119 of file ObjectCreator.cpp.

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

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

◆ AddInclude

void dbe::ObjectCreator::AddInclude ( )
privateslot

Definition at line 381 of file ObjectCreator.cpp.

382{}

◆ BuildContextMenu()

void dbe::ObjectCreator::BuildContextMenu ( )
private

Definition at line 374 of file ObjectCreator.cpp.

375{
376 ContextMenu = new QMenu ( this );
377 ContextMenu->addAction ( tr ( "&Edit Include Files" ), this, SLOT ( AddInclude() ),
378 QKeySequence ( tr ( "Ctrl+Z" ) ) );
379}

◆ BuildFileModel()

void dbe::ObjectCreator::BuildFileModel ( )
private

Definition at line 235 of file ObjectCreator.cpp.

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

◆ CanClose()

bool dbe::ObjectCreator::CanClose ( )

Definition at line 628 of file ObjectCreator.cpp.

629{
630
631 if ( ( this_object_changed and ui->CreateObjectButton->isEnabled() ) or
632 ( this_associated_editor and this_associated_editor->WasObjectChanged() ) )
633 {
634 int ret =
635 QMessageBox::question (
636 0,
637 tr ( "DBE - ObjectCreate" ),
638 QString ( "There are pending actions for this dialogue" ),
639 QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel );
640
641 if ( ret == QMessageBox::Discard )
642 {
643 this_object_changed = false;
644 this_associated_editor->ResetObjectChanged();
645
646 try
647 {
649 inner::dbcontroller::get ( { this_newuid.toStdString(), this_object_class.p_name } ),
650 uuid );
651 }
652 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
653 {
654 // nothing specific handle needed in this , it is possible that there is no resul
655 }
656
657 return true;
658 }
659 else if ( ret == QMessageBox::Cancel )
660 {
661 return false;
662 }
663
664 return true;
665 }
666 else
667 {
668 return true;
669 }
670}
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 672 of file ObjectCreator.cpp.

673{
674 if ( CanClose() )
675 {
677 {
678 this_associated_editor->close();
679 this_associated_editor = nullptr;
680 }
681
682 event->accept();
683 }
684 else
685 {
686 event->ignore();
687 }
688}

◆ CreateObject

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

Called from ui when the create button has been pressed

Definition at line 417 of file ObjectCreator.cpp.

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

◆ CreateOpenObject

void dbe::ObjectCreator::CreateOpenObject ( )
privateslot

Definition at line 413 of file ObjectCreator.cpp.

413 {
414 CreateObject(true);
415}
void CreateObject(bool openEditor=false)

◆ FillUidComboBox()

void dbe::ObjectCreator::FillUidComboBox ( )
private

Definition at line 384 of file ObjectCreator.cpp.

385{
386 ui->ComboBoxForbiddenUid->clear();
387
388 QStringList listOfUID;
389 QString nameOfClass = QString ( this_object_class.p_name.c_str() );
390
391 std::vector<tref> const & vec = dbe::config::api::info::onclass::objects (
392 nameOfClass.toStdString(),
393 false );
394
395 for ( size_t i = 0; i < vec.size(); ++i )
396 {
397 ui->ComboBoxForbiddenUid->addItem ( QString ( vec.at ( i ).UID().c_str() ) );
398 listOfUID << QString ( vec.at ( i ).UID().c_str() );
399 }
400
401 if ( !listOfUID.isEmpty() )
402 {
403 ui->ComboBoxForbiddenUid->setToolTip (
404 QString ( "Already used object unique ID of class %1 " ).arg ( nameOfClass ) );
405 ui->ComboBoxForbiddenUid->show();
406 }
407
408 QVariant varFromList ( listOfUID );
409 ValidatorAcceptNoMatch * myval = new ValidatorAcceptNoMatch ( varFromList, this );
410 ui->LineEditUID->SetValidator ( myval );
411}
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 342 of file ObjectCreator.cpp.

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

◆ GetState()

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

Definition at line 369 of file ObjectCreator.cpp.

370{
371 return ( ( this_state & Flags ) == Flags );
372}

◆ MustPressReturn

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

Definition at line 619 of file ObjectCreator.cpp.

620{
621 QPalette yellow;
622 yellow.setColor ( QPalette::Active, QPalette::Window, QColor ( "yellow" ) );
623
624 this_status_bar->setPalette ( yellow );
625 this_status_bar->showMessage ( QString ( "Press ENTER to set new UID!" ) );
626}

◆ SetComboClass()

void dbe::ObjectCreator::SetComboClass ( )
private

Definition at line 188 of file ObjectCreator.cpp.

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

◆ SetController()

void dbe::ObjectCreator::SetController ( )
private

Definition at line 205 of file ObjectCreator.cpp.

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

◆ SetObjectChanged

void dbe::ObjectCreator::SetObjectChanged ( )
privateslot

Definition at line 456 of file ObjectCreator.cpp.

457{
458 this_object_changed = true;
459}

◆ SetStatusBar()

void dbe::ObjectCreator::SetStatusBar ( )
private

Definition at line 258 of file ObjectCreator.cpp.

259{
260 this_status_bar->setSizeGripEnabled ( false );
261 this_status_bar->setAutoFillBackground ( true );
262 this_status_bar->showMessage (
263 QString ( "Select class, set new object UID, select file where to create object!" ) );
264 ui->StatusFrame->setFrameStyle ( QFrame::NoFrame );
265 ui->StatusLayout->addWidget ( this_status_bar );
266}

◆ SetUID

void dbe::ObjectCreator::SetUID ( )
privateslot

Definition at line 586 of file ObjectCreator.cpp.

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

◆ setup_copy_editor()

void dbe::ObjectCreator::setup_copy_editor ( )
private

Definition at line 549 of file ObjectCreator.cpp.

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

◆ 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 483 of file ObjectCreator.cpp.

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

◆ stateChanged

void dbe::ObjectCreator::stateChanged ( )
signal

◆ UpdateActions [1/2]

void dbe::ObjectCreator::UpdateActions ( )
privateslot

Definition at line 268 of file ObjectCreator.cpp.

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

◆ UpdateActions [2/2]

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

Definition at line 336 of file ObjectCreator.cpp.

337{
338 Q_UNUSED ( Dummy )
340}

Member Data Documentation

◆ ContextMenu

QMenu* dbe::ObjectCreator::ContextMenu
private

Definition at line 115 of file ObjectCreator.hpp.

◆ this_associated_editor

ObjectEditor* dbe::ObjectCreator::this_associated_editor
private

Definition at line 114 of file ObjectCreator.hpp.

◆ this_create_copy

bool dbe::ObjectCreator::this_create_copy
private

Definition at line 119 of file ObjectCreator.hpp.

◆ this_file_for_new_object

QString dbe::ObjectCreator::this_file_for_new_object
private

Definition at line 113 of file ObjectCreator.hpp.

◆ this_files

FileModel* dbe::ObjectCreator::this_files
private

Definition at line 105 of file ObjectCreator.hpp.

◆ this_is_temporary

bool dbe::ObjectCreator::this_is_temporary
private

Definition at line 117 of file ObjectCreator.hpp.

◆ this_newuid

QString dbe::ObjectCreator::this_newuid
private

Definition at line 112 of file ObjectCreator.hpp.

◆ this_object_changed

bool dbe::ObjectCreator::this_object_changed
private

Definition at line 118 of file ObjectCreator.hpp.

◆ this_object_class

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

Definition at line 98 of file ObjectCreator.hpp.

◆ this_relation

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

Definition at line 102 of file ObjectCreator.hpp.

◆ this_sort

QSortFilterProxyModel dbe::ObjectCreator::this_sort
private

Definition at line 104 of file ObjectCreator.hpp.

◆ this_src_object

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

Definition at line 100 of file ObjectCreator.hpp.

◆ this_state

int dbe::ObjectCreator::this_state
private

Definition at line 109 of file ObjectCreator.hpp.

◆ this_status_bar

QStatusBar* dbe::ObjectCreator::this_status_bar
private

Definition at line 107 of file ObjectCreator.hpp.

◆ this_target_object

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

Definition at line 101 of file ObjectCreator.hpp.

◆ ui

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

Definition at line 96 of file ObjectCreator.hpp.

◆ UidSet

bool dbe::ObjectCreator::UidSet
private

Definition at line 111 of file ObjectCreator.hpp.

◆ uuid

QUuid const dbe::ObjectCreator::uuid
private

Definition at line 121 of file ObjectCreator.hpp.


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