-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.h
85 lines (75 loc) · 2.37 KB
/
application.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
#ifndef APPLICATION_H
#define APPLICATION_H
#include <QApplication>
#include <QOpenGLFunctions_3_3_Core>
#include <QSettings>
//#include <QMenu>
//#include <QAction>
#include <QMenuBar>
#include <QHash>
#include <QSurfaceFormat>
#include <QOpenGLContext>
#include <QOffscreenSurface>
#include <QOpenGLShader>
#include <QOpenGLShaderProgram>
#include <QOpenGLWidget>
#include <QKeySequence>
#include <QActionGroup>
#include "session.h"
#include "settingsdialog.h"
#include "actionowner.h"
class Window;
class Editor;
class Document;
class Application : public QApplication, public QOpenGLFunctions_3_3_Core, public ActionOwner
{
Q_OBJECT
public:
static const QString fileDialogFilterString;
QOffscreenSurface offScreen;
QOpenGLContext context;
QOpenGLWidget &shareWidget;
SettingsDialog settingsWindow;
GLuint brushVertexBuffer;
QHash<QString, QOpenGLShader *> shaders;
QHash<QString, QOpenGLShaderProgram *> programs;
Session session;
QSettings settings;
QHash<QString, QImage> iconSheets;
QHash<QString, QIcon> iconCache;
explicit Application(int &argc, char **argv);
virtual ~Application();
bool addShader(const QString &name, const QOpenGLShader::ShaderType type, const QString &src);
bool addProgram(const QString &name, const QStringList &shaderList);
GLuint shader(const QString &name) { return shaders[name]->shaderId(); }
GLuint program(const QString &name) { return programs[name]->programId(); }
QIcon icon(const QString &sheet, const QString &name, const int scale = 1);
public slots:
void sessionNew();
void sessionOpen();
bool sessionSave();
bool sessionSaveAs();
bool sessionClose();
bool windowNew();
bool windowClone();
bool windowClose();
void documentNew();
void documentOpen();
bool documentSave();
bool documentSaveAs();
bool documentClose();
void about();
void aboutQt();
void license();
void connectActiveWindow(Window *const window);
private:
Window *oldWindow;
QList<QMetaObject::Connection> activeWindowConnections;
static const GLfloat brushVertices[][2];
static const QHash<QString, ActionDefinition> actionDefinitions;
static const QHash<QString, MenuDefinition> menuDefinitions;
static const int iconSheetWidth;
void initializeGL();
};
#define APP (static_cast<Application *>(qApp))
#endif // APPLICATION_H