Disable code editing while processor is running
MODIFY
src/edittab.cpp
src/edittab.cpp
@@ -56,10 +56,31 @@ EditTab::EditTab(QToolBar* toolbar, QWidget* parent) : RipesTab(toolbar, parent)
}
});
+ // During processor running, it should not be possible to modify the program
+ connect(ProcessorHandler::get(), &ProcessorHandler::runStarted, [=] { runStateChanged(true); });
+ connect(ProcessorHandler::get(), &ProcessorHandler::runFinished, [=] { runStateChanged(false); });
+
enableEditor();
sourceTypeChanged();
}
+void EditTab::runStateChanged(bool running) {
+ // Disable all widgets related to the code editor if we are currently running
+ for (int i = 0; i < m_ui->editorLayout->count(); i++) {
+ if (auto* w = m_ui->editorLayout->itemAt(i)->widget()) {
+ w->setEnabled(!running);
+ }
+ }
+
+ // Ensure that the build action is always disabled while running
+ if (running) {
+ m_buildAction->setEnabled(false);
+ } else {
+ // call sourceTypeChanged() to update the state of the build action, reflecting the current source type
+ sourceTypeChanged();
+ }
+}
+
void EditTab::loadExternalFile(const LoadFileParams& params) {
if (params.type == SourceType::C) {
// Try to enable C input and verify that source type was changed successfully. This allows us to trigger the

MODIFY
src/edittab.h
src/edittab.h
@@ -66,6 +66,7 @@ public slots:
private slots:
void sourceCodeChanged();
void on_disassembledViewButton_toggled();
+ void runStateChanged(bool running);
private:
void assemble();

MODIFY
src/edittab.ui
src/edittab.ui
<bool>false</bool>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="editorLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>

Disable code editing while processor is running