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::OksClass * m_class
dunedaq::oks::OksMethod * m_method
dunedaq::oks::OksMethodImplementation * m_implementation
bool UsedNew

Detailed Description

Definition at line 21 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 17 of file SchemaMethodImplementationEditor.cpp.

21 : QWidget(parent)
22 , ui(new Ui::SchemaMethodImplementationEditor)
23 , m_class(Class)
24 , m_method(Method)
25 , m_implementation(Implementation)
26 , UsedNew(false)
27{
28 QWidget::setAttribute(Qt::WA_DeleteOnClose);
29 ui->setupUi(this);
32}
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 34 of file SchemaMethodImplementationEditor.cpp.

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

Member Function Documentation

◆ ClassUpdated

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

Definition at line 58 of file SchemaMethodImplementationEditor.cpp.

59{
60 if (!UsedNew && class_name.toStdString() == m_class->get_name()) {
62 FillInfo();
63 } else {
64 QWidget::close();
65 }
66 }
67}
const std::string & get_name() const noexcept
Definition class.hpp:374
const std::string & get_language() const noexcept
Definition method.hpp:69
OksMethodImplementation * find_implementation(const std::string &language) const
Find method implementation.
Definition method.cpp:357

◆ FillInfo()

void dbse::SchemaMethodImplementationEditor::FillInfo ( )
protected

Definition at line 70 of file SchemaMethodImplementationEditor.cpp.

71{
72 ui->MethodImplementationLanguage->setText(QString::fromStdString(m_implementation->get_language()));
73 ui->MethodImplementationPrototype->setText(QString::fromStdString(m_implementation->get_prototype()));
74 ui->MethodImplementationDescription->setPlainText(QString::fromStdString(m_implementation->get_body()));
75
76 std::string name = m_class->get_name() + m_method->get_name() + m_implementation->get_language();
77 setObjectName(QString::fromStdString(name));
78}
const std::string & get_body() const noexcept
Definition method.hpp:101
const std::string & get_prototype() const noexcept
Definition method.hpp:86
const std::string & get_name() const noexcept
Definition method.hpp:185

◆ InitialSettings()

void dbse::SchemaMethodImplementationEditor::InitialSettings ( )

Definition at line 81 of file SchemaMethodImplementationEditor.cpp.

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

◆ ParseToCreate()

void dbse::SchemaMethodImplementationEditor::ParseToCreate ( )

Definition at line 129 of file SchemaMethodImplementationEditor.cpp.

130{
131 if (ui->MethodImplementationLanguage->text().isEmpty() && ui->MethodImplementationLanguage->text().isEmpty() &&
132 ui->MethodImplementationDescription->toPlainText().isEmpty()) {
133 // Close empty dialogue box
134 close();
135 return;
136 }
137
138 if (ui->MethodImplementationLanguage->text().isEmpty()) {
139 QMessageBox::warning(0, "Schema editor", QString("Please Provide a Language for the method implementation !"));
140 return;
141 }
142
143 if (ui->MethodImplementationPrototype->text().isEmpty()) {
144 QMessageBox::warning(0, "Schema editor", QString("Please Provide a prototype for the method implementation !"));
145 return;
146 }
147
148 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
149 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
150 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText().toStdString();
151
153 m_class, m_method, MethodLanguage, MethodPrototype, MethodDescription);
154 emit RebuildModel();
155 close();
156}
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 95 of file SchemaMethodImplementationEditor.cpp.

96{
97 bool changed = false;
98 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
99 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
100
101 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText().toStdString();
102
103 if (MethodLanguage != m_implementation->get_language()) {
105 m_class, m_method, m_implementation, MethodLanguage);
106 changed = true;
107 }
108
109 if (MethodPrototype != m_implementation->get_prototype()) {
111 m_class, m_method, m_implementation, MethodPrototype);
112 changed = true;
113 }
114
115 if (MethodDescription != m_implementation->get_body()) {
117 m_class, m_method, m_implementation, MethodDescription);
118 changed = true;
119 }
120
121 if (changed) {
122 emit RebuildModel();
123 }
124
125 close();
126}
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)
Changes could not be no object was changed

◆ ProxySlot

void dbse::SchemaMethodImplementationEditor::ProxySlot ( )
privateslot

◆ RebuildModel

void dbse::SchemaMethodImplementationEditor::RebuildModel ( )
signal

◆ SetController()

void dbse::SchemaMethodImplementationEditor::SetController ( )

Definition at line 51 of file SchemaMethodImplementationEditor.cpp.

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

Member Data Documentation

◆ m_class

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

Definition at line 46 of file SchemaMethodImplementationEditor.hpp.

◆ m_implementation

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

Definition at line 48 of file SchemaMethodImplementationEditor.hpp.

◆ m_method

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

Definition at line 47 of file SchemaMethodImplementationEditor.hpp.

◆ ui

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

Definition at line 45 of file SchemaMethodImplementationEditor.hpp.

◆ UsedNew

bool dbse::SchemaMethodImplementationEditor::UsedNew
private

Definition at line 49 of file SchemaMethodImplementationEditor.hpp.


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