-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
142 lines (112 loc) · 3.23 KB
/
mainwindow.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
Copyright (C) 2015 Linuxfor
Contact: linuxfor@163.com
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QDragEnterEvent>
#include <QUrl>
#include "codeeditor.h"
#include "highlighter.h"
#include "calculator.h"
#include "udef.h"
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
class QPlainTextEdit;
class QLabel;
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void closeEvent(QCloseEvent * event);
void dragEnterEvent(QDragEnterEvent *event);//event which is sent to widget when a drag and drop actin enters it
void dropEvent(QDropEvent *event); //event which is sent when a drag and drop action is completed
private slots:
void newFile();
void open();
bool save();
bool saveAs();
void openRecentFile();
// void close(); //the same as newFile()
void build();
void run();
// void option();
void calc();
// void tetrix();
// void musicPlayer();
// void ascii();
// void guide();
void about();
// void aboutQt();
void documentWasModified();
void timerHandle();
private:
void setupEditor();
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void createTimer();
void readSettings();
void writeSettings();
void updateRecentFileActions();
bool maybeSave();
void loadFile(const QString &fileName);
bool saveFile(const QString &fileName);
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
QString getFileName(const QString &fullFileName);
QString getFilePath(const QString &fullFileName);
QString getFileSuffix(const QString &fullFileName);
QString getFileCompleteBaseName(const QString &fullFileName);
void preprocessor();
private:
QTimer *timer; //Timer
QLabel *url; //statusbar for display some url, such as hao123.com ans so on
// QPlainTextEdit *textEdit;
CodeEditor *editor; //CodeEditor
Highlighter *highlighter; //Highlighter
Calculator *calculator; //Calcalator
// TetrixWindow *window; //Tetrix game
// VideoPlayer *player; //video player
QString curFile;
QString tmpFile;
QMenu *fileMenu;
QMenu *recentFileMenu;
QMenu *editMenu;
QMenu *buildMenu;
QMenu *toolsMenu;
QMenu *helpMenu;
QToolBar *fileToolBar;
QToolBar *editToolBar;
QToolBar *buildToolBar;
// QToolBar *toolsToolBar;
QAction *newAct;
QAction *openAct;
QAction *saveAct;
QAction *saveAsAct;
QAction *exitAct;
enum { MaxRecentFiles = 8 };
QAction *recentFileActs[MaxRecentFiles];
QAction *cutAct;
QAction *copyAct;
QAction *pasteAct;
QAction *selectAllAct;
QAction *buildAct;
QAction *runAct;
QAction *asciiAct; //ascii table
QAction *calcAct; //calculator
QAction *tetrixAct; //tetrix game
QAction *musicPlayerAct; //music player
QAction *optionAct; //option
QAction *aboutQtAct;
QAction *aboutAct;
QAction *guideAct;
};
#endif // MAINWINDOW_H