-
Notifications
You must be signed in to change notification settings - Fork 0
/
Console.h
45 lines (39 loc) · 1.01 KB
/
Console.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef CONSOLE_H
#define CONSOLE_H
#include <QObject>
#include <QTextEdit>
#include <QWidget>
#include "program.h"
/*The interface between the user and the interpreter.*/
class Console : public QTextEdit
{
Q_OBJECT
public:
explicit Console(QWidget *parent = nullptr);
QString userText;
signals:
void newLineWritten(QString newline);
public slots:
void write(QString msg);
private:
void handle_input();
void showHelp();
void list();
void quit() __attribute__((noreturn));
void run();
/*The input flag for program statement*/
bool waitInput;
/*The input flag for immediate command*/
bool waitQuickInput;
int currentLineNumber;
/*Used for transfer value into the program*/
int *inputProgram;
/*To store the name of quick input variable*/
QString quickInputVariable;
/*To get the output stream from program*/
QString *programOutput;
Program program;
protected:
virtual void keyPressEvent(QKeyEvent *event) override;
};
#endif // CONSOLE_H