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