-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
202 lines (125 loc) · 4.47 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#pragma once
#include <QMainWindow>
#include <QGraphicsScene>
#include <QStandardItemModel>
#include "mapcontroller.h"
#include "resourceExtractor/ResourceConverter.h"
class ObjectBrowser;
class ObjectBrowserProxyModel;
VCMI_LIB_NAMESPACE_BEGIN
class CMap;
class CampaignState;
class CGObjectInstance;
VCMI_LIB_NAMESPACE_END
namespace Ui
{
class MainWindow;
const QString teamName = "vcmi";
const QString appName = "mapeditor";
}
class MainWindow : public QMainWindow
{
Q_OBJECT
const QString mainWindowSizeSetting = "MainWindow/Size";
const QString mainWindowPositionSetting = "MainWindow/Position";
const QString lastDirectorySetting = "MainWindow/Directory";
const QString recentlyOpenedFilesSetting = "MainWindow/RecentlyOpenedFiles";
#ifdef ENABLE_QT_TRANSLATIONS
QTranslator translator;
#endif
std::unique_ptr<CMap> openMapInternal(const QString &);
std::shared_ptr<CampaignState> openCampaignInternal(const QString &);
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
void initializeMap(bool isNew);
void saveMap();
bool openMap(const QString &);
//MapView * mapView();
void loadObjectsTree();
void setStatusMessage(const QString & status);
int getMapLevel() const {return mapLevel;}
MapController controller;
void loadTranslation();
private slots:
void on_actionOpen_triggered();
void on_actionOpenRecent_triggered();
void on_menuOpenRecent_aboutToShow();
void on_actionSave_as_triggered();
void on_actionNew_triggered();
void on_actionLevel_triggered();
void on_actionSave_triggered();
void on_actionErase_triggered();
void on_actionUndo_triggered();
void on_actionRedo_triggered();
void on_actionPass_triggered(bool checked);
void on_actionGrid_triggered(bool checked);
void terrainButtonClicked(TerrainId terrain);
void roadOrRiverButtonClicked(ui8 type, bool isRoad);
void currentCoordinatesChanged(int x, int y);
void on_terrainFilterCombo_currentIndexChanged(int index);
void on_filter_textChanged(const QString &arg1);
void on_actionFill_triggered();
void on_inspectorWidget_itemChanged(QTableWidgetItem *item);
void on_actionMapSettings_triggered();
void on_actionPlayers_settings_triggered();
void on_actionValidate_triggered();
void on_actionUpdate_appearance_triggered();
void on_actionRecreate_obstacles_triggered();
void switchDefaultPlayer(const PlayerColor &);
void on_actionCut_triggered();
void on_actionCopy_triggered();
void on_actionPaste_triggered();
void on_actionExport_triggered();
void on_actionTranslations_triggered();
void on_actionh3m_converter_triggered();
void on_actionh3c_converter_triggered();
void on_actionLock_triggered();
void on_actionUnlock_triggered();
void on_actionZoom_in_triggered();
void on_actionZoom_out_triggered();
void on_actionZoom_reset_triggered();
void on_toolLine_toggled(bool checked);
void on_toolBrush2_toggled(bool checked);
void on_toolBrush_toggled(bool checked);
void on_toolBrush4_toggled(bool checked);
void on_toolLasso_toggled(bool checked);
void on_toolArea_toggled(bool checked);
void on_toolFill_toggled(bool checked);
void on_toolSelect_toggled(bool checked);
public slots:
void treeViewSelected(const QModelIndex &selected, const QModelIndex &deselected);
void loadInspector(CGObjectInstance * obj, bool switchTab);
void mapChanged();
void enableUndo(bool enable);
void enableRedo(bool enable);
void onSelectionMade(int level, bool anythingSelected);
void onPlayersChanged();
void displayStatus(const QString& message, int timeout = 2000);
private:
void preparePreview(const QModelIndex & index);
void addGroupIntoCatalog(const QString & groupName, bool staticOnly);
void addGroupIntoCatalog(const QString & groupName, bool useCustomName, bool staticOnly, int ID);
QAction * getActionPlayer(const PlayerColor &);
void changeBrushState(int idx);
void setTitle();
void closeEvent(QCloseEvent *event) override;
bool getAnswerAboutUnsavedChanges();
void loadUserSettings();
void saveUserSettings();
void parseCommandLine(ExtractionOptions & extractionOptions);
void updateRecentMenu(const QString & filenameSelect);
private:
Ui::MainWindow * ui;
ObjectBrowserProxyModel * objectBrowser = nullptr;
QGraphicsScene * scenePreview;
QString filename;
QString lastSavingDir;
bool unsaved = false;
QStandardItemModel objectsModel;
int mapLevel = 0;
QRectF initialScale;
std::set<int> catalog;
// command line options
QString mapFilePath; // FilePath to the H3 or VCMI map to open
};