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