34class MainWindow :
public QMainWindow {
38 explicit MainWindow(QWidget* parent =
nullptr);
39 ~MainWindow()
override =
default;
42 void saveRequested(
const QString& filePath,
const QString& contents);
43 void openRequested(
const QString& filePath);
44 void compileRequested(
const QString& contents);
49 void stepThreadRequested(nsbaci::types::ThreadID threadId);
50 void runContinueRequested();
51 void pauseRequested();
52 void resetRequested();
54 void inputProvided(
const QString& input);
57 void setEditorContents(
const QString& contents);
58 void setStatusMessage(
const QString& message);
59 void setCurrentFile(
const QString& fileName,
bool modified =
false);
62 void onSaveSucceeded();
63 void onSaveFailed(std::vector<nsbaci::UIError> errors);
64 void onLoadSucceeded(
const QString& contents);
65 void onLoadFailed(std::vector<nsbaci::UIError> errors);
66 void onCompileSucceeded();
67 void onCompileFailed(std::vector<nsbaci::UIError> errors);
70 void onRunStarted(
const QString& programName);
71 void onRuntimeStateChanged(
bool running,
bool halted);
72 void onThreadsUpdated(
const std::vector<nsbaci::ui::ThreadInfo>& threads);
73 void onVariablesUpdated(
74 const std::vector<nsbaci::ui::VariableInfo>& variables);
75 void onOutputReceived(
const QString& output);
76 void onInputRequested(
const QString& prompt);
97 void onToggleSidebar();
98 void onToggleFullscreen();
101 void onPreferences();
108 void onTextChanged();
111 void onStopRuntime();
115 QStackedWidget* centralStack =
nullptr;
118 QWidget* editorView =
nullptr;
121 QFrame* fileInfoBar =
nullptr;
122 QLabel* fileNameLabel =
nullptr;
123 QLabel* fileModifiedIndicator =
nullptr;
124 QLabel* compileStatusIndicator =
nullptr;
130 QFrame* sideBar =
nullptr;
131 QToolButton* compileButton =
nullptr;
132 QToolButton* runButton =
nullptr;
138 QAction* actionNew =
nullptr;
139 QAction* actionSave =
nullptr;
140 QAction* actionSaveAs =
nullptr;
141 QAction* actionOpen =
nullptr;
142 QAction* actionExit =
nullptr;
145 QAction* actionUndo =
nullptr;
146 QAction* actionRedo =
nullptr;
147 QAction* actionCut =
nullptr;
148 QAction* actionCopy =
nullptr;
149 QAction* actionPaste =
nullptr;
150 QAction* actionSelectAll =
nullptr;
153 QAction* actionToggleSidebar =
nullptr;
154 QAction* actionFullscreen =
nullptr;
157 QAction* actionPreferences =
nullptr;
160 QAction* actionCompile =
nullptr;
161 QAction* actionRun =
nullptr;
164 QAction* actionUserGuide =
nullptr;
165 QAction* actionAbout =
nullptr;
168 QString currentFileName;
169 QString currentFilePath;
170 bool isModified =
false;
171 bool hasName =
false;
179 void createCentralWidget();
180 void createEditorView();
181 void createRuntimeView();
182 void createMenuBar();
183 void createStatusBar();
184 void setupShortcuts();
185 void applyStyleSheet();
187 QString darkStyleSheet()
const;
188 QString lightStyleSheet()
const;
190 void switchToEditor();
191 void switchToRuntime();