8#include "ui_SchemaMethodEditor.h"
23 QWidget::setAttribute(Qt::WA_DeleteOnClose);
39 QWidget::setAttribute(Qt::WA_DeleteOnClose);
48 connect (
ui->buttonBox, SIGNAL ( accepted() ),
this, SLOT (
ProxySlot() ) );
49 connect (
ui->buttonBox, SIGNAL ( rejected() ),
this, SLOT ( close() ) );
50 connect (
ui->AddButton, SIGNAL ( clicked() ),
this,
52 connect (
ui->ImplementationsView, SIGNAL ( doubleClicked ( QModelIndex ) ),
this,
72 auto name = QString::fromStdString (
74 setObjectName ( name );
75 setWindowTitle ( QString (
"Method Editor : %1" ).arg ( name ) );
76 ui->MethodName->setText ( QString::fromStdString (
m_method->get_name() ) );
77 ui->DescriptionTextBox->setPlainText (
78 QString::fromStdString (
m_method->get_description() ) );
85 setWindowTitle (
"New Method" );
86 setObjectName (
"NEW" );
87 ui->AddButton->setEnabled (
true );
92 ui->MethodName->setEnabled (
false);
93 ui->DescriptionTextBox->setEnabled (
false);
94 ui->AddButton->setEnabled (
false);
95 ui->ImplementationsView->setEnabled (
false);
103 bool changed =
false;
104 std::string method_name =
ui->MethodName->text().toStdString();
105 std::string method_description =
ui->DescriptionTextBox->toPlainText().toStdString();
107 if ( method_name !=
m_method->get_name() )
113 if ( method_description !=
m_method->get_description() )
117 method_description );
130 std::string method_name =
ui->MethodName->text().toStdString();
131 if (method_name.empty()) {
134 std::string method_description =
ui->DescriptionTextBox->toPlainText().toStdString();
136 method_description );
149 QStringList MethodHeaders {
"Language",
"Prototype" };
157 ui->ImplementationsView->horizontalHeader()->setSectionResizeMode ( QHeaderView::ResizeToContents );
162 bool WidgetFound =
false;
164 for ( QWidget * Editor : QApplication::allWidgets() )
169 if ( Widget !=
nullptr )
171 if ( ( Widget->objectName() ).compare ( Name ) == 0 )
174 Widget->setVisible (
true );
175 Widget->activateWindow();
203 QMessageBox::question (
204 0, tr (
"SchemaEditor" ),
205 tr (
"You must set the method name before you can set an implementation" ),
220 if ( !Row.isEmpty() ) {
221 QString name = QString::fromStdString(
static KernelWrapper & GetInstance()
void PushSetDescriptionMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string description)
void PushSetNameMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string name)
Method commands.
bool IsFileWritable(const std::string &FileName) const
void PushAddMethodCommand(dunedaq::oks::OksClass *Class, std::string name, std::string description)
void AddNewMethodImplementation()
void BuildModelImplementationSlot()
void ClassUpdated(QString ClassName)
CustomMethodImplementationModel * ImplementationModel
dunedaq::oks::OksClass * m_class
dunedaq::oks::OksMethod * m_method
void OpenMethodImplementationEditor(QModelIndex Index)
bool ShouldOpenMethodImplementationEditor(QString Name)
SchemaMethodEditor(dunedaq::oks::OksClass *ClassInfo, dunedaq::oks::OksMethod *Method, QWidget *parent=nullptr)
std::unique_ptr< dbse::Ui::SchemaMethodEditor > ui