1 |
#ifndef MAINWINDOW_H |
2 |
#define MAINWINDOW_H |
3 |
|
4 |
#include "utilvago.h" |
5 |
#include "preferences.h" |
6 |
#include "manualcommands.h" |
7 |
#include "about.h" |
8 |
#include "packagewizard.h" |
9 |
#include "soundwizard.h" |
10 |
#include "bgimagewizard.h" |
11 |
#include "wmwizard.h" |
12 |
#include "converter.h" |
13 |
#include "xmltoolsinterface.h" |
14 |
#include "wizardfactory.h" |
15 |
|
16 |
#include <QMainWindow> |
17 |
#include <QMessageBox> |
18 |
#include <QProcess> |
19 |
#include <QColor> |
20 |
#include <QPalette> |
21 |
#include <QFileDialog> |
22 |
#include <QUrl> |
23 |
#include <QDesktopServices> |
24 |
#include <QErrorMessage> |
25 |
#include <QTextCodec> |
26 |
#include <QProgressBar> |
27 |
#include <QComboBox> |
28 |
#include <QtNetwork/QNetworkAccessManager> |
29 |
#include <QtNetwork/QNetworkRequest> |
30 |
#include <QtNetwork/QNetworkReply> |
31 |
#include <QCloseEvent> |
32 |
#include <QScriptEngine> |
33 |
#include <QScriptValueIterator> |
34 |
#include <droptablewidget.h> |
35 |
#include <pugixml.hpp> |
36 |
#ifdef Q_OS_WIN |
37 |
#include <QWinTaskbarProgress> |
38 |
#include <QWinTaskbarButton> |
39 |
#endif |
40 |
|
41 |
namespace Ui { |
42 |
class MainWindow; |
43 |
} |
44 |
|
45 |
class MainWindow : public QMainWindow |
46 |
{ |
47 |
Q_OBJECT |
48 |
|
49 |
public: |
50 |
explicit MainWindow(QWidget *parent = 0); |
51 |
|
52 |
~MainWindow(); |
53 |
|
54 |
protected: |
55 |
void closeEvent(QCloseEvent *event); |
56 |
|
57 |
private slots: |
58 |
void applicationWasLoaded(); |
59 |
|
60 |
void on_actionExit_triggered(); |
61 |
|
62 |
void on_actionAbout_triggered(); |
63 |
|
64 |
void on_tbOni_clicked(); |
65 |
|
66 |
void on_tbAE_clicked(); |
67 |
|
68 |
void on_tbOpenFolder_clicked(); |
69 |
|
70 |
void on_cbEnvMap_toggled(bool checked); |
71 |
|
72 |
void on_cbTexture_toggled(bool checked); |
73 |
|
74 |
void on_actionCheck_For_Updates_triggered(); |
75 |
|
76 |
void on_pbAddSourceXML_clicked(); |
77 |
|
78 |
void on_pbConvert_clicked(); |
79 |
|
80 |
void TsetupProgressBar(int max); |
81 |
|
82 |
void TupdateProgressBar(); |
83 |
|
84 |
void TresultConversion(QString result, int numErrors); |
85 |
|
86 |
void TconversionAborted(); |
87 |
|
88 |
void on_actionWindows_triggered(); |
89 |
|
90 |
void on_actionMac_Windows_demo_triggered(); |
91 |
|
92 |
void on_pbClearSourcesXML_clicked(); |
93 |
|
94 |
void on_pbRemoveSourceXML_clicked(); |
95 |
|
96 |
void on_pbAddSourceTextures_clicked(); |
97 |
|
98 |
void on_pbRemoveSourceTextures_clicked(); |
99 |
|
100 |
void on_pbClearSourcesTextures_clicked(); |
101 |
|
102 |
void on_cbFromTextures_currentIndexChanged(const QString &arg1); |
103 |
|
104 |
void on_cbFromObjects_currentIndexChanged(const QString &arg1); |
105 |
|
106 |
void on_cbFromLevels_currentIndexChanged(const QString &arg1); |
107 |
|
108 |
void on_cbFromMisc_currentIndexChanged(const QString &arg1); |
109 |
|
110 |
void on_pbAddSourceObjects_clicked(); |
111 |
|
112 |
void on_pbAddSourceLevels_clicked(); |
113 |
|
114 |
void on_pbAddSourceMisc_clicked(); |
115 |
|
116 |
void on_pbRemoveSourceObjects_clicked(); |
117 |
|
118 |
void on_pbRemoveSourceLevels_clicked(); |
119 |
|
120 |
void on_pbRemoveSourceMisc_clicked(); |
121 |
|
122 |
void on_pbClearSourcesObjects_clicked(); |
123 |
|
124 |
void on_pbClearSourcesLevels_clicked(); |
125 |
|
126 |
void on_pbClearSourcesMisc_clicked(); |
127 |
|
128 |
void on_actionPreferences_triggered(); |
129 |
|
130 |
void on_cbToLevels_currentIndexChanged(const QString &arg1); |
131 |
|
132 |
void on_cbDatLevels_toggled(bool checked); |
133 |
|
134 |
void on_actionCheck_OniSplit_version_triggered(); |
135 |
|
136 |
void addFilesSource(DropTableWidget *myTable, QStringList files); //for drag 'n drop |
137 |
|
138 |
void dtContextMenu(DropTableWidget* myTable, QContextMenuEvent *event); //Context menu options for table widgets |
139 |
|
140 |
void checkVagoLastVersion(QNetworkReply *result); //check vago last version |
141 |
|
142 |
void on_cbBnvLevels_toggled(bool checked); |
143 |
|
144 |
void on_cbAdditionalSourcesLevels_toggled(bool checked); |
145 |
|
146 |
void on_tbCommand_clicked(); |
147 |
|
148 |
void on_actionWorkspace_triggered(); |
149 |
|
150 |
void on_actionOther_triggered(); |
151 |
|
152 |
void on_actionView_log_triggered(); |
153 |
|
154 |
void on_actionAE_Package_Creator_triggered(); |
155 |
|
156 |
void on_cbFromCharacters_currentIndexChanged(const QString &arg1); |
157 |
|
158 |
void on_pbAddSourceCharacters_clicked(); |
159 |
|
160 |
void on_pbRemoveSourceCharacters_clicked(); |
161 |
|
162 |
void on_pbClearSourcesCharacters_clicked(); |
163 |
|
164 |
void on_actionSound_Wizard_triggered(); |
165 |
|
166 |
void on_actionCheck_xmlTools_version_triggered(); |
167 |
|
168 |
void on_actionOpen_AE_folder_triggered(); |
169 |
|
170 |
void on_cbWithTRBS_ONCC_toggled(bool checked); |
171 |
|
172 |
void on_cbWithAnimation_toggled(bool checked); |
173 |
|
174 |
void on_cbFromXML_currentIndexChanged(const QString &arg1); |
175 |
|
176 |
void on_cbSpecificFilesLevels_toggled(bool checked); |
177 |
|
178 |
void on_tbAbortConversion_clicked(); |
179 |
|
180 |
void on_tabWidget_currentChanged(int); |
181 |
|
182 |
void on_actionSave_Project_triggered(); |
183 |
|
184 |
void on_actionSave_triggered(); |
185 |
|
186 |
void on_actionLoad_Project_triggered(); |
187 |
|
188 |
void on_actionProject1_triggered(); |
189 |
|
190 |
void on_actionProject2_triggered(); |
191 |
|
192 |
void on_actionProject3_triggered(); |
193 |
|
194 |
void on_actionProject4_triggered(); |
195 |
|
196 |
void on_actionProject5_triggered(); |
197 |
|
198 |
void on_actionBackground_Image_Wizard_triggered(); |
199 |
|
200 |
void on_actionNew_Project_triggered(); |
201 |
|
202 |
void on_tbXmlToolsInterface_clicked(); |
203 |
|
204 |
void on_actionWindow_Messages_Wizard_triggered(); |
205 |
|
206 |
private: |
207 |
Ui::MainWindow *ui; |
208 |
Logger *myLogger; |
209 |
QString workspaceLocation; //Workspace location |
210 |
QString workspaceWizardsLocation; //Workspace wizard location |
211 |
QString outputFolder; //Output folder |
212 |
QString AeLocation; //Workspace location |
213 |
QString lastProjectFilePath; |
214 |
int startedWindowWidth; |
215 |
int startedWindowHeight; |
216 |
#ifdef Q_OS_MAC |
217 |
bool useYesAsDefaultWhenRemovingItems; |
218 |
#endif |
219 |
QLabel *itemsLoaded; |
220 |
QProgressBar *myBar; //Progress Bar |
221 |
QHash<QString, QString> commandMap; //Map the commands for fast retreive |
222 |
QStringList listToProccess; //items to proccess |
223 |
Converter *myConverter = nullptr; |
224 |
QSettings *vagoSettings; |
225 |
static const QString VagoSettingsName; |
226 |
static constexpr int recentProjectsMaxSize=5; |
227 |
QList<QString> recentProjectsList; |
228 |
#ifdef Q_OS_WIN |
229 |
// These are deleted automatically by the window (since button is attached to it) |
230 |
QWinTaskbarProgress *win7TaskBarProgress; |
231 |
QWinTaskbarButton *win7TaskBarButton; |
232 |
#endif |
233 |
bool unsavedChangesExist = false; |
234 |
// Indicates that the application is fully loaded which includes painting the main window |
235 |
bool applicationIsFullyLoaded = false; |
236 |
// This variable indicates that we have a project being loaded. It should only be set by MainWindow thread. |
237 |
// It allow us to ignore certain gui slots like when checking checkbox that ask the user for input |
238 |
bool projectIsLoading = false; |
239 |
|
240 |
// anonymous enum |
241 |
enum {XMLTabIndex, TexturesTabIndex, CharactersTabIndex, ObjectsTabIndex, LevelsTabIndex, MiscTabIndex}; |
242 |
|
243 |
void connectSlots(); |
244 |
void showErrStatusMessage(QString message); |
245 |
void showSuccessStatusMessage(QString message); |
246 |
void mapCommands(); |
247 |
void addRowTable(DropTableWidget *myTable, QString file, QString fromTo, QString command, bool isToDisabled=false); |
248 |
void clearTableContents(DropTableWidget *myTable); |
249 |
void clearTableNoPrompt(DropTableWidget *myTable); |
250 |
void removeTableContents(DropTableWidget *myTable); |
251 |
void updateComboBox(const QString &arg1, QComboBox *comboBox); |
252 |
void startConversion(); |
253 |
void updateItemsLoaded(DropTableWidget *currentTable); |
254 |
void changeToCurrentSettings(QList<int> rows, DropTableWidget* myTable); //change some rows to the current settings |
255 |
void changeItemsOutput(DropTableWidget* myTable, QList<int> rows, QString newOutput); |
256 |
void setConverterButtonsSize(); |
257 |
void saveProjectState(const QString &filePath); |
258 |
void saveProjectWidget(pugi::xml_node &rootNode, DropTableWidget* table); |
259 |
void loadProjectState(const QString &filePath); |
260 |
void setVagoWindowTitle(); |
261 |
void loadProjectWidget(pugi::xml_document &doc, DropTableWidget* table); |
262 |
void saveRecentProjects(); |
263 |
void loadRecentProjects(); |
264 |
void addNewRecentProject(const QString &filePath); |
265 |
void reloadRecentProjectsMenu(); |
266 |
void showEvent(QShowEvent *e); |
267 |
void rowsWereChangedInDropTableWidget(); |
268 |
QString getFileOutputFolder(QString fromTo, QString myOutputFolder=""); |
269 |
QString fileParsingXML(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file); |
270 |
QString fileParsingTextures(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file); |
271 |
QString fileParsingObjects(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file); |
272 |
QString fileParsingCharacters(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file); |
273 |
QString fileParsingLevels(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file); |
274 |
QString fileParsingMisc(QString myOutputFolder, QString from, QString to , QString file); |
275 |
QString getCommand(DropTableWidget* myTable, QString myOutputFolder, QString from, QString to , QString file); |
276 |
QString getTypeConversion(DropTableWidget *myTable); //get the current type for a table |
277 |
QString getOSIndependentAppPath(); |
278 |
QString getTabNameByTableWidget(DropTableWidget* table); |
279 |
QString getCurrentTabName(); |
280 |
QRadioButton* getTextureRBCheckedTypeTexture(); |
281 |
QRadioButton *getTextureRBTypeTextureByName(const QString &texType); |
282 |
DropTableWidget *getCurrentTableWidget(); |
283 |
DropTableWidget* getTableWidgetByTabName(const QString &tabName); |
284 |
QList<DropTableWidget*> getAllTableWidgets(); |
285 |
QMessageBox::StandardButton askToSaveCurrentProject(); |
286 |
|
287 |
signals: |
288 |
void terminateCurrProcess(); |
289 |
void signalAppIsLoaded(); |
290 |
}; |
291 |
|
292 |
#endif // MAINWINDOW_H |