32class MainWindow :
public QMainWindow {
36 explicit MainWindow(QWidget* parent =
nullptr);
37 ~MainWindow()
override =
default;
40 void saveRequested(
const QString& filePath,
const QString& contents);
41 void openRequested(
const QString& filePath);
42 void compileRequested(
const QString& contents);
47 void stepThreadRequested(nsbaci::types::ThreadID threadId);
48 void runContinueRequested();
49 void pauseRequested();
50 void resetRequested();
52 void inputProvided(
const QString& input);
55 void setEditorContents(
const QString& contents);
56 void setStatusMessage(
const QString& message);
57 void setCurrentFile(
const QString& fileName,
bool modified =
false);
60 void onSaveSucceeded();
61 void onSaveFailed(std::vector<nsbaci::UIError> errors);
62 void onLoadSucceeded(
const QString& contents);
63 void onLoadFailed(std::vector<nsbaci::UIError> errors);
64 void onCompileSucceeded();
65 void onCompileFailed(std::vector<nsbaci::UIError> errors);
68 void onRunStarted(
const QString& programName);
69 void onRuntimeStateChanged(
bool running,
bool halted);
70 void onThreadsUpdated(
const std::vector<nsbaci::ui::ThreadInfo>& threads);
71 void onVariablesUpdated(
72 const std::vector<nsbaci::ui::VariableInfo>& variables);
73 void onOutputReceived(
const QString& output);
74 void onInputRequested(
const QString& prompt);
95 void onToggleSidebar();
96 void onToggleFullscreen();
102 void onTextChanged();
105 void onStopRuntime();
109 QStackedWidget* centralStack =
nullptr;
112 QWidget* editorView =
nullptr;
115 QFrame* fileInfoBar =
nullptr;
116 QLabel* fileNameLabel =
nullptr;
117 QLabel* fileModifiedIndicator =
nullptr;
118 QLabel* compileStatusIndicator =
nullptr;
124 QFrame* sideBar =
nullptr;
125 QToolButton* compileButton =
nullptr;
126 QToolButton* runButton =
nullptr;
132 QAction* actionNew =
nullptr;
133 QAction* actionSave =
nullptr;
134 QAction* actionSaveAs =
nullptr;
135 QAction* actionOpen =
nullptr;
136 QAction* actionExit =
nullptr;
139 QAction* actionUndo =
nullptr;
140 QAction* actionRedo =
nullptr;
141 QAction* actionCut =
nullptr;
142 QAction* actionCopy =
nullptr;
143 QAction* actionPaste =
nullptr;
144 QAction* actionSelectAll =
nullptr;
147 QAction* actionToggleSidebar =
nullptr;
148 QAction* actionFullscreen =
nullptr;
151 QAction* actionCompile =
nullptr;
152 QAction* actionRun =
nullptr;
155 QAction* actionAbout =
nullptr;
158 QString currentFileName;
159 QString currentFilePath;
160 bool isModified =
false;
161 bool hasName =
false;
166 void createCentralWidget();
167 void createEditorView();
168 void createRuntimeView();
169 void createMenuBar();
170 void createStatusBar();
171 void setupShortcuts();
172 void applyStyleSheet();
174 void switchToEditor();
175 void switchToRuntime();