MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / openMqttScriptEditor

Method openMqttScriptEditor

app/src/DataModel/ProjectEditor.cpp:1191–1211  ·  view source on GitHub ↗

* @brief Opens the native MQTT publisher script editor dialog. */

Source from the content-addressed store, hash-verified

1189 * @brief Opens the native MQTT publisher script editor dialog.
1190 */
1191void DataModel::ProjectEditor::openMqttScriptEditor()
1192{
1193#ifdef BUILD_COMMERCIAL
1194 auto& pub = MQTT::Publisher::instance();
1195
1196 if (!m_mqttScriptEditor) {
1197 m_mqttScriptEditor = new MQTT::PublisherScriptEditor(nullptr);
1198
1199 connect(m_mqttScriptEditor,
1200 &MQTT::PublisherScriptEditor::scriptApplied,
1201 this,
1202 [](const QString& code, int language) {
1203 auto& publisher = MQTT::Publisher::instance();
1204 publisher.setScriptLanguage(language);
1205 publisher.setScriptCode(code);
1206 });
1207 }
1208
1209 m_mqttScriptEditor->displayDialog(pub.scriptCode(), pub.scriptLanguage());
1210#endif
1211}
1212
1213/**
1214 * @brief Returns the form model for the currently selected action.

Callers

nothing calls this directly

Calls 5

setScriptLanguageMethod · 0.80
setScriptCodeMethod · 0.80
scriptCodeMethod · 0.80
scriptLanguageMethod · 0.80
displayDialogMethod · 0.45

Tested by

no test coverage detected