nsbaci 1.0
Loading...
Searching...
No Matches
runtimeView.h
Go to the documentation of this file.
1
12
13#ifndef NSBACI_RUNTIMEVIEW_H
14#define NSBACI_RUNTIMEVIEW_H
15
16#include <QHBoxLayout>
17#include <QHeaderView>
18#include <QLabel>
19#include <QLineEdit>
20#include <QListWidget>
21#include <QPlainTextEdit>
22#include <QPushButton>
23#include <QSplitter>
24#include <QTableWidget>
25#include <QToolButton>
26#include <QTreeWidget>
27#include <QVBoxLayout>
28#include <QWidget>
29
30#include "runtimeTypes.h"
31
32namespace nsbaci::ui {
33
38struct ThreadInfo {
39 nsbaci::types::ThreadID id;
41 size_t pc;
42 QString currentInstruction;
43};
44
50 QString name;
51 QString type;
52 QString value;
53 size_t address;
54};
55
66class RuntimeView : public QWidget {
67 Q_OBJECT
68
69 public:
70 explicit RuntimeView(QWidget* parent = nullptr);
71 ~RuntimeView() override = default;
72
73 signals:
74 // Execution control signals
75 void stepRequested();
76 void stepThreadRequested(nsbaci::types::ThreadID threadId);
77 void runRequested();
78 void pauseRequested();
79 void resetRequested();
80 void stopRequested();
81
82 // I/O signals
83 void inputProvided(const QString& input);
84
85 public slots:
86 // Update display
87 void updateThreads(const std::vector<ThreadInfo>& threads);
88 void updateVariables(const std::vector<VariableInfo>& variables);
89 void updateCurrentInstruction(const QString& instruction);
90 void updateExecutionState(bool running, bool halted);
91
92 // I/O
93 void appendOutput(const QString& text);
94 void requestInput(const QString& prompt);
95 void clearConsole();
96
97 // State
98 void onProgramLoaded(const QString& programName);
99 void onProgramHalted();
100
101 private slots:
102 void onStepClicked();
103 void onRunClicked();
104 void onPauseClicked();
105 void onResetClicked();
106 void onStopClicked();
107 void onInputSubmitted();
108 void onThreadSelected(QTreeWidgetItem* item, int column);
109
110 private:
111 void createUI();
112 void createToolbar();
113 void createThreadPanel();
114 void createVariablePanel();
115 void createConsolePanel();
116 void applyStyleSheet();
117
118 // Toolbar
119 QWidget* toolbar = nullptr;
120 QToolButton* stepButton = nullptr;
121 QToolButton* runButton = nullptr;
122 QToolButton* pauseButton = nullptr;
123 QToolButton* resetButton = nullptr;
124 QToolButton* stopButton = nullptr;
125 QLabel* statusLabel = nullptr;
126
127 // Thread panel
128 QTreeWidget* threadTree = nullptr;
129
130 // Variable panel
131 QTableWidget* variableTable = nullptr;
132
133 // Console panel
134 QPlainTextEdit* consoleOutput = nullptr;
135 QLineEdit* consoleInput = nullptr;
136 QPushButton* inputSubmitButton = nullptr;
137 QLabel* inputPromptLabel = nullptr;
138
139 // State
140 bool isRunning = false;
141 bool isHalted = false;
142 bool waitingForInput = false;
143 nsbaci::types::ThreadID selectedThread = 0;
144};
145
146} // namespace nsbaci::ui
147
148#endif // NSBACI_RUNTIMEVIEW_H
ThreadState
Definition runtimeTypes.h:26
User interface namespace for nsbaci.
Definition drawingWidget.cpp:18
Type definitions for runtime-related operations.
Information about a thread for display.
Definition runtimeView.h:38
Information about a variable for display.
Definition runtimeView.h:49