ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/mainwindow.cpp
(Generate patch)

Comparing Vago/trunk/Vago/mainwindow.cpp (file contents):
Revision 897 by s10k, Wed Jan 8 11:32:55 2014 UTC vs.
Revision 1054 by s10k, Wed Oct 12 21:35:13 2016 UTC

# Line 9 | Line 9 | MainWindow::MainWindow(QWidget *parent)
9   {
10      ui->setupUi(this);
11  
12 <    this->AppDir=getOSIndependentAppPath();
12 >    this->myLogger = new Logger(UtilVago::getAppPath(), GlobalVars::AppLogName); //start logger
13  
14 <    this->myLogger = new Logger(this->AppDir); //start logger
15 <
16 <    this->myLogger->writeString("Detected AppDir: "+this->AppDir);
14 >    this->myLogger->writeString("Detected AppDir: "+UtilVago::getAppPath());
15      this->myLogger->writeString("True app dir: "+QDir::currentPath());
16  
17 <    this->setWindowTitle("Vago v"+GlobalVars::AppVersion);
17 >    setVagoWindowTitle();
18  
19 <    if(!QFile::exists(this->AppDir+"/"+GlobalVars::OniSplitString)){
20 <        Util::showErrorPopUp("OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit.");
19 >    if(!QFile::exists(UtilVago::getOniSplitExecutableAbsolutePath())){
20 >        UtilVago::showAndLogErrorPopUp(this->myLogger, "OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit.");
21          exit(1);
22      }
23  
24 <    if(!QFile::exists(this->AppDir+"/"+GlobalVars::XmlToolsString)){
25 <        Util::showErrorPopUp("xmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit.");
24 >    if(!QFile::exists(UtilVago::getXmlToolsExecutableAbsolutePath())){
25 >        UtilVago::showAndLogErrorPopUp(this->myLogger, "XmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit.");
26          exit(1);
27      }
28  
29 <    this->vagoSettings = new QSettings(this->AppDir + "/" + this->VagoSettingsName, QSettings::IniFormat);
29 >    this->vagoSettings = new QSettings(UtilVago::getAppPath() + "/" + this->VagoSettingsName, QSettings::IniFormat);
30  
31      //First Execution? Old configuration? Settings missed?
32      bool iniChanged=false;
# Line 37 | Line 35 | MainWindow::MainWindow(QWidget *parent)
35          iniChanged=true;
36      }
37      if(!this->vagoSettings->contains("Workspace")){
38 <        this->vagoSettings->setValue("Workspace", this->AppDir+"/VagoWorkspace");
38 >        this->vagoSettings->setValue("Workspace", UtilVago::getAppPath()+"/VagoWorkspace");
39          iniChanged=true;
40      }
41      if(!this->vagoSettings->contains("AeFolder")){
# Line 46 | Line 44 | MainWindow::MainWindow(QWidget *parent)
44          QString aefolder=Util::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder..."));
45  
46          if(aefolder.isEmpty()){
47 <            Util::showErrorPopUp("AE folder is mandatory. Application will now exit.");
47 >            UtilVago::showAndLogErrorPopUp(this->myLogger, "AE folder is mandatory. Application will now exit.");
48              exit(1);
49          }
50  
# Line 73 | Line 71 | MainWindow::MainWindow(QWidget *parent)
71          this->vagoSettings->setValue("SeparateInWorkspace",true);
72          iniChanged=true;
73      }
74 <    if(!this->vagoSettings->contains("ConfirmExit")){
75 <        this->vagoSettings->setValue("ConfirmExit", false);
74 >    if(!this->vagoSettings->contains("AskSaveProject")){
75 >        this->vagoSettings->setValue("AskSaveProject", true);
76 >        iniChanged=true;
77 >    }
78 >    if(!this->vagoSettings->contains("AskToOpenLastProject")){
79 >        this->vagoSettings->setValue("AskToOpenLastProject", false);
80          iniChanged=true;
81      }
82 +    if(!this->vagoSettings->contains("LastProjectPath")){
83 +        this->vagoSettings->setValue("LastProjectPath", this->vagoSettings->value("Workspace"));
84 +        iniChanged=true;
85 +    }
86 +    for(int i=0; i<this->recentProjectsMaxSize; i++){
87 +        if(!this->vagoSettings->contains("RecentProject" + QString::number(i+1))){
88 +            this->vagoSettings->setValue("RecentProject" + QString::number(i+1), "");
89 +            iniChanged=true;
90 +        }
91 +    }
92 + #ifdef Q_OS_MAC
93 +    if(!this->vagoSettings->contains("useYesAsDefaultWhenRemovingItems")){
94 +        this->vagoSettings->setValue("useYesAsDefaultWhenRemovingItems", false);
95 +        iniChanged=true;
96 +    }
97 + #endif
98  
99      if(iniChanged){
100          this->vagoSettings->sync();
# Line 89 | Line 107 | MainWindow::MainWindow(QWidget *parent)
107      this->outputFolder=this->workspaceLocation;
108      this->startedWindowWidth=this->vagoSettings->value("WindowWidth").toInt();
109      this->startedWindowHeight=this->vagoSettings->value("WindowHeight").toInt();
110 + #ifdef Q_OS_MAC
111 +    this->useYesAsDefaultWhenRemovingItems=this->vagoSettings->value("useYesAsDefaultWhenRemovingItems").toBool();
112 + #endif
113  
114      //Create our workspace if it doesn't exists yet
115      if(!QDir(this->workspaceLocation).exists()){
# Line 110 | Line 131 | MainWindow::MainWindow(QWidget *parent)
131      //Initialize list pointers
132      this->listToProccess = new QStringList;
133  
113    //Create a thread for do the conversion in background
114    this->myConverter = new Converter(this->AppDir,this->myLogger,this->listToProccess);
115
134      // User interface
135      ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button
136      ui->mainToolBar->addWidget(ui->emptySpacerLabel); //trick, we can't add directly a space so we add an empty
# Line 124 | Line 142 | MainWindow::MainWindow(QWidget *parent)
142  
143      ui->mainToolBar->setLayoutDirection(Qt::RightToLeft);
144  
145 <    setConverterButtonsSize();
145 >    ui->pbConvert->setMinimumHeight(ui->pbConvert->sizeHint().height()*1.5); // This is OS indepented. It maintain size ratio over the Windows and Mac.
146  
147 < #ifdef Q_WS_MAC
147 >
148 > #ifdef Q_OS_MAC
149      // setUnifiedTitleAndToolBarOnMac(true); // Qt suggests to use it on mac | http://www.slideshare.net/qtbynokia/how-to-make-your-qt-app-look-native // align on left doesn't work if active
150      ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows
151      // Set mac platform the first one in the menu, and also make it checkable by default
# Line 136 | Line 155 | MainWindow::MainWindow(QWidget *parent)
155      ui->actionMac_Windows_demo->setChecked(true);
156      // resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
157      //// because the components on mac use more space
139 #else
140    //resize(640,480); // windows stuff
158   #endif
159  
160      resize(this->startedWindowWidth,this->startedWindowHeight);
161  
162 <    connectSlots();
162 > #ifdef Q_OS_MAC
163 >    ui->pbConvert->setToolTip(ui->pbConvert->toolTip() + " (⌘ + Enter)");
164 > #else
165 >    ui->pbConvert->setToolTip(ui->pbConvert->toolTip() + " (Ctrl + Enter)");
166 > #endif
167  
168      //Commands Mapping
169      this->commandMap = QHash<QString, QString>();
# Line 150 | Line 171 | MainWindow::MainWindow(QWidget *parent)
171  
172      updateItemsLoaded(ui->twSourcesXML);
173  
174 <    this->myLogger->writeString("Application started.");
174 >    loadRecentProjects();
175   }
176  
177   MainWindow::~MainWindow()
# Line 159 | Line 180 | MainWindow::~MainWindow()
180      this->myLogger->writeString("Application Exited.");
181   }
182  
183 +
184 + void MainWindow::showEvent(QShowEvent *e)
185 + {
186 +    // If we don't have a converter yet, application wasn't started.
187 +    if(!this->applicationIsFullyLoaded)
188 +    {
189 +        // Apparently Qt doesn't contains a slot to when the application was fully load (mainwindow). So we do our own implementation instead.
190 +        connect(this, SIGNAL(signalAppIsLoaded()), this, SLOT(applicationWasLoaded()), Qt::ConnectionType::QueuedConnection);
191 +        emit signalAppIsLoaded();
192 +    }
193 +
194 +    e->accept();
195 + }
196 +
197 + // Called only when the MainWindow was fully loaded and painted on the screen. This slot is only called once.
198 + void MainWindow::applicationWasLoaded(){
199 + #ifdef Q_OS_WIN
200 +    // QProgressBar only works after the windows was shown
201 +    // http://stackoverflow.com/questions/24840941/qwintaskbarprogress-wont-show (Kervala answer)
202 +
203 +    this->win7TaskBarButton = new QWinTaskbarButton();
204 +
205 +    this->win7TaskBarButton->setWindow(this->windowHandle());
206 +
207 +    this->win7TaskBarProgress = this->win7TaskBarButton->progress();
208 +
209 +    //Create a thread for do the conversion in background
210 +    this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, this->listToProccess, this->win7TaskBarProgress);
211 + #else
212 +    this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, this->listToProccess);
213 + #endif
214 +
215 +    connectSlots();
216 +
217 +    this->myLogger->writeString("Application started.");
218 +
219 +    this->applicationIsFullyLoaded = true;
220 +
221 +    QString lastSavedProject = this->vagoSettings->value("RecentProject1").toString();
222 +
223 +    if(!lastSavedProject.isEmpty() && this->vagoSettings->value("AskToOpenLastProject").toBool()){
224 +        if(Util::showQuestionPopUp(this,"Do you want to load latest project?\n\nLatest project was '" + Util::cutNameWithoutBackSlash(lastSavedProject) + "'.")){
225 +            loadProjectState(lastSavedProject);
226 +        }
227 +    }
228 + }
229 +
230 +
231   void MainWindow::on_actionExit_triggered()
232   {
233      close();
# Line 179 | Line 248 | void MainWindow::on_actionAE_Package_Cre
248  
249   void MainWindow::on_actionSound_Wizard_triggered()
250   {
251 <    SoundWizard myWizard (this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
251 >    SoundWizard myWizard (UtilVago::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
252 >    myWizard.exec();
253 > }
254 >
255 > void MainWindow::on_actionBackground_Image_Wizard_triggered()
256 > {
257 >    BGImageWizard myWizard (UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, this->myLogger);
258      myWizard.exec();
259   }
260  
# Line 190 | Line 265 | void MainWindow::on_tbOni_clicked()
265      if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window?
266          arguments << "-noswitch";
267      }
268 < #ifdef Q_WS_WIN
268 > #ifdef Q_OS_WIN
269      else{
270          arguments << "-switch"; // only supported on windows. Was added by daodan dll.
271      }
# Line 275 | Line 350 | void MainWindow::checkVagoLastVersion(QN
350          }
351      }
352      else{
353 <        Util::showErrorPopUp("An error occurred checking last version:\n\n"+result->errorString());
353 >        UtilVago::showAndLogErrorPopUp(this->myLogger, "An error occurred checking last version:\n\n"+result->errorString());
354      }
355      result->deleteLater();
356   }
# Line 302 | Line 377 | void MainWindow::on_pbAddSourceCharacter
377  
378   void MainWindow::on_pbAddSourceLevels_clicked()
379   {
380 <    if(QString::compare(ui->cbFromXML->currentText(),"ONI FILES",Qt::CaseSensitive)==0 && QString::compare(ui->cbToXML->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster)
380 >    if(QString::compare(ui->cbFromLevels->currentText(),"ONI FILES",Qt::CaseSensitive)==0 && QString::compare(ui->cbToLevels->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster)
381          addFilesSource(ui->twSourcesLevels,Util::multipleDirDialog("Choose folders with ONIs..."));
382      }
383      else{
# Line 389 | Line 464 | void MainWindow::addFilesSource(DropTabl
464          addRowTable(myTable,lastFileName,fromTo,command);
465      }
466      updateItemsLoaded(myTable);
467 +    rowsWereChangedInDropTableWidget();
468   }
469  
470   QString MainWindow::fileParsingXML(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){
# Line 428 | Line 504 | QString MainWindow::fileParsingTextures(
504              command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbLarge->text());
505          }
506  
507 <        if(ui->rbBGR32->isChecked()){
432 <            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGR32->text());
433 <        }
434 <        else if(ui->rbBGRA32->isChecked()){
435 <            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA32->text());
436 <        }
437 <        else if(ui->rbBGR555->isChecked()){
438 <            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGR555->text());
439 <        }
440 <        else if(ui->rbBGRA5551->isChecked()){
441 <            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA5551->text());
442 <        }
443 <        else if(ui->rbBGRA444->isChecked()){
444 <            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA444->text());
445 <        }
446 <        else{ //dxt1 checked
447 <            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbDxt1->text());
448 <        }
507 >        command+=" "+this->commandMap.value(tabTitle+"->"+getTextureRBCheckedTypeTexture()->text());
508  
509          if(ui->cbEnvMap->isChecked()){
510              if(ui->leEnvMapTexture->text().isEmpty()){
# Line 530 | Line 589 | QString MainWindow::fileParsingLevels(QS
589  
590              command+=":"+ui->leSpecificFilesLevels->text();
591          }
592 <        command+=" "+myOutputFolder+" "+file;
592 >
593 >        if(from=="DAT" && to=="ONI FILES"){ // extract files to a subdir with the files name ex: level0_Final
594 >            command += " " + myOutputFolder.insert(myOutputFolder.size()-2,QString(Util::cutName(file)).replace(".dat","")) + " " + file;
595 >        }
596 >        else{
597 >            command+=" "+myOutputFolder+" "+file;
598 >        }
599  
600      }
601  
# Line 621 | Line 686 | QString MainWindow::fileParsingMisc(QStr
686      return this->commandMap.value("misc->"+from+"->"+to)+" "+myOutputFolder+" "+file;
687   }
688  
689 < void MainWindow::addRowTable(DropTableWidget *myTable, QString fileName, QString fromTo, QString command){
689 > void MainWindow::addRowTable(DropTableWidget *myTable, QString fileName, QString fromTo, QString command, bool isToDisabled){
690      //Get actual number rows
691      int twSize=myTable->rowCount();
692  
# Line 633 | Line 698 | void MainWindow::addRowTable(DropTableWi
698      QTableWidgetItem *newConversion = new QTableWidgetItem(fromTo);
699      QTableWidgetItem *newCommand = new QTableWidgetItem(command);
700  
701 +    if(isToDisabled){
702 +        myTable->setDisableStyleWidgetItem(newFile);
703 +        myTable->setDisableStyleWidgetItem(newConversion);
704 +        myTable->setDisableStyleWidgetItem(newCommand);
705 +    }
706 +
707      myTable->setItem(twSize,0,newFile);
708      myTable->setItem(twSize,1,newConversion);
709      myTable->setItem(twSize,2,newCommand);
# Line 640 | Line 711 | void MainWindow::addRowTable(DropTableWi
711      myTable->updateTableToolTips(twSize); //Update tool tips
712   }
713  
714 < void MainWindow::on_pbConvertXML_clicked()
714 > void MainWindow::on_pbConvert_clicked()
715   {
716 <    startConversion(ui->twSourcesXML);
716 >    startConversion();
717   }
718  
719 < void MainWindow::on_pbConvertTextures_clicked()
649 < {
650 <    startConversion(ui->twSourcesTextures);
651 < }
719 > void MainWindow::startConversion(){
720  
721 < void MainWindow::on_pbConvertObjects_clicked()
654 < {
655 <    startConversion(ui->twSourcesObjects);
656 < }
657 <
658 < void MainWindow::on_pbConvertCharacters_clicked()
659 < {
660 <    startConversion(ui->twSourcesCharacters);
661 < }
662 <
663 < void MainWindow::on_pbConvertLevels_clicked()
664 < {
665 <    startConversion(ui->twSourcesLevels);
666 < }
667 <
668 < void MainWindow::on_pbConvertMisc_clicked()
669 < {
670 <    startConversion(ui->twSourcesMisc);
671 < }
672 <
673 < void MainWindow::startConversion(DropTableWidget *myTable){
721 >    DropTableWidget* currTable = getCurrentTableWidget();
722  
723      bool ready=false;
724 <    for(int i=0; i<myTable->rowCount(); i++){ //There are items to process?
725 <        if(myTable->item(i,2)->background()!=myTable->disabledBackStyle){
724 >    for(int i=0; i<currTable->rowCount(); i++){ //There are items to process?
725 >        if(currTable->item(i,2)->background()!=currTable->disabledBackStyle){
726              ready=true;
727              break;
728          }
# Line 690 | Line 738 | void MainWindow::startConversion(DropTab
738          return;
739      }
740  
741 <    for(int i=0; i<myTable->rowCount(); i++){
741 >    for(int i=0; i<currTable->rowCount(); i++){
742          //Only process enabled items
743 <        if(myTable->item(i,2)->background()!=myTable->disabledBackStyle){
744 <            this->listToProccess->append(myTable->item(i,2)->text());
743 >        if(currTable->item(i,2)->background()!=currTable->disabledBackStyle){
744 >            this->listToProccess->append(currTable->item(i,2)->text());
745          }
746      }
747  
# Line 719 | Line 767 | void MainWindow::TresultConversion(QStri
767      if(numErrors!=0){
768          QString sNumErrors=QString::number(numErrors);
769          if(numErrors>1){
770 <            Util::showErrorLogPopUp(result+"\n This is the last of "+sNumErrors+" Errors.");
771 <            showErrStatusMessage("Something gone wrong. Check log file ("+sNumErrors+" Errors).");
770 >            UtilVago::showErrorPopUpLogButton(result+"\n This is the last of "+sNumErrors+" errors.");
771 >            showErrStatusMessage("Something gone wrong. Check log file ("+sNumErrors+" errors).");
772          }
773          else{
774 <            Util::showErrorLogPopUp(result);
774 >            UtilVago::showErrorPopUpLogButton(result);
775              showErrStatusMessage("Something gone wrong. Check log file.");
776          }
729
777      }
778      else{
779          showSuccessStatusMessage("Everything went well!");
# Line 873 | Line 920 | void MainWindow::on_cbFromXML_currentInd
920  
921   void MainWindow::on_cbFromTextures_currentIndexChanged(const QString &arg1)
922   {
876    //Options are only used for DAT/ONI -> Image
877    if(QString::compare(arg1,"DAT / ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
878        ui->gbTextures->setEnabled(false);
879    }
880    else{
881        ui->gbTextures->setEnabled(true);
882    }
883
923      updateComboBox(arg1, ui->cbToTextures);
924   }
925  
926   void MainWindow::on_cbFromObjects_currentIndexChanged(const QString &arg1)
927   {
889    ui->cbTexture->setEnabled(false);
890    ui->cbTexture->setChecked(false);
891    ui->cbWithAnimation->setEnabled(false);
892    ui->cbWithAnimation->setChecked(false);
893
894    if(QString::compare(arg1,"M3GM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
895        ui->cbWithAnimation->setEnabled(true);
896    }
897    else if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){
898        ui->cbTexture->setEnabled(true);
899    }
900
928      updateComboBox(arg1, ui->cbToObjects);
929   }
930  
931   void MainWindow::on_cbFromCharacters_currentIndexChanged(const QString &arg1)
932   {
906    ui->cbWithTRBS_ONCC->setEnabled(false);
907    ui->cbWithTRBS_ONCC->setChecked(false);
908    ui->cbCellShading->setEnabled(false);
909    ui->cbCellShading->setChecked(false);
910    ui->cbNormals->setEnabled(false);
911    ui->cbNormals->setChecked(false);
912
913    if(QString::compare(arg1,"TRAM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
914        ui->cbWithTRBS_ONCC->setEnabled(true);
915    }
916    else if(QString::compare(arg1,"TRBS DAE",Qt::CaseSensitive)==0){
917        ui->cbNormals->setEnabled(true);
918        ui->cbCellShading->setEnabled(true);
919    }
920
933      updateComboBox(arg1, ui->cbToCharacters);
934   }
935  
936   void MainWindow::on_cbFromLevels_currentIndexChanged(const QString &arg1)
937   {
926
927    ui->cbSpecificFilesLevels->setEnabled(false);
928    ui->cbSpecificFilesLevels->setChecked(false);
929    ui->cbDatLevels->setEnabled(false);
930    ui->cbDatLevels->setChecked(false);
931    ui->cbBnvLevels->setEnabled(false);
932    ui->cbBnvLevels->setChecked(false);
933    ui->cbAdditionalSourcesLevels->setEnabled(false);
934    ui->cbAdditionalSourcesLevels->setChecked(false);
935    ui->cbGridsLevels->setEnabled(false);
936    ui->cbGridsLevels->setChecked(false);
937
938    if(arg1=="DAT"){ //case sensitive is faster
939        ui->cbSpecificFilesLevels->setEnabled(true);
940    }
941    else if(arg1=="ONI FILES"){ //case sensitive is faster
942        ui->cbDatLevels->setEnabled(true);
943    }
944    else if(arg1=="DAE"){
945        ui->cbBnvLevels->setEnabled(true);
946        ui->cbAdditionalSourcesLevels->setEnabled(true);
947    }
948
938      updateComboBox(arg1, ui->cbToLevels);
939   }
940  
# Line 955 | Line 944 | void MainWindow::on_cbFromMisc_currentIn
944   }
945  
946   void MainWindow::updateComboBox(const QString &arg1, QComboBox *comboBox){
947 <    QString identifier=ui->tabWidget->tabText(ui->tabWidget->currentIndex()).toLower(); // get current tab title text (lower case)
947 >
948 >    QString identifier;
949 >
950 >    if(comboBox == ui->cbToXML){
951 >        identifier = ui->tabWidget->tabText(XMLTabIndex);
952 >    }
953 >    else if(comboBox == ui->cbToTextures){
954 >        identifier = ui->tabWidget->tabText(TexturesTabIndex);
955 >
956 >        //Options are only used for DAT/ONI -> Image
957 >        if(QString::compare(arg1,"DAT / ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
958 >            ui->gbTextures->setEnabled(false);
959 >        }
960 >        else{
961 >            ui->gbTextures->setEnabled(true);
962 >        }
963 >    }
964 >    else if(comboBox == ui->cbToCharacters){
965 >        identifier = ui->tabWidget->tabText(CharactersTabIndex);
966 >
967 >        ui->cbWithTRBS_ONCC->setEnabled(false);
968 >        ui->cbWithTRBS_ONCC->setChecked(false);
969 >        ui->cbCellShading->setEnabled(false);
970 >        ui->cbCellShading->setChecked(false);
971 >        ui->cbNormals->setEnabled(false);
972 >        ui->cbNormals->setChecked(false);
973 >
974 >        if(QString::compare(arg1,"TRAM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
975 >            ui->cbWithTRBS_ONCC->setEnabled(true);
976 >        }
977 >        else if(QString::compare(arg1,"TRBS DAE",Qt::CaseSensitive)==0){
978 >            ui->cbNormals->setEnabled(true);
979 >            ui->cbCellShading->setEnabled(true);
980 >        }
981 >
982 >    }
983 >    else if(comboBox == ui->cbToObjects){
984 >        identifier = ui->tabWidget->tabText(ObjectsTabIndex);
985 >
986 >        ui->cbTexture->setEnabled(false);
987 >        ui->cbTexture->setChecked(false);
988 >        ui->cbWithAnimation->setEnabled(false);
989 >        ui->cbWithAnimation->setChecked(false);
990 >
991 >        if(QString::compare(arg1,"M3GM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
992 >            ui->cbWithAnimation->setEnabled(true);
993 >        }
994 >        else if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){
995 >            ui->cbTexture->setEnabled(true);
996 >        }
997 >    }
998 >    else if(comboBox == ui->cbToLevels){
999 >        identifier = ui->tabWidget->tabText(LevelsTabIndex);
1000 >
1001 >        ui->cbSpecificFilesLevels->setEnabled(false);
1002 >        ui->cbSpecificFilesLevels->setChecked(false);
1003 >        ui->cbDatLevels->setEnabled(false);
1004 >        ui->cbDatLevels->setChecked(false);
1005 >        ui->cbBnvLevels->setEnabled(false);
1006 >        ui->cbBnvLevels->setChecked(false);
1007 >        ui->cbAdditionalSourcesLevels->setEnabled(false);
1008 >        ui->cbAdditionalSourcesLevels->setChecked(false);
1009 >        ui->cbGridsLevels->setEnabled(false);
1010 >        ui->cbGridsLevels->setChecked(false);
1011 >
1012 >        if(arg1=="DAT"){ //case sensitive is faster
1013 >            ui->cbSpecificFilesLevels->setEnabled(true);
1014 >        }
1015 >        else if(arg1=="ONI FILES"){ //case sensitive is faster
1016 >            ui->cbDatLevels->setEnabled(true);
1017 >        }
1018 >        else if(arg1=="DAE"){
1019 >            ui->cbBnvLevels->setEnabled(true);
1020 >            ui->cbAdditionalSourcesLevels->setEnabled(true);
1021 >        }
1022 >    }
1023 >    else{ // Misc
1024 >        identifier = ui->tabWidget->tabText(MiscTabIndex);
1025 >    }
1026 >
1027 >    identifier = identifier.toLower(); // get current tab title text (lower case)
1028  
1029      comboBox->clear();
1030  
# Line 1046 | Line 1115 | void MainWindow::on_pbClearSourcesMisc_c
1115   void MainWindow::removeTableContents(DropTableWidget *myTable){
1116      int size = myTable->selectionModel()->selectedRows().size();
1117  
1118 +    QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os
1119 +
1120      if(size==0){
1121          Util::showPopUp("Select a row first.");
1122          return;
1123      }
1124  
1125 <    if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){
1125 > #ifdef Q_OS_MAC
1126 >    if(this->useYesAsDefaultWhenRemovingItems){
1127 >        defaultButton = QMessageBox::Yes;
1128 >    }
1129 >    else{
1130 >        defaultButton = QMessageBox::No;
1131 >    }
1132 > #endif
1133 >
1134 >
1135 >    if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?",defaultButton)){
1136          for(int i=0; i<size; i++){
1137              //myTable->removeRow(myTable->selectedItems().at(size-i-1)->row());
1138              myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row());
1139          }
1140          updateItemsLoaded(myTable);
1141 +        rowsWereChangedInDropTableWidget();
1142      }
1143   }
1144  
1145   void MainWindow::clearTableContents(DropTableWidget *myTable){
1146 +
1147 +    QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os
1148 +
1149      if(myTable->rowCount()==0){
1150          Util::showPopUp("Nothing to clear.");
1151          return;
1152      }
1153  
1154 <    if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?")){
1155 <        myTable->clearContents();
1156 <        myTable->setRowCount(0);
1154 > #ifdef Q_OS_MAC
1155 >    if(this->useYesAsDefaultWhenRemovingItems){
1156 >        defaultButton = QMessageBox::Yes;
1157      }
1158 <    updateItemsLoaded(myTable);
1158 >    else{
1159 >        defaultButton = QMessageBox::No;
1160 >    }
1161 > #endif
1162 >
1163 >    if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){
1164 >        clearTableNoPrompt(myTable);
1165 >        updateItemsLoaded(myTable);
1166 >        rowsWereChangedInDropTableWidget();
1167 >    }
1168 >
1169   }
1170  
1171 + void MainWindow::clearTableNoPrompt(DropTableWidget *myTable){
1172 +    myTable->clearContents();
1173 +    myTable->setRowCount(0);
1174 + }
1175  
1176   void MainWindow::on_actionPreferences_triggered()
1177   {
# Line 1083 | Line 1182 | void MainWindow::on_actionPreferences_tr
1182  
1183  
1184   void MainWindow::closeEvent(QCloseEvent *event){
1185 <    if(this->vagoSettings->value("ConfirmExit").toBool()){
1186 <        if(!Util::showQuestionPopUp(this,"Exit Vago?")){
1185 >    if(this->vagoSettings->value("AskSaveProject").toBool() && this->unsavedChangesExist){
1186 >        QMessageBox::StandardButton result = askToSaveCurrentProject();
1187 >        if(result == QMessageBox::StandardButton::Cancel){
1188              event->ignore();
1189          }
1190      }
1191   }
1192  
1193 + QMessageBox::StandardButton MainWindow::askToSaveCurrentProject(){
1194 +    QMessageBox::StandardButton result =
1195 +            Util::showQuestionPopUpWithCancel(this,"There are unsaved changes. Do you want to save the current project?", QMessageBox::StandardButton::Yes);
1196 +
1197 +    if(result == QMessageBox::StandardButton::Yes){
1198 +        on_actionSave_triggered();
1199 +    }
1200 +
1201 +    return result;
1202 + }
1203 +
1204   void MainWindow::on_cbToLevels_currentIndexChanged(const QString &arg1)
1205   {
1206  
# Line 1148 | Line 1259 | void MainWindow::on_cbWithTRBS_ONCC_togg
1259  
1260   void MainWindow::on_actionCheck_OniSplit_version_triggered()
1261   {
1262 <    QProcess *myProcess = new QProcess();
1263 <    myProcess->setWorkingDirectory(this->AppDir);
1264 <    myProcess->start(GlobalVars::OniSplitExeName+" -version");
1265 <    myProcess->waitForFinished(-1);
1266 <    QString result=myProcess->readAllStandardOutput();
1267 <    delete myProcess;
1268 <    Util::showPopUp("This Vago version was built with base in OniSplit version "+GlobalVars::BuiltOniSplitVersion+"\n\nActual version is:\n"+result);
1262 >    QProcess myProcess;
1263 >    myProcess.setWorkingDirectory(UtilVago::getAppPath());
1264 >    myProcess.start(UtilVago::getOniSplitExecutable()+" -version");
1265 >    myProcess.waitForFinished();
1266 >
1267 >    QString result=myProcess.readAllStandardOutput();
1268 >
1269 >    Util::showPopUp("This Vago version was built with base in OniSplit version "+GlobalVars::BuiltOniSplitVersion+"\n\nCurrent version is:\n"+result.trimmed());
1270   }
1271  
1272   void MainWindow::on_actionCheck_xmlTools_version_triggered()
1273   {
1274 <    QProcess *myProcess = new QProcess();
1275 <    myProcess->setWorkingDirectory(this->AppDir);
1276 <    myProcess->start(GlobalVars::XmlToolsExeName+" version");
1277 <    myProcess->waitForFinished(-1);
1278 <    QString result=myProcess->readLine();
1279 <    delete myProcess;
1280 <    Util::showPopUp("This Vago version was built with base in xmlTools version "+GlobalVars::BuiltXmlToolsVersion+"\n\nActual version is:\n"+result);
1274 >    QProcess myProcess;
1275 >    myProcess.setWorkingDirectory(UtilVago::getAppPath());
1276 >    myProcess.start(UtilVago::getXmlToolsExecutable()+" --version");
1277 >    myProcess.waitForFinished();
1278 >    QString result=myProcess.readLine();
1279 >
1280 >    Util::showPopUp("This Vago version was built with base in XmlTools version "+GlobalVars::BuiltXmlToolsVersion+"\n\nCurrent version is:\n"+result.trimmed());
1281   }
1282  
1283   /**
1284    Update items loaded
1285 <  **/
1286 < void MainWindow::on_tabWidget_selected(const QString &arg1)
1285 > **/
1286 > void MainWindow::on_tabWidget_currentChanged(int)
1287   {
1288 <    if(arg1.compare("General",Qt::CaseSensitive)==0){ //case sentive is faster
1177 <        updateItemsLoaded(ui->twSourcesXML);
1178 <    }
1179 <    else if(arg1.compare("Textures",Qt::CaseSensitive)==0){
1180 <        updateItemsLoaded(ui->twSourcesTextures);
1181 <    }
1182 <    else if(arg1.compare("Objects",Qt::CaseSensitive)==0){
1183 <        updateItemsLoaded(ui->twSourcesObjects);
1184 <    }
1185 <    else if(arg1.compare("Levels",Qt::CaseSensitive)==0){
1186 <        updateItemsLoaded(ui->twSourcesLevels);
1187 <    }
1188 <    else{
1189 <        updateItemsLoaded(ui->twSourcesMisc);
1190 <    }
1288 >    updateItemsLoaded(getCurrentTableWidget());
1289   }
1290  
1291   void MainWindow::updateItemsLoaded(DropTableWidget *currentTable){
# Line 1197 | Line 1295 | void MainWindow::updateItemsLoaded(DropT
1295      this->itemsLoaded->setText(QString().setNum(numItems)+ (numItems==1?" item ":" items ") +"loaded");
1296   }
1297  
1298 + void MainWindow::rowsWereChangedInDropTableWidget(){
1299 +    // We have changed rows, we have now unsaved changes.
1300 +    if(!this->unsavedChangesExist){
1301 +        this->unsavedChangesExist = true;
1302 +        setVagoWindowTitle();
1303 +    }
1304 + }
1305 +
1306   void MainWindow::on_tbCommand_clicked()
1307   {
1308      //Show preferences
# Line 1240 | Line 1346 | void MainWindow::on_actionOther_triggere
1346  
1347   void MainWindow::on_actionView_log_triggered()
1348   {
1349 <    Util::openLogFile();
1349 >    UtilVago::openLogFile();
1350   }
1351  
1352   void MainWindow::on_actionOpen_AE_folder_triggered()
# Line 1248 | Line 1354 | void MainWindow::on_actionOpen_AE_folder
1354      QDesktopServices::openUrl(QUrl("file:///"+this->AeLocation));
1355   }
1356  
1357 + void MainWindow::on_actionSave_Project_triggered()
1358 + {
1359 +
1360 +    QString filePath = QFileDialog::getSaveFileName(this, tr("Save File"),
1361 +                                                    this->vagoSettings->value("LastProjectPath").toString(),
1362 +                                                    tr("Vago project files (*.vgp)"));
1363 +
1364 +    if(!filePath.isEmpty()){
1365 +        saveProjectState(filePath);
1366 +    }
1367 +
1368 + }
1369 +
1370 + // New Project
1371 + void MainWindow::on_actionNew_Project_triggered()
1372 + {
1373 +    if(this->vagoSettings->value("AskSaveProject").toBool() && this->unsavedChangesExist){
1374 +        QMessageBox::StandardButton result = askToSaveCurrentProject();
1375 +        if(result == QMessageBox::StandardButton::Cancel){
1376 +            return;
1377 +        }
1378 +    }
1379 +
1380 +    QList<DropTableWidget*> myTables = getAllTableWidgets();
1381 +
1382 +    for(DropTableWidget* const currTable : myTables){
1383 +        clearTableNoPrompt(currTable);
1384 +    }
1385 +
1386 +    this->lastProjectFilePath=""; // clear last project file path
1387 +    this->unsavedChangesExist = false;
1388 +
1389 +    setVagoWindowTitle(); // update vago title
1390 + }
1391 +
1392 + void MainWindow::on_actionSave_triggered()
1393 + {
1394 +    if(this->lastProjectFilePath.isEmpty()){
1395 +        on_actionSave_Project_triggered();
1396 +        return;
1397 +    }
1398 +
1399 +    saveProjectState(this->lastProjectFilePath);
1400 + }
1401 +
1402 + void MainWindow::on_actionLoad_Project_triggered()
1403 + {
1404 +
1405 +    QString filePath = QFileDialog::getOpenFileName(this, tr("Load File"),
1406 +                                                    this->vagoSettings->value("LastProjectPath").toString(),
1407 +                                                    tr("Vago project files (*.vgp)"));
1408 +    if(!filePath.isEmpty()){
1409 +        loadProjectState(filePath);
1410 +    }
1411 + }
1412 +
1413 + void MainWindow::on_actionProject1_triggered()
1414 + {
1415 +    loadProjectState(this->ui->actionProject1->text());
1416 + }
1417 +
1418 + void MainWindow::on_actionProject2_triggered()
1419 + {
1420 +    loadProjectState(this->ui->actionProject2->text());
1421 + }
1422 +
1423 + void MainWindow::on_actionProject3_triggered()
1424 + {
1425 +    loadProjectState(this->ui->actionProject3->text());
1426 + }
1427 +
1428 + void MainWindow::on_actionProject4_triggered()
1429 + {
1430 +    loadProjectState(this->ui->actionProject4->text());
1431 + }
1432 +
1433 + void MainWindow::on_actionProject5_triggered()
1434 + {
1435 +    loadProjectState(this->ui->actionProject5->text());
1436 + }
1437 +
1438   QString MainWindow::getTypeConversion(DropTableWidget *myTable){
1439      QString from,to;
1440  
# Line 1297 | Line 1484 | void MainWindow::dtContextMenu(DropTable
1484          selectedRows << rowItem.row();
1485      }
1486  
1487 <    QMenu *menu = new QMenu();
1488 <    QAction *copy = new QAction("Copy",myTable);
1489 <    QAction *moveUp = new QAction("Move Up",myTable);
1490 <    QAction *moveDown = new QAction("Move Down",myTable);
1491 <    QAction *changeOptions = new QAction("Change To Current Options",myTable);
1492 <    QMenu *changeOutput = new QMenu("Change Output for:");
1493 <    QAction *outWorkspace = new QAction("Workspace",myTable);
1494 <    QAction *outCurrOutput = new QAction("Current Output Folder",myTable);
1495 <    QAction *outOther = new QAction("Other...",myTable);
1496 <    QAction *edisable = new QAction("Enable/Disable",myTable);
1487 >    std::unique_ptr<QMenu> menu = std::make_unique<QMenu>();
1488 >    std::unique_ptr<QAction> copy =  std::make_unique<QAction>("Copy",myTable);
1489 >    std::unique_ptr<QAction> moveUp = std::make_unique<QAction>("Move Up",myTable);
1490 >    std::unique_ptr<QAction> moveDown = std::make_unique<QAction>("Move Down",myTable);
1491 >    std::unique_ptr<QAction> changeOptions = std::make_unique<QAction>("Change To Current Options",myTable);
1492 >    std::unique_ptr<QMenu> changeOutput = std::make_unique<QMenu>("Change Output for:");
1493 >    std::unique_ptr<QAction> outWorkspace = std::make_unique<QAction>("Workspace",myTable);
1494 >    std::unique_ptr<QAction> outCurrOutput = std::make_unique<QAction>("Current Output Folder",myTable);
1495 >    std::unique_ptr<QAction> outOther = std::make_unique<QAction>("Other...",myTable);
1496 >    std::unique_ptr<QAction> edisable = std::make_unique<QAction>("Enable/Disable",myTable);
1497  
1498 <    menu->addAction(copy);
1498 >    menu->addAction(copy.get());
1499      menu->addSeparator();
1500 <    menu->addAction(moveUp);
1501 <    menu->addAction(moveDown);
1500 >    menu->addAction(moveUp.get());
1501 >    menu->addAction(moveDown.get());
1502      menu->addSeparator();
1503 <    menu->addAction(changeOptions);
1504 <    menu->addMenu(changeOutput);
1505 <    changeOutput->addActions(QList<QAction*>() << outWorkspace << outCurrOutput << outOther);
1506 <    menu->addAction(edisable);
1503 >    menu->addAction(changeOptions.get());
1504 >    menu->addMenu(changeOutput.get());
1505 >    changeOutput->addActions(QList<QAction*>() << outWorkspace.get() << outCurrOutput.get() << outOther.get());
1506 >    menu->addAction(edisable.get());
1507  
1508  
1509      //if it's in the first row it can't be setted up
# Line 1340 | Line 1527 | void MainWindow::dtContextMenu(DropTable
1527  
1528      QAction* selectedOption = menu->exec(event->globalPos());
1529  
1530 <    if(selectedOption==copy){
1530 >    if(selectedOption==copy.get()){
1531          //Let's copy the contents to the clipboard
1532  
1533          QString toCopy;
# Line 1363 | Line 1550 | void MainWindow::dtContextMenu(DropTable
1550          QApplication::clipboard()->setText(toCopy);
1551          showSuccessStatusMessage(QString::number(size) + (size==1?" item ":" items ")+ "copied to the clipboard");
1552      }
1553 <    else if(selectedOption==moveUp){
1553 >    else if(selectedOption==moveUp.get()){
1554          qSort(selectedRows); //let's order the selections by the row number, so we know exactly how to swap it
1555          myTable->swapPositions(selectedRows,-1);
1556 +        rowsWereChangedInDropTableWidget();
1557      }
1558 <    else if(selectedOption==moveDown){
1558 >    else if(selectedOption==moveDown.get()){
1559          qSort(selectedRows);
1560          myTable->swapPositions(selectedRows,+1);
1561 +        rowsWereChangedInDropTableWidget();
1562      }
1563 <    else if(selectedOption==changeOptions){
1563 >    else if(selectedOption==changeOptions.get()){
1564          changeToCurrentSettings(selectedRows,myTable);
1565      }
1566 <    else if(selectedOption==outWorkspace){
1566 >    else if(selectedOption==outWorkspace.get()){
1567          changeItemsOutput(myTable,selectedRows,this->workspaceLocation);
1568      }
1569 <    else if(selectedOption==outCurrOutput){
1569 >    else if(selectedOption==outCurrOutput.get()){
1570          changeItemsOutput(myTable,selectedRows,this->outputFolder);
1571      }
1572 <    else if(selectedOption==outOther){
1572 >    else if(selectedOption==outOther.get()){
1573  
1574          QString newDir=QFileDialog::getExistingDirectory(this,"Choose the folder for the output of the files selected...",this->AeLocation+"/GameDataFolder");
1575          newDir=Util::normalizePath(newDir);
# Line 1392 | Line 1581 | void MainWindow::dtContextMenu(DropTable
1581          changeItemsOutput(myTable,selectedRows,newDir);
1582  
1583      }
1584 <    else if(selectedOption==edisable){
1584 >    else if(selectedOption==edisable.get()){
1585  
1586          int enabledCount=0, disabledCount=0;
1587  
# Line 1428 | Line 1617 | void MainWindow::dtContextMenu(DropTable
1617              result+=QString::number(disabledCount) + (disabledCount==1?" item ":" items ") + "Disabled";
1618          }
1619  
1620 +        rowsWereChangedInDropTableWidget();
1621          showSuccessStatusMessage(result);
1622      }
1433
1434    delete copy;
1435    delete moveUp;
1436    delete moveDown;
1437    delete changeOptions;
1438    delete outWorkspace;
1439    delete outCurrOutput;
1440    delete outOther;
1441    delete changeOutput;
1442    delete edisable;
1443    delete menu;
1623   }
1624  
1625   void MainWindow::changeToCurrentSettings(QList<int> rows, DropTableWidget* myTable){
# Line 1464 | Line 1643 | void MainWindow::changeToCurrentSettings
1643          myTable->updateTableToolTips(row);
1644      }
1645  
1646 +    rowsWereChangedInDropTableWidget();
1647      showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed to the current settings");
1648   }
1649  
# Line 1487 | Line 1667 | void MainWindow::changeItemsOutput(DropT
1667          myTable->updateTableToolTips(row);
1668      }
1669  
1670 +    rowsWereChangedInDropTableWidget();
1671      showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed the output to "+(newOutput!=this->workspaceLocation?Util::cutName(newOutput):"Vago workspace"));
1672   }
1673  
# Line 1515 | Line 1696 | QString MainWindow::getCommand(DropTable
1696  
1697   }
1698  
1518 /**
1519  This is OS indepented. It maintain size ratio over the Windows and Mac.
1520  **/
1521 void MainWindow::setConverterButtonsSize(){
1522    int height=ui->pbConvertXML->sizeHint().height()*1.3;
1523    ui->pbConvertXML->setMinimumHeight(height);
1524    ui->pbConvertTextures->setMinimumHeight(height);
1525    ui->pbConvertObjects->setMinimumHeight(height);
1526    ui->pbConvertCharacters->setMinimumHeight(height);
1527    ui->pbConvertLevels->setMinimumHeight(height);
1528    ui->pbConvertMisc->setMinimumHeight(height);
1529 }
1530
1531 /**
1532  Gets application directory. In mac os gets the .app directory
1533  **/
1534 QString MainWindow::getOSIndependentAppPath(){
1535 #ifdef Q_WS_MAC
1536    QDir dir = QDir::current();
1537    if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it
1538        dir.cdUp();
1539        dir.cdUp();
1540        dir.cdUp();
1541    }
1542    return dir.absolutePath();
1543 #else
1544    return  QDir::currentPath();
1545 #endif
1546 }
1547
1699   void MainWindow::connectSlots(){
1700  
1701      //This signal is for thread that is working setup the progress bar (make it visible and set it's min-max)
# Line 1598 | Line 1749 | void MainWindow::connectSlots(){
1749      //Context menu for Misc table
1750      connect(ui->twSourcesMisc, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1751   }
1752 +
1753 + void MainWindow::saveProjectState(const QString &filePath)
1754 + {
1755 +
1756 +    QList<DropTableWidget*> tableWidgets = getAllTableWidgets();
1757 +
1758 +    pugi::xml_document doc;
1759 +
1760 +    pugi::xml_node rootNode = doc.append_child("VagoProject");
1761 +    rootNode.append_attribute("vagoVersion").set_value(GlobalVars::LastCompatibleVersion.toUtf8().constData());
1762 +
1763 +    foreach(DropTableWidget* const &myTable, tableWidgets){
1764 +        saveProjectWidget(rootNode, myTable);
1765 +    }
1766 +
1767 +    if(!doc.save_file(filePath.toUtf8().constData(), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){
1768 +        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while trying to save the project file. Please try another path.");
1769 +        return;
1770 +    }
1771 +
1772 +    this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path());
1773 +
1774 +    this->lastProjectFilePath = filePath;
1775 +    this->unsavedChangesExist = false;
1776 +
1777 +    addNewRecentProject(filePath);
1778 +
1779 +    setVagoWindowTitle();
1780 +
1781 +    showSuccessStatusMessage("Project saved sucessfully.");
1782 + }
1783 +
1784 + void MainWindow::saveProjectWidget(pugi::xml_node &rootNode, DropTableWidget* table)
1785 + {
1786 +    QString from;
1787 +    QString to;
1788 +    QString tabName = getTabNameByTableWidget(table);
1789 +
1790 +    pugi::xml_node currentNodeTable = rootNode.append_child("tempName");
1791 +    pugi::xml_node options;
1792 +
1793 +    if(table==ui->twSourcesXML){ //So we only need to parse one command.
1794 +        from = ui->cbFromXML->currentText().toUtf8().constData();
1795 +        to = ui->cbToXML->currentText().toUtf8().constData();
1796 +    }
1797 +    else if(table==ui->twSourcesTextures){
1798 +        from = ui->cbFromTextures->currentText().toUtf8().constData();
1799 +        to = ui->cbToTextures->currentText().toUtf8().constData();
1800 +        options = currentNodeTable.append_child("Options");
1801 +        options.append_attribute("type").set_value(Util::qStrToCstr(getTextureRBCheckedTypeTexture()->text()));
1802 +        options.append_attribute("genMipMaps").set_value(Util::boolToCstr(ui->cbMipMapsTextures->isChecked()));
1803 +        options.append_attribute("noUwrap").set_value(Util::boolToCstr(ui->cbNoUwrap->isChecked()));
1804 +        options.append_attribute("noVwrap").set_value(Util::boolToCstr(ui->cbNoVwrap->isChecked()));
1805 +        options.append_attribute("large").set_value(Util::boolToCstr(ui->cbLarge->isChecked()));
1806 +        options.append_attribute("envMap").set_value(Util::boolToCstr(ui->cbEnvMap->isChecked()));
1807 +        options.append_attribute("envMapValue").set_value(Util::qStrToCstr(ui->leEnvMapTexture->text()));
1808 +    }
1809 +    else if(table==ui->twSourcesCharacters){
1810 +        from = ui->cbFromCharacters->currentText().toUtf8().constData();
1811 +        to = ui->cbToCharacters->currentText().toUtf8().constData();
1812 +        options = currentNodeTable.append_child("Options");
1813 +        options.append_attribute("cellShading").set_value(Util::boolToCstr(ui->cbCellShading->isChecked()));
1814 +        options.append_attribute("normals").set_value(Util::boolToCstr(ui->cbNormals->isChecked()));
1815 +        options.append_attribute("extractTRBSONCC").set_value(Util::boolToCstr(ui->cbWithTRBS_ONCC->isChecked()));
1816 +        options.append_attribute("extractTRBSONCCValue").set_value(Util::qStrToCstr(ui->leTRBS_ONCC->text()));
1817 +    }
1818 +    else if(table==ui->twSourcesObjects){
1819 +        from = ui->cbFromObjects->currentText().toUtf8().constData();
1820 +        to = ui->cbToObjects->currentText().toUtf8().constData();
1821 +        options = currentNodeTable.append_child("Options");
1822 +        options.append_attribute("texture").set_value(Util::boolToCstr(ui->cbTexture->isChecked()));
1823 +        options.append_attribute("textureValue").set_value(Util::qStrToCstr(ui->leTextureName->text()));
1824 +        options.append_attribute("withAnimation").set_value(Util::boolToCstr(ui->cbWithAnimation->isChecked()));
1825 +        options.append_attribute("withAnimationValue").set_value(Util::qStrToCstr(ui->leAnimationName->text()));
1826 +    }
1827 +    else if(table==ui->twSourcesLevels){
1828 +        from = ui->cbFromLevels->currentText().toUtf8().constData();
1829 +        to = ui->cbToLevels->currentText().toUtf8().constData();
1830 +        options = currentNodeTable.append_child("Options");
1831 +        options.append_attribute("extractWithFiles").set_value(Util::boolToCstr(ui->cbSpecificFilesLevels->isChecked()));
1832 +        options.append_attribute("extractWithFilesValue").set_value(Util::qStrToCstr(ui->leSpecificFilesLevels->text()));
1833 +        options.append_attribute("datFilename").set_value(Util::boolToCstr(ui->cbDatLevels->isChecked()));
1834 +        options.append_attribute("datFilenameValue").set_value(Util::qStrToCstr(ui->leTargetDatLevels->text()));
1835 +        options.append_attribute("bnvSource").set_value(Util::boolToCstr(ui->cbBnvLevels->isChecked()));
1836 +        options.append_attribute("bnvSourceValue").set_value(Util::qStrToCstr(ui->leBnvLevels->text()));
1837 +        options.append_attribute("generateGrids").set_value(Util::boolToCstr(ui->cbGridsLevels->isChecked()));
1838 +        options.append_attribute("additionalSources").set_value(Util::boolToCstr(ui->cbAdditionalSourcesLevels->isChecked()));
1839 +        options.append_attribute("additionalSourcesValue").set_value(Util::qStrToCstr(ui->leAdditSourcesLevels->text()));
1840 +    }
1841 +    else{
1842 +        from = ui->cbFromMisc->currentText().toUtf8().constData();
1843 +        to = ui->cbToMisc->currentText().toUtf8().constData();
1844 +    }
1845 +
1846 +    currentNodeTable.set_name(tabName.toUtf8().constData());
1847 +
1848 +    currentNodeTable.append_attribute("from").set_value(from.toUtf8().constData());
1849 +    currentNodeTable.append_attribute("to").set_value(to.toUtf8().constData());
1850 +
1851 +
1852 +    for(int i=0; i<table->rowCount(); i++){
1853 +
1854 +        QString currFileFolder = table->item(i,0)->text();
1855 +        QString currFromTo = table->item(i,1)->text();
1856 +        QString currCommand = table->item(i,2)->text();
1857 +
1858 +        pugi::xml_node currentRow = currentNodeTable.append_child("Row");
1859 +
1860 +
1861 +        currentRow.append_attribute("fileFolder").set_value(Util::qStrToCstr(currFileFolder));
1862 +        currentRow.append_attribute("fromTo").set_value(Util::qStrToCstr(currFromTo));
1863 +        currentRow.append_attribute("command").set_value(Util::qStrToCstr(currCommand));
1864 +
1865 +        if(table->item(i,2)->background()==table->disabledBackStyle){
1866 +            currentRow.append_attribute("disabled").set_value(true);
1867 +        }
1868 +
1869 +    }
1870 + }
1871 +
1872 + QRadioButton* MainWindow::getTextureRBCheckedTypeTexture()
1873 + {
1874 +    if(ui->rbBGR32->isChecked()){
1875 +        return ui->rbBGR32;
1876 +    }
1877 +    else if(ui->rbBGRA32->isChecked()){
1878 +        return ui->rbBGRA32;
1879 +    }
1880 +    else if(ui->rbBGR555->isChecked()){
1881 +        return ui->rbBGR555;
1882 +    }
1883 +    else if(ui->rbBGRA5551->isChecked()){
1884 +        return ui->rbBGRA5551;
1885 +    }
1886 +    else if(ui->rbBGRA444->isChecked()){
1887 +        return ui->rbBGRA444;
1888 +    }
1889 +    else{ //dxt1 checked
1890 +        return ui->rbDxt1;
1891 +    }
1892 + }
1893 +
1894 + QRadioButton* MainWindow::getTextureRBTypeTextureByName(const QString &texType)
1895 + {
1896 +    if(QString::compare(texType,ui->rbBGR32->text(),Qt::CaseSensitive)==0){
1897 +        return ui->rbBGR32;
1898 +    }
1899 +    else if(QString::compare(texType,ui->rbBGRA32->text(),Qt::CaseSensitive)==0){
1900 +        return ui->rbBGRA32;
1901 +    }
1902 +    else if(QString::compare(texType, ui->rbBGR555->text(),Qt::CaseSensitive)==0){
1903 +        return ui->rbBGR555;
1904 +    }
1905 +    else if(QString::compare(texType,ui->rbBGRA5551->text(),Qt::CaseSensitive)==0){
1906 +        return ui->rbBGRA5551;
1907 +    }
1908 +    else if(QString::compare(texType,ui->rbBGRA444->text(),Qt::CaseSensitive)==0){
1909 +        return ui->rbBGRA444;
1910 +    }
1911 +    else{ //dxt1
1912 +        return ui->rbDxt1;
1913 +    }
1914 +
1915 + }
1916 +
1917 + void MainWindow::setVagoWindowTitle(){
1918 +
1919 +    QString vagoTitle = "Vago v"+GlobalVars::AppVersion + " - ";
1920 +
1921 +    if(this->lastProjectFilePath.isEmpty()){
1922 +        vagoTitle += "Untitled";
1923 +    }
1924 +    else{
1925 +        vagoTitle += Util::cutNameWithoutBackSlash(this->lastProjectFilePath);
1926 +    }
1927 +
1928 +    if(this->unsavedChangesExist){
1929 +        vagoTitle += "*";
1930 +    }
1931 +
1932 +    setWindowTitle(vagoTitle);
1933 + }
1934 +
1935 + DropTableWidget* MainWindow::getCurrentTableWidget(){
1936 +
1937 +    return getTableWidgetByTabName(ui->tabWidget->tabText(ui->tabWidget->currentIndex()));
1938 +
1939 + }
1940 +
1941 + DropTableWidget* MainWindow::getTableWidgetByTabName(const QString &tabName){
1942 +
1943 +    if(tabName.compare("XML",Qt::CaseSensitive)==0){ //case sentive is faster
1944 +        return ui->twSourcesXML;
1945 +    }
1946 +    else if(tabName.compare("Textures",Qt::CaseSensitive)==0){
1947 +        return ui->twSourcesTextures;
1948 +    }
1949 +    else if(tabName.compare("Characters",Qt::CaseSensitive)==0){
1950 +        return ui->twSourcesCharacters;
1951 +    }
1952 +    else if(tabName.compare("Objects",Qt::CaseSensitive)==0){
1953 +        return ui->twSourcesObjects;
1954 +    }
1955 +    else if(tabName.compare("Levels",Qt::CaseSensitive)==0){
1956 +        return ui->twSourcesLevels;
1957 +    }
1958 +    else{
1959 +        return ui->twSourcesMisc;
1960 +    }
1961 +
1962 + }
1963 +
1964 + QString MainWindow::getCurrentTabName(){
1965 +    return ui->tabWidget->tabText(ui->tabWidget->currentIndex());
1966 + }
1967 +
1968 + QString MainWindow::getTabNameByTableWidget(DropTableWidget* table){
1969 +
1970 +    if(table == ui->twSourcesXML){
1971 +        return ui->tabWidget->tabText(XMLTabIndex);
1972 +    }
1973 +    else if(table == ui->twSourcesTextures){
1974 +        return ui->tabWidget->tabText(TexturesTabIndex);
1975 +    }
1976 +    else if(table == ui->twSourcesCharacters){
1977 +        return ui->tabWidget->tabText(CharactersTabIndex);
1978 +    }
1979 +    else if(table == ui->twSourcesObjects){
1980 +        return ui->tabWidget->tabText(ObjectsTabIndex);
1981 +    }
1982 +    else if(table == ui->twSourcesLevels){
1983 +        return ui->tabWidget->tabText(LevelsTabIndex);
1984 +    }
1985 +    else{
1986 +        return ui->tabWidget->tabText(MiscTabIndex);
1987 +    }
1988 +
1989 + }
1990 +
1991 + QList<DropTableWidget*> MainWindow::getAllTableWidgets()
1992 + {
1993 +    QList<DropTableWidget*> tableWidgets;
1994 +
1995 +    tableWidgets << ui->twSourcesXML << ui->twSourcesTextures << ui->twSourcesCharacters
1996 +                 << ui->twSourcesObjects << ui->twSourcesLevels << ui->twSourcesMisc;
1997 +
1998 +    return tableWidgets;
1999 + }
2000 +
2001 + void MainWindow::loadProjectState(const QString &filePath)
2002 + {
2003 +
2004 +    if(this->vagoSettings->value("AskSaveProject").toBool() && this->unsavedChangesExist){
2005 +        QMessageBox::StandardButton result = askToSaveCurrentProject();
2006 +        if(result == QMessageBox::StandardButton::Cancel){
2007 +            return;
2008 +        }
2009 +    }
2010 +
2011 +    QString statusError = "Couldn't load project.";
2012 +
2013 +    pugi::xml_document doc;
2014 +
2015 +    pugi::xml_parse_result result = doc.load_file(Util::qStrToCstr(filePath));
2016 +
2017 +    if(result.status!=pugi::status_ok){
2018 +        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while loading project file.\n" + QString(result.description()));
2019 +        showErrStatusMessage(statusError);
2020 +        return;
2021 +    }
2022 +
2023 +
2024 +    if(QString(doc.root().first_child().name()) != "VagoProject"){
2025 +        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, QString(doc.root().name()) + "The file opened is not a valid VagoProject file. Load aborted.");
2026 +        showErrStatusMessage(statusError);
2027 +        return;
2028 +    }
2029 +
2030 +    QString projVagoVersion;
2031 +
2032 +    try{
2033 +        projVagoVersion = QString(doc.select_node("/VagoProject/@vagoVersion").attribute().value());
2034 +    }
2035 +    catch (const pugi::xpath_exception& e)
2036 +    {
2037 +        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't find the vagoVersion of the current project. Load aborted.\n" + QString(e.what()));
2038 +        showErrStatusMessage(statusError);
2039 +        return;
2040 +    }
2041 +
2042 +    if(!projVagoVersion.startsWith(GlobalVars::LastCompatibleVersion)){
2043 +        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "The project that you are trying to load seems it is not compatible with your Vago Version. Please update Vago and try again.");
2044 +        showErrStatusMessage(statusError);
2045 +        return;
2046 +    }
2047 +
2048 +    // After the initial validations begin loading the project data
2049 +
2050 +    QList<DropTableWidget*> tableWidgets = getAllTableWidgets();
2051 +
2052 +    try{
2053 +        foreach(DropTableWidget* const &myTable, tableWidgets){
2054 +            loadProjectWidget(doc, myTable);
2055 +        }
2056 +    }
2057 +    catch(const std::exception& e){
2058 +        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't load the vago project. Error: " + QString(e.what()));
2059 +        showErrStatusMessage(statusError);
2060 +        return;
2061 +    }
2062 +
2063 +    this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path());
2064 +
2065 +    this->lastProjectFilePath = filePath;
2066 +    this->unsavedChangesExist = false;
2067 +
2068 +    addNewRecentProject(filePath);
2069 +
2070 +    setVagoWindowTitle();
2071 +
2072 +    showSuccessStatusMessage("Project loaded sucessfully.");
2073 + }
2074 +
2075 +
2076 + void MainWindow::loadProjectWidget(pugi::xml_document &doc, DropTableWidget* table)
2077 + {
2078 +    QString tabName = getTabNameByTableWidget(table);
2079 +    QString from (doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/@from")).attribute().value());
2080 +    QString to (doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/@to")).attribute().value());
2081 +
2082 +    if(table==ui->twSourcesXML){
2083 +        ui->cbFromXML->setCurrentText(from);
2084 +        on_cbFromXML_currentIndexChanged(from);
2085 +        ui->cbToXML->setCurrentText(to);
2086 +    }
2087 +    else if(table==ui->twSourcesTextures){
2088 +        //ui->cbFromTextures->setCurrentText(from);
2089 +        on_cbFromTextures_currentIndexChanged(from);
2090 +        ui->cbToTextures->setCurrentText(to);
2091 +
2092 +        getTextureRBTypeTextureByName((doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@type")).attribute().value()))->setChecked(true);
2093 +        ui->cbMipMapsTextures->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@genMipMaps")).attribute().as_bool());
2094 +        ui->cbNoUwrap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@noUwrap")).attribute().as_bool());
2095 +        ui->cbNoVwrap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@noVwrap")).attribute().as_bool());
2096 +        ui->cbLarge->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@large")).attribute().as_bool());
2097 +        ui->cbEnvMap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@envMap")).attribute().as_bool());
2098 +        ui->leEnvMapTexture->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@envMapValue")).attribute().value()));
2099 +    }
2100 +    else if(table==ui->twSourcesCharacters){
2101 +        ui->cbFromCharacters->setCurrentText(from);
2102 +        on_cbFromCharacters_currentIndexChanged(from);
2103 +        ui->cbToCharacters->setCurrentText(to);
2104 +
2105 +
2106 +        ui->cbCellShading->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@cellShading")).attribute().as_bool());
2107 +        ui->cbNormals->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@normals")).attribute().as_bool());
2108 +        ui->cbWithTRBS_ONCC->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractTRBSONCC")).attribute().as_bool());
2109 +        ui->leTRBS_ONCC->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractTRBSONCCValue")).attribute().value()));
2110 +    }
2111 +    else if(table==ui->twSourcesObjects){
2112 +        ui->cbFromObjects->setCurrentText(from);
2113 +        on_cbFromObjects_currentIndexChanged(from);
2114 +        ui->cbToObjects->setCurrentText(to);
2115 +
2116 +        ui->cbTexture->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@texture")).attribute().as_bool());
2117 +        ui->leTextureName->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@textureValue")).attribute().value()));
2118 +        ui->cbWithAnimation->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@withAnimation")).attribute().as_bool());
2119 +        ui->leAnimationName->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@withAnimationValue")).attribute().value()));
2120 +    }
2121 +    else if(table==ui->twSourcesLevels){
2122 +        ui->cbFromLevels->setCurrentText(from);
2123 +        on_cbFromLevels_currentIndexChanged(from);
2124 +        ui->cbToLevels->setCurrentText(to);
2125 +
2126 +        ui->cbSpecificFilesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractWithFiles")).attribute().as_bool());
2127 +        ui->leSpecificFilesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractWithFilesValue")).attribute().value()));
2128 +        ui->cbDatLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@datFilename")).attribute().as_bool());
2129 +        ui->leTargetDatLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@datFilenameValue")).attribute().value()));
2130 +        ui->cbBnvLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSource")).attribute().as_bool());
2131 +        ui->leBnvLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSourceValue")).attribute().value()));
2132 +        ui->cbGridsLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@generateGrids")).attribute().as_bool());
2133 +        ui->cbAdditionalSourcesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSources")).attribute().as_bool());
2134 +        ui->leAdditSourcesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSource")).attribute().value()));
2135 +    }
2136 +    else{
2137 +        ui->cbFromMisc->setCurrentText(from);
2138 +        on_cbFromMisc_currentIndexChanged(from);
2139 +        ui->cbToMisc->setCurrentText(to);
2140 +    }
2141 +
2142 +    // Clean previous rows
2143 +    clearTableNoPrompt(table);
2144 +
2145 +    for(const pugi::xpath_node &xPathNode : doc.select_nodes(Util::qStrToCstr("/VagoProject/"+tabName+"/Row"))){
2146 +        pugi::xml_node currNode = xPathNode.node();
2147 +
2148 +        QString currFileFolder = currNode.attribute("fileFolder").value();
2149 +        QString currFromTo = currNode.attribute("fromTo").value();
2150 +        QString currCommand = currNode.attribute("command").value();
2151 +
2152 +        bool isToDisable = false;
2153 +        pugi::xml_attribute disabledAttr = currNode.attribute("disabled");
2154 +        isToDisable = disabledAttr.empty() ? false : disabledAttr.as_bool();
2155 +
2156 +        addRowTable(table,currFileFolder,currFromTo,currCommand, isToDisable);
2157 +    }
2158 + }
2159 +
2160 + void MainWindow::saveRecentProjects(){
2161 +    for(int i=0; i<this->recentProjectsList.size(); i++){
2162 +        this->vagoSettings->setValue("RecentProject" + QString::number(i+1), recentProjectsList[i]);
2163 +    }
2164 + }
2165 +
2166 + void MainWindow::loadRecentProjects(){
2167 +    for(int i=0; i<this->recentProjectsMaxSize; i++){
2168 +
2169 +        QString currProj = this->vagoSettings->value("RecentProject" + QString::number(i+1)).toString();
2170 +
2171 +        if(!currProj.isEmpty()){
2172 +            recentProjectsList.append(currProj);
2173 +        }
2174 +        else{
2175 +            break;
2176 +        }
2177 +    }
2178 +
2179 +    reloadRecentProjectsMenu();
2180 +
2181 + }
2182 +
2183 + void MainWindow::addNewRecentProject(const QString &filePath){
2184 +
2185 +    // If the new project is equal to the last one simply ignore
2186 +    if(filePath == this->vagoSettings->value("RecentProject1").toString()){
2187 +        return;
2188 +    }
2189 +
2190 +    // If the item already exists in our list remove it, so it can go to the top again
2191 +    for(auto it = this->recentProjectsList.begin(); it != this->recentProjectsList.end();){
2192 +        if(*it == filePath){
2193 +            it = this->recentProjectsList.erase(it);
2194 +        }
2195 +        else{
2196 +            it++;
2197 +        }
2198 +    }
2199 +
2200 +    // if we gonna overflow our list, remove the older item to reserve space to the new one
2201 +    if(this->recentProjectsList.size()==this->recentProjectsMaxSize){
2202 +        this->recentProjectsList.removeLast();
2203 +    }
2204 +
2205 +    this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path());
2206 +
2207 +    // add new recent file
2208 +    this->recentProjectsList.prepend(filePath);
2209 +
2210 +    reloadRecentProjectsMenu();
2211 +
2212 +    saveRecentProjects();
2213 + }
2214 +
2215 + void MainWindow::reloadRecentProjectsMenu(){
2216 +
2217 +    ui->menuRecent_Projects->setEnabled(false);
2218 +    ui->actionProject1->setVisible(false);
2219 +    ui->actionProject2->setVisible(false);
2220 +    ui->actionProject3->setVisible(false);
2221 +    ui->actionProject4->setVisible(false);
2222 +    ui->actionProject5->setVisible(false);
2223 +
2224 +    {
2225 +        QList<QString>::const_iterator it;
2226 +        int i;
2227 +        for(it = recentProjectsList.cbegin(), i=0; it != recentProjectsList.cend(); it++, i++){
2228 +
2229 +            QAction* currAction = nullptr;
2230 +
2231 +            switch (i){
2232 +            case 0:
2233 +                currAction = ui->actionProject1;
2234 +                break;
2235 +            case 1:
2236 +                currAction = ui->actionProject2;
2237 +                break;
2238 +            case 2:
2239 +                currAction = ui->actionProject3;
2240 +                break;
2241 +            case 3:
2242 +                currAction = ui->actionProject4;
2243 +                break;
2244 +            case 4:
2245 +                currAction = ui->actionProject5;
2246 +                break;
2247 +            }
2248 +
2249 +            if(currAction){
2250 +                ui->menuRecent_Projects->setEnabled(true);
2251 +                currAction->setText(*it);
2252 +                currAction->setVisible(true);
2253 +            }
2254 +        }
2255 +    }
2256 +
2257 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)