--- Vago/trunk/Vago/mainwindow.h 2014/04/26 12:40:47 999 +++ Vago/trunk/Vago/mainwindow.h 2016/10/30 14:42:39 1058 @@ -1,17 +1,18 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include "util.h" +#include "utilvago.h" #include "preferences.h" #include "manualcommands.h" #include "about.h" #include "packagewizard.h" #include "soundwizard.h" +#include "bgimagewizard.h" #include "converter.h" #include "droptablewidget.h" +#include "xmltoolsinterface.h" #include -#include #include #include #include @@ -29,7 +30,12 @@ #include #include #include -//#include +#ifdef Q_OS_WIN +#include +#include +#endif + +#include "libs/pugixml/pugixml.hpp" namespace Ui { class MainWindow; @@ -38,7 +44,7 @@ class MainWindow; class MainWindow : public QMainWindow { Q_OBJECT - + public: explicit MainWindow(QWidget *parent = 0); @@ -46,8 +52,10 @@ public: protected: void closeEvent(QCloseEvent *event); - + private slots: + void applicationWasLoaded(); + void on_actionExit_triggered(); void on_actionAbout_triggered(); @@ -66,7 +74,7 @@ private slots: void on_pbAddSourceXML_clicked(); - void on_pbConvertXML_clicked(); + void on_pbConvert_clicked(); void TsetupProgressBar(int max); @@ -104,14 +112,6 @@ private slots: void on_pbAddSourceMisc_clicked(); - void on_pbConvertTextures_clicked(); - - void on_pbConvertObjects_clicked(); - - void on_pbConvertLevels_clicked(); - - void on_pbConvertMisc_clicked(); - void on_pbRemoveSourceObjects_clicked(); void on_pbRemoveSourceLevels_clicked(); @@ -154,8 +154,6 @@ private slots: void on_cbFromCharacters_currentIndexChanged(const QString &arg1); - void on_pbConvertCharacters_clicked(); - void on_pbAddSourceCharacters_clicked(); void on_pbRemoveSourceCharacters_clicked(); @@ -178,16 +176,38 @@ private slots: void on_tbAbortConversion_clicked(); - void on_tabWidget_currentChanged(int index); + void on_tabWidget_currentChanged(int); + + void on_actionSave_Project_triggered(); + + void on_actionSave_triggered(); + + void on_actionLoad_Project_triggered(); + + void on_actionProject1_triggered(); + + void on_actionProject2_triggered(); + + void on_actionProject3_triggered(); + + void on_actionProject4_triggered(); + + void on_actionProject5_triggered(); + + void on_actionBackground_Image_Wizard_triggered(); + + void on_actionNew_Project_triggered(); + + void on_tbXmlToolsInterface_clicked(); private: Ui::MainWindow *ui; Logger *myLogger; - QString AppDir; QString workspaceLocation; //Workspace location QString workspaceWizardsLocation; //Workspace wizard location QString outputFolder; //Output folder QString AeLocation; //Workspace location + QString lastProjectFilePath; int startedWindowWidth; int startedWindowHeight; #ifdef Q_OS_MAC @@ -196,24 +216,52 @@ private: QLabel *itemsLoaded; QProgressBar *myBar; //Progress Bar QHash commandMap; //Map the commands for fast retreive - QStringList *listToProccess; //items to proccess - Converter *myConverter; + QStringList listToProccess; //items to proccess + Converter *myConverter = nullptr; QSettings *vagoSettings; static const QString VagoSettingsName; + static constexpr int recentProjectsMaxSize=5; + QList recentProjectsList; +#ifdef Q_OS_WIN + // These are deleted automatically by the window (since button is attached to it) + QWinTaskbarProgress *win7TaskBarProgress; + QWinTaskbarButton *win7TaskBarButton; +#endif + bool unsavedChangesExist = false; + // Indicates that the application is fully loaded which includes painting the main window + bool applicationIsFullyLoaded = false; + // This variable indicates that we have a project being loaded. It should only be set by MainWindow thread. + // It allow us to ignore certain gui slots like when checking checkbox that ask the user for input + bool projectIsLoading = false; + + // anonymous enum + enum {XMLTabIndex, TexturesTabIndex, CharactersTabIndex, ObjectsTabIndex, LevelsTabIndex, MiscTabIndex}; void connectSlots(); void showErrStatusMessage(QString message); void showSuccessStatusMessage(QString message); void mapCommands(); - void addRowTable(DropTableWidget *myTable,QString file, QString fromTo, QString command); + void addRowTable(DropTableWidget *myTable, QString file, QString fromTo, QString command, bool isToDisabled=false); void clearTableContents(DropTableWidget *myTable); + void clearTableNoPrompt(DropTableWidget *myTable); void removeTableContents(DropTableWidget *myTable); void updateComboBox(const QString &arg1, QComboBox *comboBox); - void startConversion(DropTableWidget *myTable); + void startConversion(); void updateItemsLoaded(DropTableWidget *currentTable); void changeToCurrentSettings(QList rows, DropTableWidget* myTable); //change some rows to the current settings void changeItemsOutput(DropTableWidget* myTable, QList rows, QString newOutput); void setConverterButtonsSize(); + void saveProjectState(const QString &filePath); + void saveProjectWidget(pugi::xml_node &rootNode, DropTableWidget* table); + void loadProjectState(const QString &filePath); + void setVagoWindowTitle(); + void loadProjectWidget(pugi::xml_document &doc, DropTableWidget* table); + void saveRecentProjects(); + void loadRecentProjects(); + void addNewRecentProject(const QString &filePath); + void reloadRecentProjectsMenu(); + void showEvent(QShowEvent *e); + void rowsWereChangedInDropTableWidget(); QString getFileOutputFolder(QString fromTo, QString myOutputFolder=""); QString fileParsingXML(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file); QString fileParsingTextures(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file); @@ -224,9 +272,18 @@ private: QString getCommand(DropTableWidget* myTable, QString myOutputFolder, QString from, QString to , QString file); QString getTypeConversion(DropTableWidget *myTable); //get the current type for a table QString getOSIndependentAppPath(); + QString getTabNameByTableWidget(DropTableWidget* table); + QString getCurrentTabName(); + QRadioButton* getTextureRBCheckedTypeTexture(); + QRadioButton *getTextureRBTypeTextureByName(const QString &texType); + DropTableWidget *getCurrentTableWidget(); + DropTableWidget* getTableWidgetByTabName(const QString &tabName); + QList getAllTableWidgets(); + QMessageBox::StandardButton askToSaveCurrentProject(); signals: void terminateCurrProcess(); + void signalAppIsLoaded(); }; #endif // MAINWINDOW_H