SyntaxTutor
Educational app designed to help compiler students understand LL(1) and SLR(1) parsing algorithms.
 
Loading...
Searching...
No Matches
tutorialmanager.h
Go to the documentation of this file.
1#ifndef TUTORIALMANAGER_H
2#define TUTORIALMANAGER_H
3
4#include <QEvent>
5#include <QFrame>
6#include <QObject>
7#include <QPushButton>
8#include <QString>
9#include <QTextBrowser>
10#include <QVector>
11#include <QWidget>
12
20{
21 QWidget *target;
22 QString htmlText;
23};
24
34class TutorialManager : public QObject
35{
36 Q_OBJECT
37public:
42 TutorialManager(QWidget *rootWindow);
43
49 void addStep(QWidget *target, const QString &htmlText);
50
54 void start();
55
60 void setRootWindow(QWidget *newRoot);
61
65 void clearSteps();
66
70 void hideOverlay();
71
75 void finishLL1();
76
80 void finishSLR1();
81
82protected:
86 bool eventFilter(QObject *obj, QEvent *ev) override;
87
88signals:
93 void stepStarted(int index);
94
99
104
109
110public slots:
114 void nextStep();
115
116private:
120 void showOverlay();
121
125 void repositionOverlay();
126
127 QWidget *m_root;
128 QVector<TutorialStep> m_steps;
129 int m_index = -1;
130
131 QWidget *m_overlay = nullptr;
132 QFrame *m_highlight = nullptr;
133 QTextBrowser *m_textBox = nullptr;
134 QPushButton *m_nextBtn = nullptr;
135};
136
137#endif // TUTORIALMANAGER_H
void slr1Finished()
Emitted when the SLR(1) tutorial ends.
void start()
Starts the tutorial from the beginning.
Definition tutorialmanager.cpp:69
void setRootWindow(QWidget *newRoot)
Sets the root window (used for repositioning the overlay).
Definition tutorialmanager.cpp:32
void addStep(QWidget *target, const QString &htmlText)
Adds a new step to the tutorial sequence.
Definition tutorialmanager.cpp:65
void nextStep()
Advances to the next tutorial step.
Definition tutorialmanager.cpp:74
void clearSteps()
Clears all steps in the tutorial.
Definition tutorialmanager.cpp:25
void hideOverlay()
Hides the tutorial overlay immediately.
Definition tutorialmanager.cpp:165
void stepStarted(int index)
Emitted when a new tutorial step starts.
void ll1Finished()
Emitted when the LL(1) tutorial ends.
void tutorialFinished()
Emitted when the full tutorial is finished.
void finishLL1()
Ends the LL(1) tutorial sequence and emits its corresponding signal.
Definition tutorialmanager.cpp:9
bool eventFilter(QObject *obj, QEvent *ev) override
Intercepts UI events to handle overlay behavior.
Definition tutorialmanager.cpp:17
TutorialManager(QWidget *rootWindow)
Constructs a TutorialManager for a given window.
Definition tutorialmanager.cpp:4
void finishSLR1()
Ends the SLR(1) tutorial sequence and emits its corresponding signal.
Definition tutorialmanager.cpp:13
Represents a single step in the tutorial sequence.
Definition tutorialmanager.h:20
QWidget * target
Widget to highlight during the tutorial step.
Definition tutorialmanager.h:21
QString htmlText
HTML text to show as instruction or explanation.
Definition tutorialmanager.h:22