DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dbe
src
widgets
ObjectCreator.cpp
Go to the documentation of this file.
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/messenger.hpp
"
7
#include "
dbe/confaccessor.hpp
"
8
#include "
dbe/ObjectCreator.hpp
"
9
#include "
dbe/Validator.hpp
"
10
#include "
dbe/StyleUtility.hpp
"
11
#include "ui_ObjectCreator.h"
12
#include "
dbe/config_api_set.hpp
"
13
#include "
dbe/config_api_graph.hpp
"
14
#include "
dbe/config_api_commands.hpp
"
15
#include "
dbe/config_api.hpp
"
16
17
#include "
logging/Logging.hpp
"
18
19
#include <boost/scope_exit.hpp>
20
21
#include <QCompleter>
22
#include <QMenu>
23
#include <QFileDialog>
24
#include <QFileInfo>
25
#include <QCloseEvent>
26
#include <QMessageBox>
27
28
enum
EditStates
29
{
30
editorOk
= 0,
31
classNotSelected
= 1,
32
uidNotSet
= 2,
33
fileNotSet
= 4,
34
nullNotFilled
= 8
35
};
36
37
//------------------------------------------------------------------------------------------
38
dbe::ObjectCreator::~ObjectCreator
() =
default
;
39
//------------------------------------------------------------------------------------------
40
41
//------------------------------------------------------------------------------------------
42
/*
43
* Create an object in a class
44
*/
45
dbe::ObjectCreator::ObjectCreator
(
dunedaq::conffwk::class_t
const
& cinfo, QWidget * parent )
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
69
SetComboClass
();
70
ui
->LineEditUID->setToolTip ( QString (
"Type Object unique ID and press ENTER"
) );
71
72
ui
->ComboBoxForbiddenUid->hide();
73
ui
->SetFileButton->hide();
74
75
SetController
();
76
BuildFileModel
();
77
SetStatusBar
();
78
BuildContextMenu
();
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
83
setup_editor
();
84
ui
->ComboBoxClass->setEditText ( cname );
85
86
ui
->SetUidButton->setVisible (
false
);
87
UpdateActions
();
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
}
98
99
//------------------------------------------------------------------------------------------
100
101
//------------------------------------------------------------------------------------------
102
/*
103
* Clone an object in a class , uid will be required to be set explicitly
104
*/
105
dbe::ObjectCreator::ObjectCreator
(
tref
const
& clonefrom,
106
dunedaq::conffwk::relationship_t
const
& the_relation,
107
QWidget * parent )
108
:
109
ObjectCreator
(
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
}
115
116
//------------------------------------------------------------------------------------------
117
118
//------------------------------------------------------------------------------------------
119
dbe::ObjectCreator::ObjectCreator
(
tref
const
& clonefrom, QWidget * parent )
120
:
121
QWidget ( parent ),
122
ui
( new
Ui
::
ObjectCreator
),
123
this_object_class
(
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
143
SetComboClass
();
144
ui
->LineEditUID->setToolTip ( QString (
"Type Object unique ID and press ENTER"
) );
145
146
ui
->ComboBoxForbiddenUid->hide();
147
ui
->SetFileButton->hide();
148
149
SetController
();
150
BuildFileModel
();
151
SetStatusBar
();
152
BuildContextMenu
();
153
154
int
index =
ui
->ComboBoxClass->findText ( QString::fromStdString (
155
clonefrom.
class_name
() ) );
156
157
ui
->ComboBoxClass->setCurrentIndex ( index );
158
setup_copy_editor
();
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
);
177
UpdateActions
();
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
}
184
185
//------------------------------------------------------------------------------------------
186
187
//------------------------------------------------------------------------------------------
188
void
dbe::ObjectCreator::SetComboClass
()
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
}
203
204
205
void
dbe::ObjectCreator::SetController
()
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
}
234
235
void
dbe::ObjectCreator::BuildFileModel
()
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
}
257
258
void
dbe::ObjectCreator::SetStatusBar
()
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
}
267
268
void
dbe::ObjectCreator::UpdateActions
()
269
{
270
bool
ReleaseEditor =
true
;
271
this_state
=
editorOk
;
272
273
if
( !
ui
->LineEditUID->IsValid() ||
ui
->LineEditUID->text().isEmpty() )
274
{
275
this_state
|=
uidNotSet
;
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
{
287
this_state
|=
fileNotSet
;
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
{
304
this_state
|=
nullNotFilled
;
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 );
331
this_status_bar
->setPalette (
StyleUtility::WarningStatusBarPalleteWindow
);
332
this_status_bar
->showMessage (
GetMessage
() );
333
}
334
}
335
336
void
dbe::ObjectCreator::UpdateActions
( QString Dummy )
337
{
338
Q_UNUSED ( Dummy )
339
UpdateActions
();
340
}
341
342
QString
dbe::ObjectCreator::GetMessage
()
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() ) );
348
else
if
(
GetState
(
classNotSelected
|
uidNotSet
|
fileNotSet
) )
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
}
368
369
bool
dbe::ObjectCreator::GetState
(
int
Flags )
370
{
371
return
( (
this_state
& Flags ) == Flags );
372
}
373
374
void
dbe::ObjectCreator::BuildContextMenu
()
375
{
376
ContextMenu
=
new
QMenu (
this
);
377
ContextMenu
->addAction ( tr (
"&Edit Include Files"
),
this
, SLOT (
AddInclude
() ),
378
QKeySequence ( tr (
"Ctrl+Z"
) ) );
379
}
380
381
void
dbe::ObjectCreator::AddInclude
()
382
{}
383
384
void
dbe::ObjectCreator::FillUidComboBox
()
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
}
412
413
void
dbe::ObjectCreator::CreateOpenObject
() {
414
CreateObject
(
true
);
415
}
416
417
void
dbe::ObjectCreator::CreateObject
(
bool
openEditor)
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
}
455
456
void
dbe::ObjectCreator::SetObjectChanged
()
457
{
458
this_object_changed
=
true
;
459
}
460
461
void
dbe::ObjectCreator::ActiveFileChanged
(
const
QString & fname )
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
470
this_file_for_new_object
= fname;
471
ui
->FileView->setToolTip (
472
QString (
"Activate file which will store the new object: "
).append (
473
this_file_for_new_object
) );
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
}
482
483
void
dbe::ObjectCreator::setup_editor
()
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
532
FillUidComboBox
();
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
}
548
549
void
dbe::ObjectCreator::setup_copy_editor
()
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
569
FillUidComboBox
();
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
}
585
586
void
dbe::ObjectCreator::SetUID
()
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
}
618
619
void
dbe::ObjectCreator::MustPressReturn
(
const
QString & )
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
}
627
628
bool
dbe::ObjectCreator::CanClose
()
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
{
648
config::api::commands::delobj
(
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
}
671
672
void
dbe::ObjectCreator::closeEvent
( QCloseEvent * event )
673
{
674
if
(
CanClose
() )
675
{
676
if
(
this_associated_editor
)
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
}
EditStates
EditStates
Definition
ObjectCreator.cpp:29
editorOk
@ editorOk
Definition
ObjectCreator.cpp:30
nullNotFilled
@ nullNotFilled
Definition
ObjectCreator.cpp:34
classNotSelected
@ classNotSelected
Definition
ObjectCreator.cpp:31
uidNotSet
@ uidNotSet
Definition
ObjectCreator.cpp:32
fileNotSet
@ fileNotSet
Definition
ObjectCreator.cpp:33
ObjectCreator.hpp
StyleUtility.hpp
Validator.hpp
dbe::FileModel
Definition
FileModel.hpp:17
dbe::ObjectCreator::BuildFileModel
void BuildFileModel()
Definition
ObjectCreator.cpp:235
dbe::ObjectCreator::UpdateActions
void UpdateActions()
Definition
ObjectCreator.cpp:268
dbe::ObjectCreator::this_associated_editor
ObjectEditor * this_associated_editor
Definition
ObjectCreator.hpp:114
dbe::ObjectCreator::uuid
QUuid const uuid
Definition
ObjectCreator.hpp:121
dbe::ObjectCreator::setup_editor
void setup_editor()
Definition
ObjectCreator.cpp:483
dbe::ObjectCreator::MustPressReturn
void MustPressReturn(QString const &)
Definition
ObjectCreator.cpp:619
dbe::ObjectCreator::this_files
FileModel * this_files
Definition
ObjectCreator.hpp:105
dbe::ObjectCreator::UidSet
bool UidSet
Definition
ObjectCreator.hpp:111
dbe::ObjectCreator::SetStatusBar
void SetStatusBar()
Definition
ObjectCreator.cpp:258
dbe::ObjectCreator::this_relation
dunedaq::conffwk::relationship_t this_relation
Definition
ObjectCreator.hpp:102
dbe::ObjectCreator::CreateOpenObject
void CreateOpenObject()
Definition
ObjectCreator.cpp:413
dbe::ObjectCreator::ActiveFileChanged
void ActiveFileChanged(QString const &)
Definition
ObjectCreator.cpp:461
dbe::ObjectCreator::SetController
void SetController()
Definition
ObjectCreator.cpp:205
dbe::ObjectCreator::this_is_temporary
bool this_is_temporary
Definition
ObjectCreator.hpp:117
dbe::ObjectCreator::ObjectCreator
ObjectCreator(dunedaq::conffwk::class_t const &classinfo, QWidget *parent=0)
Definition
ObjectCreator.cpp:45
dbe::ObjectCreator::setup_copy_editor
void setup_copy_editor()
Definition
ObjectCreator.cpp:549
dbe::ObjectCreator::closeEvent
void closeEvent(QCloseEvent *event)
Definition
ObjectCreator.cpp:672
dbe::ObjectCreator::ui
std::unique_ptr< dbe::Ui::ObjectCreator > ui
Definition
ObjectCreator.hpp:96
dbe::ObjectCreator::GetMessage
QString GetMessage()
Definition
ObjectCreator.cpp:342
dbe::ObjectCreator::stateChanged
void stateChanged()
dbe::ObjectCreator::~ObjectCreator
~ObjectCreator()
dbe::ObjectCreator::this_object_class
dunedaq::conffwk::class_t this_object_class
Definition
ObjectCreator.hpp:98
dbe::ObjectCreator::this_file_for_new_object
QString this_file_for_new_object
Definition
ObjectCreator.hpp:113
dbe::ObjectCreator::FillUidComboBox
void FillUidComboBox()
Definition
ObjectCreator.cpp:384
dbe::ObjectCreator::this_src_object
std::unique_ptr< tref > this_src_object
Definition
ObjectCreator.hpp:100
dbe::ObjectCreator::CreateObject
void CreateObject(bool openEditor=false)
Definition
ObjectCreator.cpp:417
dbe::ObjectCreator::BuildContextMenu
void BuildContextMenu()
Definition
ObjectCreator.cpp:374
dbe::ObjectCreator::ContextMenu
QMenu * ContextMenu
Definition
ObjectCreator.hpp:115
dbe::ObjectCreator::AddInclude
void AddInclude()
Definition
ObjectCreator.cpp:381
dbe::ObjectCreator::this_sort
QSortFilterProxyModel this_sort
Definition
ObjectCreator.hpp:104
dbe::ObjectCreator::this_newuid
QString this_newuid
Definition
ObjectCreator.hpp:112
dbe::ObjectCreator::this_object_changed
bool this_object_changed
Definition
ObjectCreator.hpp:118
dbe::ObjectCreator::CanClose
bool CanClose()
Definition
ObjectCreator.cpp:628
dbe::ObjectCreator::this_create_copy
bool this_create_copy
Definition
ObjectCreator.hpp:119
dbe::ObjectCreator::SetComboClass
void SetComboClass()
Definition
ObjectCreator.cpp:188
dbe::ObjectCreator::SetObjectChanged
void SetObjectChanged()
Definition
ObjectCreator.cpp:456
dbe::ObjectCreator::this_state
int this_state
Definition
ObjectCreator.hpp:109
dbe::ObjectCreator::SetUID
void SetUID()
Definition
ObjectCreator.cpp:586
dbe::ObjectCreator::this_target_object
std::unique_ptr< tref > this_target_object
Definition
ObjectCreator.hpp:101
dbe::ObjectCreator::this_status_bar
QStatusBar * this_status_bar
Definition
ObjectCreator.hpp:107
dbe::ObjectCreator::GetState
bool GetState(int Flags)
Definition
ObjectCreator.cpp:369
dbe::ObjectEditor
Definition
ObjectEditor.hpp:34
dbe::StyleUtility::PaleGreenPalleteButton
static QPalette PaleGreenPalleteButton
Definition
StyleUtility.hpp:33
dbe::StyleUtility::WarningStatusBarPalleteWindow
static QPalette WarningStatusBarPalleteWindow
Definition
StyleUtility.hpp:32
dbe::ValidatorAcceptMatch
Definition
Validator.hpp:15
dbe::ValidatorAcceptNoMatch
Definition
Validator.hpp:25
dbe::confaccessor::check_file_rw
static bool check_file_rw(const QString &FileName)
Definition
confaccessor.cpp:245
dbe::confaccessor::ref
static confaccessor & ref()
Definition
confaccessor.cpp:36
dbe::confaccessor::db_implementation_name
static QString db_implementation_name()
Definition
confaccessor.cpp:130
dbe::config::api::info::onclass::objects
static std::vector< dbe::inner::configobject::tref > objects(std::string const &cname, bool const keep_inherited=true)
dbe::config::api::info::onclass::allnames
static T allnames()
Definition
config_api.hpp:37
dbe::inner::configobject::ref_interface::class_name
std::string class_name() const
Definition
config_reference.hpp:201
dbe::inner::configobject::ref_interface::UID
std::string UID() const
Definition
config_reference.hpp:196
dbe::inner::dbcontroller::get
static configobject::tref get(dbe::cokey const &desc)
Definition
dbcontroller.cpp:388
confaccessor.hpp
config_api.hpp
config_api_commands.hpp
config_api_graph.hpp
config_api_set.hpp
Logging.hpp
TLOG_DEBUG
#define TLOG_DEBUG(lvl,...)
Definition
Logging.hpp:112
messenger.hpp
ERROR
#define ERROR(...)
Definition
messenger.hpp:93
WARN
#define WARN(...)
Definition
messenger.hpp:85
Ui
Definition
SchemaSettings.hpp:10
conffwk
Definition
__init__.py:1
dbe::config::api::commands::delobj
bool delobj(inner::configobject::tref obj, QUuid const &src)
Definition
config_api_commands.cpp:79
dbe::config
Definition
config_api.hpp:31
dbe::tref
inner::configobject::tref tref
Definition
tref.hpp:35
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::conffwk::class_t
Definition
Schema.hpp:162
dunedaq::conffwk::relationship_t
Definition
Schema.hpp:120
Generated on
for DUNE-DAQ by
1.17.0