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

#include <SchemaMethodImplementationEditor.hpp>

Inheritance diagram for dbse::SchemaMethodImplementationEditor:
[legend]
Collaboration diagram for dbse::SchemaMethodImplementationEditor:
[legend]

Signals

void RebuildModel ()

Public Member Functions

 ~SchemaMethodImplementationEditor ()
 SchemaMethodImplementationEditor (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, QWidget *parent=nullptr)
 SchemaMethodImplementationEditor (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, QWidget *parent=nullptr)
void SetController ()
void InitialSettings ()
void ParseToSave ()
void ParseToCreate ()

Protected Member Functions

void FillInfo ()

Private Slots

void ProxySlot ()
void ClassUpdated (QString ClassName)

Private Attributes

std::unique_ptr< dbse::Ui::SchemaMethodImplementationEditor > ui
dunedaq::oks::OksClassm_class
dunedaq::oks::OksMethodm_method
dunedaq::oks::OksMethodImplementationm_implementation
bool UsedNew

Detailed Description

Definition at line 22 of file SchemaMethodImplementationEditor.hpp.

Constructor & Destructor Documentation

◆ ~SchemaMethodImplementationEditor()

dbse::SchemaMethodImplementationEditor::~SchemaMethodImplementationEditor ( )
default

◆ SchemaMethodImplementationEditor() [1/2]

dbse::SchemaMethodImplementationEditor::SchemaMethodImplementationEditor ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
dunedaq::oks::OksMethodImplementation * Implementation,
QWidget * parent = nullptr )
explicit

Definition at line 16 of file SchemaMethodImplementationEditor.cpp.

18 : QWidget ( parent ),
19 ui ( new Ui::SchemaMethodImplementationEditor ),
20 m_class ( Class ),
21 m_method ( Method ),
22 m_implementation ( Implementation ),
23 UsedNew ( false )
24{
25 QWidget::setAttribute(Qt::WA_DeleteOnClose);
26 ui->setupUi ( this );
29}
std::unique_ptr< dbse::Ui::SchemaMethodImplementationEditor > ui
dunedaq::oks::OksMethodImplementation * m_implementation

◆ SchemaMethodImplementationEditor() [2/2]

dbse::SchemaMethodImplementationEditor::SchemaMethodImplementationEditor ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
QWidget * parent = nullptr )
explicit

Definition at line 31 of file SchemaMethodImplementationEditor.cpp.

35 : QWidget ( parent ),
36 ui ( new Ui::SchemaMethodImplementationEditor ),
37 m_class ( Class ),
38 m_method ( Method ),
39 m_implementation ( nullptr ),
40 UsedNew ( true )
41{
42 QWidget::setAttribute(Qt::WA_DeleteOnClose);
43 ui->setupUi ( this );
46}

Member Function Documentation

◆ ClassUpdated

void dbse::SchemaMethodImplementationEditor::ClassUpdated ( QString ClassName)
privateslot

Definition at line 55 of file SchemaMethodImplementationEditor.cpp.

56{
57 if(!UsedNew && class_name.toStdString() == m_class->get_name()) {
58 if(m_method->find_implementation(m_implementation->get_language()) != nullptr) {
59 FillInfo();
60 } else {
61 QWidget::close();
62 }
63 }
64}

◆ FillInfo()

void dbse::SchemaMethodImplementationEditor::FillInfo ( )
protected

Definition at line 66 of file SchemaMethodImplementationEditor.cpp.

67{
68 ui->MethodImplementationLanguage->setText (
69 QString::fromStdString ( m_implementation->get_language() ) );
70 ui->MethodImplementationPrototype->setText (
71 QString::fromStdString ( m_implementation->get_prototype() ) );
72 ui->MethodImplementationDescription->setPlainText (
73 QString::fromStdString ( m_implementation->get_body() ) );
74
75 std::string name = m_class->get_name() + m_method->get_name()
76 + m_implementation->get_language();
77 setObjectName ( QString::fromStdString(name) );
78}

◆ InitialSettings()

void dbse::SchemaMethodImplementationEditor::InitialSettings ( )

Definition at line 80 of file SchemaMethodImplementationEditor.cpp.

81{
82 std::string title = "Method Implementation for " + m_class->get_name() + "::" + m_method->get_name();
83 setWindowTitle (QString::fromStdString(title));
84
85 if ( UsedNew ) {
86 std::string name = m_class->get_name() + m_method->get_name();
87 setObjectName ( QString::fromStdString(name) );
88 }
89 else {
90 FillInfo();
91 }
92}

◆ ParseToCreate()

void dbse::SchemaMethodImplementationEditor::ParseToCreate ( )

Definition at line 138 of file SchemaMethodImplementationEditor.cpp.

139{
140 if ( ui->MethodImplementationLanguage->text().isEmpty()
141 && ui->MethodImplementationLanguage->text().isEmpty()
142 && ui->MethodImplementationDescription->toPlainText().isEmpty() ) {
143 // Close empty dialogue box
144 close();
145 return;
146 }
147
148 if ( ui->MethodImplementationLanguage->text().isEmpty() )
149 {
150 QMessageBox::warning (
151 0, "Schema editor",
152 QString ( "Please Provide a Language for the method implementation !" ) );
153 return;
154 }
155
156 if ( ui->MethodImplementationPrototype->text().isEmpty() )
157 {
158 QMessageBox::warning (
159 0, "Schema editor",
160 QString ( "Please Provide a prototype for the method implementation !" ) );
161 return;
162 }
163
164 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
165 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
166 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText()
167 .toStdString();
168
170 m_method,
171 MethodLanguage,
172 MethodPrototype,
173 MethodDescription );
174 emit RebuildModel();
175 close();
176}
static KernelWrapper & GetInstance()
void PushAddMethodImplementationComand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)

◆ ParseToSave()

void dbse::SchemaMethodImplementationEditor::ParseToSave ( )

Definition at line 94 of file SchemaMethodImplementationEditor.cpp.

95{
96 bool changed = false;
97 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
98 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
99
100 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText()
101 .toStdString();
102
103 if ( MethodLanguage != m_implementation->get_language() )
104 {
106 m_method,
108 MethodLanguage );
109 changed = true;
110 }
111
112 if ( MethodPrototype != m_implementation->get_prototype() )
113 {
115 m_method,
117 MethodPrototype );
118 changed = true;
119 }
120
121 if ( MethodDescription != m_implementation->get_body() )
122 {
124 m_method,
126 MethodDescription );
127 changed = true;
128 }
129
130 if ( changed )
131 {
132 emit RebuildModel();
133 }
134
135 close();
136}
void PushSetMethodImplementationLanguage(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Language)
Method implementation commands.
void PushSetMethodImplementationPrototype(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Prototype)
void PushSetMethodImplementationBody(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Body)
Only Configuration DB opened by rdbconfig or oksconflibs plug in can be changed

◆ ProxySlot

void dbse::SchemaMethodImplementationEditor::ProxySlot ( )
privateslot

◆ RebuildModel

void dbse::SchemaMethodImplementationEditor::RebuildModel ( )
signal

◆ SetController()

void dbse::SchemaMethodImplementationEditor::SetController ( )

Definition at line 48 of file SchemaMethodImplementationEditor.cpp.

49{
50 connect ( ui->SaveButton, SIGNAL ( clicked() ), this, SLOT ( ProxySlot() ) );
51 connect ( &KernelWrapper::GetInstance(), SIGNAL ( ClassUpdated ( QString ) ), this,
52 SLOT ( ClassUpdated ( QString ) ) );
53}

Member Data Documentation

◆ m_class

dunedaq::oks::OksClass* dbse::SchemaMethodImplementationEditor::m_class
private

Definition at line 45 of file SchemaMethodImplementationEditor.hpp.

◆ m_implementation

dunedaq::oks::OksMethodImplementation* dbse::SchemaMethodImplementationEditor::m_implementation
private

Definition at line 47 of file SchemaMethodImplementationEditor.hpp.

◆ m_method

dunedaq::oks::OksMethod* dbse::SchemaMethodImplementationEditor::m_method
private

Definition at line 46 of file SchemaMethodImplementationEditor.hpp.

◆ ui

std::unique_ptr<dbse::Ui::SchemaMethodImplementationEditor> dbse::SchemaMethodImplementationEditor::ui
private

Definition at line 44 of file SchemaMethodImplementationEditor.hpp.

◆ UsedNew

bool dbse::SchemaMethodImplementationEditor::UsedNew
private

Definition at line 48 of file SchemaMethodImplementationEditor.hpp.


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