Sun, 19 Jan 2020 02:54:48 +0200
commit work on GL rendering
0 | 1 | #pragma once |
2 | #include <QMainWindow> | |
6 | 3 | #include <QTranslator> |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
4 | #include <QSettings> |
16 | 5 | #include <QKeySequence> |
5 | 6 | #include "documentmanager.h" |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
7 | #include "libraries.h" |
16 | 8 | #include "uiutilities.h" |
0 | 9 | |
10 | class MainWindow : public QMainWindow | |
11 | { | |
3 | 12 | Q_OBJECT |
0 | 13 | public: |
3 | 14 | MainWindow(QWidget *parent = nullptr); |
15 | ~MainWindow(); | |
5 | 16 | private slots: |
17 | void newModel(); | |
18 | void openModel(); | |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
19 | void openModelFromPath(const QString& path); |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
20 | void runSettingsEditor(); |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
21 | void handleDocumentSplitterChange(); |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
22 | void updateRecentlyOpenedDocumentsMenu(); |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
23 | void openRecentFile(); |
6 | 24 | protected: |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
25 | void changeEvent(QEvent* event) override; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
26 | void closeEvent(QCloseEvent* event) override; |
0 | 27 | private: |
3 | 28 | std::unique_ptr<class Ui_MainWindow> ui; |
5 | 29 | DocumentManager documents; |
30 | QMap<Model*, QWidget*> modelWidgets; | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
31 | QString currentLanguage = "en"; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
32 | QTranslator translator; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
33 | QSettings settings; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
34 | LibraryManager libraries; |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
35 | QByteArray documentSplitterState; |
16 | 36 | uiutilities::KeySequenceMap defaultKeyboardShortcuts; |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
37 | static constexpr int maxRecentlyOpenedFiles = 10; |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
38 | QStringList recentlyOpenedFiles; |
5 | 39 | void updateTitle(); |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
40 | void saveSettings(); |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
41 | void restoreSettings(); |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
42 | void changeLanguage(QString localeCode); |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
43 | void addRecentlyOpenedFile(const QString& path); |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
44 | void openModelForEditing(const QString& modelName); |
6 | 45 | static QString pathToTranslation(const QString& localeCode); |
0 | 46 | }; |