2 #include <score/command/Dispatchers/CommandDispatcher.hpp>
3 #include <score/command/PropertyCommand.hpp>
4 #include <score/document/DocumentContext.hpp>
5 #include <score/tools/Bind.hpp>
9 #include <score_lib_process_export.h>
23 QSize sizeHint()
const override {
return {800, 300}; }
24 std::vector<QString> text()
const noexcept;
26 void addTab(
const QString& name,
const QString& text,
const std::string_view language);
27 void setText(
int idx,
const QString& str);
28 void setError(
const QString& str);
32 virtual void on_accepted() = 0;
38 QTextEdit* textedit{};
40 std::vector<EditorTab> m_editors;
41 QPlainTextEdit* m_error{};
44 template <
typename Process_T,
typename Property_T>
48 using param_type =
typename Property_T::param_type;
54 const auto& prop = (m_process.*Property_T::get)();
55 for(
auto& [name, addr, lang] : param_type::specification)
57 addTab(name, prop.*addr, lang);
60 con(m_process, Property_T::notify,
this, [
this]() {
61 const auto& prop = (m_process.*Property_T::get)();
63 for(
auto& [name, addr, lang] : param_type::specification)
65 setText(i, prop.*addr);
70 con(m_process, &Process_T::errorMessage,
this,
71 &ProcessMultiScriptEditDialog::setError);
73 &QWidget::deleteLater);
76 void on_accepted()
override
79 if(this->text() != (m_process.*Property_T::get)())
83 if(m_process.validate(this->text()))
87 m_process, this->text(), m_context});
93 const Process_T& m_process;
94 void closeEvent(QCloseEvent* event)
override
96 const_cast<QWidget*&
>(m_process.externalUI) =
nullptr;
97 m_process.externalUIVisible(
false);
The CommandDispatcher class.
Definition: CommandDispatcher.hpp:13
void identified_object_destroying(IdentifiedObjectAbstract *o)
To be called by subclasses.
Definition: MultiScriptEditor.hpp:19
Definition: MultiScriptEditor.hpp:46
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: MultiScriptEditor.hpp:37
Definition: DocumentContext.hpp:18
Definition: PropertyCommand.hpp:112