* @brief Loads the transmit function from the currently selected output widget. */
| 312 | * @brief Loads the transmit function from the currently selected output widget. |
| 313 | */ |
| 314 | void DataModel::OutputCodeEditor::readCode() |
| 315 | { |
| 316 | if (m_readingCode) |
| 317 | return; |
| 318 | |
| 319 | m_readingCode = true; |
| 320 | |
| 321 | auto& editor = DataModel::ProjectEditor::instance(); |
| 322 | const auto& sel = editor.selectedOutputWidget(); |
| 323 | |
| 324 | QString code = sel.transmitFunction; |
| 325 | if (code.isEmpty()) |
| 326 | code = defaultTemplate(); |
| 327 | |
| 328 | m_widget.setPlainText(code); |
| 329 | m_widget.document()->clearUndoRedoStacks(); |
| 330 | m_widget.document()->setModified(false); |
| 331 | |
| 332 | m_readingCode = false; |
| 333 | Q_EMIT modifiedChanged(); |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * @brief Shows a dialog to pick and load a built-in template. |
nothing calls this directly
no test coverage detected