Sat, 01 Feb 2020 15:49:28 +0200
translations
24 | 1 | /* |
2 | * LDForge: LDraw parts authoring CAD | |
3 | * Copyright (C) 2013 - 2020 Teemu Piippo | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
0 | 19 | #pragma once |
20 | #include <QMainWindow> | |
6 | 21 | #include <QTranslator> |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
22 | #include <QSettings> |
16 | 23 | #include <QKeySequence> |
5 | 24 | #include "documentmanager.h" |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
25 | #include "libraries.h" |
16 | 26 | #include "uiutilities.h" |
0 | 27 | |
28 | class MainWindow : public QMainWindow | |
29 | { | |
3 | 30 | Q_OBJECT |
0 | 31 | public: |
3 | 32 | MainWindow(QWidget *parent = nullptr); |
33 | ~MainWindow(); | |
5 | 34 | private slots: |
35 | void newModel(); | |
36 | void openModel(); | |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
37 | void openModelFromPath(const QString& path); |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
38 | void runSettingsEditor(); |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
39 | void handleDocumentSplitterChange(); |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
40 | void updateRecentlyOpenedDocumentsMenu(); |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
41 | void openRecentFile(); |
36
bbb901b97404
added render style storage
Teemu Piippo <teemu@hecknology.net>
parents:
35
diff
changeset
|
42 | void setRenderStyle(gl::RenderStyle renderStyle); |
6 | 43 | protected: |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
44 | void changeEvent(QEvent* event) override; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
45 | void closeEvent(QCloseEvent* event) override; |
0 | 46 | private: |
3 | 47 | std::unique_ptr<class Ui_MainWindow> ui; |
5 | 48 | DocumentManager documents; |
49 | QMap<Model*, QWidget*> modelWidgets; | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
50 | QString currentLanguage = "en"; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
51 | QTranslator translator; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
52 | QSettings settings; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
53 | LibraryManager libraries; |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
54 | QByteArray documentSplitterState; |
16 | 55 | uiutilities::KeySequenceMap defaultKeyboardShortcuts; |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
56 | static constexpr int maxRecentlyOpenedFiles = 10; |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
57 | QStringList recentlyOpenedFiles; |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
26
diff
changeset
|
58 | ldraw::ColorTable colorTable; |
36
bbb901b97404
added render style storage
Teemu Piippo <teemu@hecknology.net>
parents:
35
diff
changeset
|
59 | gl::RenderStyle renderStyle; |
5 | 60 | void updateTitle(); |
36
bbb901b97404
added render style storage
Teemu Piippo <teemu@hecknology.net>
parents:
35
diff
changeset
|
61 | void updateRenderStyles(); |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
62 | void saveSettings(); |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
63 | void restoreSettings(); |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
64 | void changeLanguage(QString localeCode); |
9
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
65 | void addRecentlyOpenedFile(const QString& path); |
8b9780700b5e
added saving of splitter state and recent files
Teemu Piippo <teemu@hecknology.net>
parents:
8
diff
changeset
|
66 | void openModelForEditing(const QString& modelName); |
6 | 67 | static QString pathToTranslation(const QString& localeCode); |
26 | 68 | void loadColors(); |
0 | 69 | }; |