ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/mainwindow.h
Revision: 1052
Committed: Sat Sep 17 13:32:34 2016 UTC (9 years ago) by s10k
Content type: text/x-chdr
Original Path: Vago/trunk/Vago/mainwindow.h
File size: 8584 byte(s)
Log Message:
Fixes for MacOS and minor bugfix

File Contents

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