2021-04-06 23:10:57 +08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2021-04-24 15:57:45 +08:00
|
|
|
#include "common.h"
|
2021-04-06 23:10:57 +08:00
|
|
|
|
2021-04-20 22:24:33 +08:00
|
|
|
|
2021-04-06 23:10:57 +08:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
namespace Ui { class MainWindow; }
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2021-04-07 21:13:15 +08:00
|
|
|
class EditorList;
|
2021-04-08 10:29:21 +08:00
|
|
|
class QLabel;
|
2021-04-18 11:41:41 +08:00
|
|
|
class QComboBox;
|
2021-04-20 22:24:33 +08:00
|
|
|
class CompilerManager;
|
2021-04-07 21:13:15 +08:00
|
|
|
|
2021-04-06 23:10:57 +08:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow();
|
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
void updateStatusBarForEncoding();
|
2021-04-11 13:55:31 +08:00
|
|
|
void updateStatusBarForEditingInfo(int line,int col,int lines,int charCount);
|
2021-04-08 10:29:21 +08:00
|
|
|
|
2021-04-11 21:33:08 +08:00
|
|
|
protected:
|
|
|
|
void openFiles(const QStringList& files);
|
|
|
|
void openFile(const QString& filename);
|
2021-04-07 21:13:15 +08:00
|
|
|
private slots:
|
|
|
|
void on_actionNew_triggered();
|
|
|
|
|
2021-04-07 22:44:08 +08:00
|
|
|
void on_EditorTabsLeft_tabCloseRequested(int index);
|
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
void on_actionOpen_triggered();
|
|
|
|
|
2021-04-11 12:39:22 +08:00
|
|
|
void on_actionSave_triggered();
|
|
|
|
|
|
|
|
void on_actionSaveAs_triggered();
|
|
|
|
|
2021-04-16 22:04:48 +08:00
|
|
|
void on_actionOptions_triggered();
|
|
|
|
|
2021-04-18 11:41:41 +08:00
|
|
|
// qt will auto bind slots with the prefix "on_"
|
|
|
|
void onCompilerSetChanged(int index);
|
|
|
|
|
2021-04-20 22:24:33 +08:00
|
|
|
void on_actionCompile_triggered();
|
|
|
|
|
2021-04-21 18:58:35 +08:00
|
|
|
void on_actionRun_triggered();
|
|
|
|
|
2021-04-21 23:06:55 +08:00
|
|
|
void on_actionUndo_triggered();
|
|
|
|
|
|
|
|
void on_actionRedo_triggered();
|
|
|
|
|
|
|
|
void on_actionCut_triggered();
|
|
|
|
|
|
|
|
void on_actionSelectAll_triggered();
|
|
|
|
|
|
|
|
void on_actionCopy_triggered();
|
|
|
|
|
|
|
|
void on_actionPaste_triggered();
|
|
|
|
|
|
|
|
void on_actionIndent_triggered();
|
|
|
|
|
|
|
|
void on_actionUnIndent_triggered();
|
|
|
|
|
2021-04-24 15:57:45 +08:00
|
|
|
void on_actionToggleComment_triggered();
|
|
|
|
|
|
|
|
void on_actionUnfoldAll_triggered();
|
|
|
|
|
|
|
|
void on_actionFoldAll_triggered();
|
|
|
|
|
2021-04-20 22:24:33 +08:00
|
|
|
public slots:
|
|
|
|
void onCompileLog(const QString& msg);
|
2021-04-24 15:57:45 +08:00
|
|
|
void onCompileIssue(PCompileIssue issue);
|
2021-04-20 22:24:33 +08:00
|
|
|
|
2021-04-07 21:13:15 +08:00
|
|
|
private:
|
|
|
|
void setupActions();
|
|
|
|
|
2021-04-18 11:41:41 +08:00
|
|
|
void updateCompilerSet();
|
|
|
|
|
2021-04-06 23:10:57 +08:00
|
|
|
private:
|
|
|
|
Ui::MainWindow *ui;
|
2021-04-07 21:13:15 +08:00
|
|
|
EditorList* mEditorList;
|
2021-04-08 10:29:21 +08:00
|
|
|
QLabel* mFileInfoStatus;
|
|
|
|
QLabel* mFileEncodingStatus;
|
2021-04-18 11:41:41 +08:00
|
|
|
QComboBox* mCompilerSet;
|
2021-04-20 22:24:33 +08:00
|
|
|
CompilerManager* mCompilerManager;
|
|
|
|
|
2021-04-09 17:48:25 +08:00
|
|
|
// QWidget interface
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2021-04-06 23:10:57 +08:00
|
|
|
};
|
2021-04-08 10:29:21 +08:00
|
|
|
|
|
|
|
extern MainWindow* pMainWindow;
|
2021-04-06 23:10:57 +08:00
|
|
|
#endif // MAINWINDOW_H
|