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 793 by s10k, Sat Apr 6 23:30:00 2013 UTC vs.
Revision 1031 by iritscen, Sun Mar 13 16:11:45 2016 UTC

# Line 9 | Line 9 | MainWindow::MainWindow(QWidget *parent)
9   {
10      ui->setupUi(this);
11  
12 +    this->AppDir=getOSIndependentAppPath();
13 +
14 +    this->myLogger = new Logger(this->AppDir); //start logger
15 +
16 +    this->myLogger->writeString("Detected AppDir: "+this->AppDir);
17 +    this->myLogger->writeString("True app dir: "+QDir::currentPath());
18 +
19      this->setWindowTitle("Vago v"+GlobalVars::AppVersion);
20  
21 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitString)){
21 >    if(!QFile::exists(this->AppDir+"/"+GlobalVars::OniSplitString)){
22          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.");
23          exit(1);
24      }
25  
26 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsString)){
26 >    if(!QFile::exists(this->AppDir+"/"+GlobalVars::XmlToolsString)){
27          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.");
28          exit(1);
29      }
30  
31 <    this->vagoSettings = new QSettings(QDir::currentPath() + "/" + this->VagoSettingsName, QSettings::IniFormat);
31 >    this->vagoSettings = new QSettings(this->AppDir + "/" + this->VagoSettingsName, QSettings::IniFormat);
32  
33      //First Execution? Old configuration? Settings missed?
34      bool iniChanged=false;
# Line 30 | Line 37 | MainWindow::MainWindow(QWidget *parent)
37          iniChanged=true;
38      }
39      if(!this->vagoSettings->contains("Workspace")){
40 <        this->vagoSettings->setValue("Workspace", QDir::currentPath()+"/VagoWorkspace");
40 >        this->vagoSettings->setValue("Workspace", this->AppDir+"/VagoWorkspace");
41          iniChanged=true;
42      }
43      if(!this->vagoSettings->contains("AeFolder")){
# Line 50 | Line 57 | MainWindow::MainWindow(QWidget *parent)
57          this->vagoSettings->setValue("AeFolder", aefolder);
58          iniChanged=true;
59      }
60 +    if(!this->vagoSettings->contains("WindowWidth")){
61 +        this->vagoSettings->setValue("WindowWidth", GlobalVars::DefaultWindowWidth);
62 +        iniChanged=true;
63 +    }
64 +    if(!this->vagoSettings->contains("WindowHeight")){
65 +        this->vagoSettings->setValue("WindowHeight", GlobalVars::DefaultWindowHeight);
66 +        iniChanged=true;
67 +    }
68      if(!this->vagoSettings->contains("OniWindow")){
69          this->vagoSettings->setValue("OniWindow", true);
70          iniChanged=true;
# Line 62 | Line 77 | MainWindow::MainWindow(QWidget *parent)
77          this->vagoSettings->setValue("ConfirmExit", false);
78          iniChanged=true;
79      }
80 + #ifdef Q_OS_MAC
81 +    if(!this->vagoSettings->contains("useYesAsDefaultWhenRemovingItems")){
82 +        this->vagoSettings->setValue("useYesAsDefaultWhenRemovingItems", false);
83 +        iniChanged=true;
84 +    }
85 + #endif
86  
87      if(iniChanged){
88          this->vagoSettings->sync();
# Line 72 | Line 93 | MainWindow::MainWindow(QWidget *parent)
93      this->workspaceWizardsLocation=this->workspaceLocation+"/Wizards";
94      this->AeLocation=this->vagoSettings->value("AeFolder").toString();
95      this->outputFolder=this->workspaceLocation;
96 +    this->startedWindowWidth=this->vagoSettings->value("WindowWidth").toInt();
97 +    this->startedWindowHeight=this->vagoSettings->value("WindowHeight").toInt();
98 + #ifdef Q_OS_MAC
99 +    this->useYesAsDefaultWhenRemovingItems=this->vagoSettings->value("useYesAsDefaultWhenRemovingItems").toBool();
100 + #endif
101  
102      //Create our workspace if it doesn't exists yet
103      if(!QDir(this->workspaceLocation).exists()){
# Line 85 | Line 111 | MainWindow::MainWindow(QWidget *parent)
111      this->myBar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed);
112      this->myBar->setMinimumWidth(150);
113      this->myBar->hide(); //hide while not being used
114 +    ui->tbAbortConversion->hide(); //hide while not being used
115  
116 <    ui->statusBar->addPermanentWidget(myBar); //this adds automatically in right
117 <
91 <    this->myLogger = new Logger(); //start logger
116 >    ui->statusBar->addPermanentWidget(this->myBar); //this adds automatically in right
117 >    ui->statusBar->addPermanentWidget(ui->tbAbortConversion);
118  
119      //Initialize list pointers
120      this->listToProccess = new QStringList;
121  
122      //Create a thread for do the conversion in background
123 <    this->myConverter = new Converter(this->myLogger,this->listToProccess);
123 >    this->myConverter = new Converter(this->AppDir,this->myLogger,this->listToProccess);
124  
125      // User interface
126      ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button
# Line 109 | Line 135 | MainWindow::MainWindow(QWidget *parent)
135  
136      setConverterButtonsSize();
137  
138 < #ifdef Q_WS_MAC
138 > #ifdef Q_OS_MAC
139      // 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
140      ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows
141      // Set mac platform the first one in the menu, and also make it checkable by default
# Line 117 | Line 143 | MainWindow::MainWindow(QWidget *parent)
143      ui->menuTarget_Platform->addAction(ui->actionWindows);
144      ui->actionWindows->setChecked(false);
145      ui->actionMac_Windows_demo->setChecked(true);
146 <    resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
147 <    // because the components on mac use more space
146 >    // resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
147 >    //// because the components on mac use more space
148 > #else
149 >    //resize(640,480); // windows stuff
150   #endif
151  
152 +    resize(this->startedWindowWidth,this->startedWindowHeight);
153 +
154      connectSlots();
155  
156      //Commands Mapping
157      this->commandMap = QHash<QString, QString>();
158      mapCommands();
159  
160 <    updateItemsLoaded(ui->twSourcesGeneral);
160 >    updateItemsLoaded(ui->twSourcesXML);
161  
162      this->myLogger->writeString("Application started.");
163   }
# Line 158 | Line 188 | void MainWindow::on_actionAE_Package_Cre
188  
189   void MainWindow::on_actionSound_Wizard_triggered()
190   {
191 <    SoundWizard myWizard (this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
191 >    SoundWizard myWizard (this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
192      myWizard.exec();
193   }
194  
# Line 169 | Line 199 | void MainWindow::on_tbOni_clicked()
199      if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window?
200          arguments << "-noswitch";
201      }
202 < #ifdef Q_WS_WIN
202 > #ifdef Q_OS_WIN
203      else{
204          arguments << "-switch"; // only supported on windows. Was added by daodan dll.
205      }
# Line 196 | Line 226 | void MainWindow::on_tbOpenFolder_clicked
226      QDesktopServices::openUrl(QUrl("file:///"+this->outputFolder));
227   }
228  
229 + void MainWindow::on_tbAbortConversion_clicked()
230 + {
231 +    if(Util::showQuestionPopUp(this,"Are you sure you want to abort the current conversion?")){
232 +        emit terminateCurrProcess();
233 +    }
234 + }
235 +
236   void MainWindow::on_cbEnvMap_toggled(bool checked)
237   {
238      ui->leEnvMapTexture->setEnabled(checked);
# Line 211 | Line 248 | void MainWindow::on_cbWithAnimation_togg
248      ui->leAnimationName->setEnabled(checked);
249   }
250  
251 < void MainWindow::on_cbCamera_toggled(bool checked)
251 > void MainWindow::on_cbSpecificFilesLevels_toggled(bool checked)
252   {
253 <    if(checked){
217 <        ui->cbGeometry->setChecked(false);
218 <    }
219 < }
220 <
221 < void MainWindow::on_cbGeometry_toggled(bool checked)
222 < {
223 <    ui->leGeometryName->setEnabled(checked);
224 <    if(checked){
225 <        ui->cbCamera->setChecked(false);
226 <    }
253 >    ui->leSpecificFilesLevels->setEnabled(checked);
254   }
255  
256   void MainWindow::on_actionCheck_For_Updates_triggered()
# Line 262 | Line 289 | void MainWindow::checkVagoLastVersion(QN
289      result->deleteLater();
290   }
291  
292 < void MainWindow::on_pbAddSourceGeneral_clicked()
292 > void MainWindow::on_pbAddSourceXML_clicked()
293   {
294 <    if(QString::compare(ui->cbFromGeneral->currentText(),"ONI",Qt::CaseSensitive)==0 && QString::compare(ui->cbToGeneral->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster)
268 <        addFilesSource(ui->twSourcesGeneral,Util::multipleDirDialog("Choose folders with ONIs..."));
269 <    }
270 <    else{
271 <        addFilesSource( ui->twSourcesGeneral,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
272 <    }
294 >    addFilesSource( ui->twSourcesXML,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
295   }
296  
297   void MainWindow::on_pbAddSourceTextures_clicked()
# Line 277 | Line 299 | void MainWindow::on_pbAddSourceTextures_
299      addFilesSource( ui->twSourcesTextures, QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
300   }
301  
302 < void MainWindow::on_pbAddSourceModels_clicked()
302 > void MainWindow::on_pbAddSourceObjects_clicked()
303   {
304 <    addFilesSource( ui->twSourcesModels,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
304 >    addFilesSource( ui->twSourcesObjects,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
305   }
306  
307 < void MainWindow::on_pbAddSourceAnimations_clicked()
307 > void MainWindow::on_pbAddSourceCharacters_clicked()
308   {
309 <    addFilesSource( ui->twSourcesAnimations,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
309 >    addFilesSource( ui->twSourcesCharacters,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
310   }
311  
312   void MainWindow::on_pbAddSourceLevels_clicked()
313   {
314 <    addFilesSource( ui->twSourcesLevels,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
314 >    if(QString::compare(ui->cbFromXML->currentText(),"ONI FILES",Qt::CaseSensitive)==0 && QString::compare(ui->cbToXML->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster)
315 >        addFilesSource(ui->twSourcesLevels,Util::multipleDirDialog("Choose folders with ONIs..."));
316 >    }
317 >    else{
318 >        addFilesSource(ui->twSourcesLevels,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)"));
319 >    }
320   }
321  
322   void MainWindow::on_pbAddSourceMisc_clicked()
# Line 321 | Line 348 | void MainWindow::addFilesSource(DropTabl
348      to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> "
349  
350      //Pre-processing (check if the files/folders received are valid), e.g. check for ONI->DAT if are only given folders and not files
351 <    if(QString::compare(from,"ONI",Qt::CaseSensitive)==0 && QString::compare(to,"DAT",Qt::CaseSensitive)==0){
351 >    if(from=="ONI FILES" && to=="DAT"){
352          //check if it's a folder
353          foreach(QString myFile, files){
354              if(!QDir(myFile).exists()){
# Line 373 | Line 400 | void MainWindow::addFilesSource(DropTabl
400      updateItemsLoaded(myTable);
401   }
402  
403 < QString MainWindow::fileParsingGeneral(QString myOutputFolder, QString from, QString to , QString file){
403 > QString MainWindow::fileParsingXML(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){
404  
405      QString command;
406  
407 <    if(QString::compare(from,"ONI",Qt::CaseSensitive)==0 && QString::compare(to,"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster
408 <
382 <        QString datName;
383 <
384 <        if(ui->cbDatGeneral->isChecked()){
385 <            if(ui->leTargetDatGeneral->text().isEmpty()){
386 <                showErrStatusMessage("Checkbox '"+ui->cbDatGeneral->text()+"' is selected. The name cannot be empty.");
387 <                return "";
388 <            }
389 <            datName+=QString(myOutputFolder).insert(myOutputFolder.size()-1,ui->leTargetDatGeneral->text()); //set name inputted by user
390 <            if(!ui->leTargetDatGeneral->text().toUpper().endsWith(".DAT")){
391 <                datName.insert(datName.size()-1,".dat"); //append extension if necessary (-1 to maintain final quote)
392 <            }
393 <        }
394 <        else{
395 <            datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::cutName(file).remove("/")+".dat"); //if none iputted set the same name of input file
396 <        }
397 <
398 <        if(ui->actionWindows->isChecked()){ //is target plataform select windows?
399 <            return command=this->commandMap.value("general->"+from+"->"+to+"(PC)")+" "+ file + " "+datName;
400 <        }
401 <        else{
402 <            return command=this->commandMap.value("general->"+from+"->"+to+"(demoPCMAC)")+" "+ file + " "+datName;
403 <        }
407 >    if(from=="ONI" && to=="XML"){
408 >        return command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder+" "+file;
409      }
410 <    else if(QString::compare(from,"ONI",Qt::CaseSensitive)==0 && QString::compare(to,"XML",Qt::CaseSensitive)==0 && ui->cbTRAMGeneral->isChecked()){
411 <        if(ui->leTRAMGeneral->text().isEmpty()){
407 <            showErrStatusMessage("Checkbox '"+ui->cbTRAMGeneral->text()+"' is selected. The source cannot be empty.");
408 <            return "";
409 <        }
410 <        return command=this->commandMap.value("general->"+from+"->"+to)+" "+myOutputFolder+" "+this->commandMap.value("general->"+ui->cbTRAMGeneral->text())+file + " "+ Util::normalizeAndQuote(ui->leTRAMGeneral->text());
411 <    }
412 <    else{
413 <        return command=this->commandMap.value("general->"+from+"->"+to)+" "+myOutputFolder+" "+file;
410 >    else if(from=="XML" && to=="ONI"){
411 >        return command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder+" "+file;
412      }
413  
414 +    return "";
415 +
416   }
417  
418 < QString MainWindow::fileParsingTextures(QString myOutputFolder, QString from, QString to , QString file){
418 > QString MainWindow::fileParsingTextures(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){
419  
420 <    QString command=this->commandMap.value("textures->"+from+"->"+to)+" "+myOutputFolder;
420 >    QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder;
421  
422      if(ui->gbTextures->isEnabled()){ //faster than compare strings (if is DAT/ONI)
423  
424          if(ui->cbMipMapsTextures->isChecked()){
425 <            command+=" "+this->commandMap.value("textures->"+ui->cbMipMapsTextures->text());
425 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbMipMapsTextures->text());
426          }
427  
428          if(ui->cbNoUwrap->isChecked()){
429 <            command+=" "+this->commandMap.value("textures->"+ui->cbNoUwrap->text());
429 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNoUwrap->text());
430          }
431  
432          if(ui->cbNoVwrap->isChecked()){
433 <            command+=" "+this->commandMap.value("textures->"+ui->cbNoVwrap->text());
433 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNoVwrap->text());
434          }
435  
436          if(ui->cbLarge->isChecked()){
437 <            command+=" "+this->commandMap.value("textures->"+ui->cbLarge->text());
437 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbLarge->text());
438          }
439  
440          if(ui->rbBGR32->isChecked()){
441 <            command+=" "+this->commandMap.value("textures->"+ui->rbBGR32->text());
441 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGR32->text());
442          }
443          else if(ui->rbBGRA32->isChecked()){
444 <            command+=" "+this->commandMap.value("textures->"+ui->rbBGRA32->text());
444 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA32->text());
445          }
446          else if(ui->rbBGR555->isChecked()){
447 <            command+=" "+this->commandMap.value("textures->"+ui->rbBGR555->text());
447 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGR555->text());
448          }
449          else if(ui->rbBGRA5551->isChecked()){
450 <            command+=" "+this->commandMap.value("textures->"+ui->rbBGRA5551->text());
450 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA5551->text());
451          }
452          else if(ui->rbBGRA444->isChecked()){
453 <            command+=" "+this->commandMap.value("textures->"+ui->rbBGRA444->text());
453 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA444->text());
454          }
455          else{ //dxt1 checked
456 <            command+=" "+this->commandMap.value("textures->"+ui->rbDxt1->text());
456 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbDxt1->text());
457          }
458  
459          if(ui->cbEnvMap->isChecked()){
# Line 461 | Line 461 | QString MainWindow::fileParsingTextures(
461                  showErrStatusMessage("Checkbox '"+ui->cbEnvMap->text()+"' is selected. The name texture name cannot be empty.");
462                  return "";
463              }
464 <            command+=" "+this->commandMap.value("textures->"+ui->cbEnvMap->text()) + ui->leEnvMapTexture->text().remove(".oni",Qt::CaseInsensitive);
464 >            command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbEnvMap->text()) + ui->leEnvMapTexture->text().remove(".oni",Qt::CaseInsensitive);
465          }
466      }
467  
468      return command+=" "+file; //add source
469   }
470  
471 < QString MainWindow::fileParsingModels(QString myOutputFolder, QString from, QString to , QString file){
471 > QString MainWindow::fileParsingCharacters(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){
472  
473 <    QString command=this->commandMap.value("models->"+from+"->"+to)+" "+myOutputFolder;
473 >    QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder + " " + file ;
474  
475    //TODO: This can be optimized. When some are not enable others are.
476    if(ui->cbTexture->isChecked()){
477        if(ui->leTextureName->text().isEmpty()){
478            showErrStatusMessage("Checkbox '"+ui->cbTexture->text()+"' is selected. The name cannot be empty.");
479            return "";
480        }
481        command+=" "+this->commandMap.value("models->"+ui->cbTexture->text()) + ui->leTextureName->text().remove(".oni",Qt::CaseInsensitive);
482    }
475  
476      if(ui->cbCellShading->isChecked()){
477 <        command+=" "+this->commandMap.value("models->"+ui->cbCellShading->text());
477 >        command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbCellShading->text());
478      }
479  
480      if(ui->cbNormals->isChecked()){
481 <        command+=" "+this->commandMap.value("models->"+ui->cbNormals->text());
481 >        command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNormals->text());
482      }
483  
484 <    if(ui->cbWithAnimation->isEnabled()){
485 <        if(ui->cbWithAnimation->isChecked()){
486 <            command+=" "+this->commandMap.value("models->"+ui->cbWithAnimation->text())+ui->leAnimationName->text().remove(".oni",Qt::CaseInsensitive);
487 <        }
496 <        else{
497 <            command+=" "+this->commandMap.value("models->No Animation");
484 >    if(ui->cbWithTRBS_ONCC->isChecked()){
485 >        if(ui->leTRBS_ONCC->text().isEmpty()){
486 >            showErrStatusMessage("Checkbox '"+ui->cbWithTRBS_ONCC->text()+"' is selected. The name cannot be empty.");
487 >            return "";
488          }
499    }
489  
490 +        command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbWithTRBS_ONCC->text())+Util::normalizeAndQuote(ui->leTRBS_ONCC->text());
491 +    }
492  
493 <    return command+=" "+file; //add source
493 >    return command;
494   }
495  
505 QString MainWindow::fileParsingAnimations(QString myOutputFolder, QString from, QString to , QString file){
496  
497 <    QString command=this->commandMap.value("animations->"+from+"->"+to)+" "+myOutputFolder + " " + file ;
497 > QString MainWindow::fileParsingObjects(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){
498 >
499 >    QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder;
500  
501 <    if(ui->cbCamera->isChecked()){
502 <        command+=" "+this->commandMap.value("animations->"+ui->cbCamera->text());
501 >    //TODO: This can be optimized. When some are not enable others are.
502 >    if(ui->cbTexture->isChecked()){
503 >        if(ui->leTextureName->text().isEmpty()){
504 >            showErrStatusMessage("Checkbox '"+ui->cbTexture->text()+"' is selected. The file source cannot be empty.");
505 >            return "";
506 >        }
507 >        command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbTexture->text()) + ui->leTextureName->text();
508      }
509 <    else if(ui->cbGeometry->isChecked()){
510 <        if(ui->leGeometryName->text().isEmpty()){
511 <            showErrStatusMessage("Checkbox '"+ui->cbGeometry->text()+"' is selected. The geometry file path cannot be empty.");
509 >    else if(ui->cbWithAnimation->isChecked()){
510 >        if(ui->leAnimationName->text().isEmpty()){
511 >            showErrStatusMessage("Checkbox '"+ui->cbWithAnimation->text()+"' is selected. The file source cannot be empty.");
512              return "";
513          }
514 <        command+=" "+this->commandMap.value("animations->"+ui->cbGeometry->text()) + (ui->leGeometryName->text().startsWith('"')?ui->leGeometryName->text():Util::insertQuotes(ui->leGeometryName->text()));
514 >        command+=" "+Util::normalizeAndQuote(ui->leAnimationName->text()) + " " + this->commandMap.value(tabTitle+"->"+ui->cbWithAnimation->text()) + file;
515 >        return command;
516      }
517  
518 <    return command;
518 >    if(from=="OBAN ONI (cam)"){
519 >        command+=" -geom:camera";
520 >    }
521 >
522 >    return command+=" "+file; //add source
523   }
524  
525 < QString MainWindow::fileParsingLevels(QString myOutputFolder, QString from, QString to , QString file){
525 > QString MainWindow::fileParsingLevels(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){
526  
527      QString datName, command;
528  
529 <    command=this->commandMap.value("levels->"+from+"->"+to)+" "+myOutputFolder+" "+file;
529 >    if(!(from=="ONI FILES" && to=="DAT")){ // to all except this one
530 >
531 >        command=this->commandMap.value(tabTitle+"->"+from+"->"+to);
532 >
533 >        if(ui->cbSpecificFilesLevels->isChecked()){
534 >
535 >            if(ui->leSpecificFilesLevels->text().isEmpty()){
536 >                showErrStatusMessage("Checkbox '"+ui->cbSpecificFilesLevels->text()+"' is selected. The files pattern cannot be empty.");
537 >                return "";
538 >            }
539 >
540 >            command+=":"+ui->leSpecificFilesLevels->text();
541 >        }
542 >
543 >        if(from=="DAT" && to=="ONI FILES"){ // extract files to a subdir with the files name ex: level0_Final
544 >            command += " " + myOutputFolder.insert(myOutputFolder.size()-2,QString(Util::cutName(file)).replace(".dat","")) + " " + file;
545 >        }
546 >        else{
547 >            command+=" "+myOutputFolder+" "+file;
548 >        }
549  
550 <    if(from=="MASTER XML" && to=="DAT"){
530 <        command+=GlobalVars::OniSplitProcSeparator; //insert mark so we know this action will take 2 commands
550 >    }
551  
552 +    if((from=="ONI FILES" || from=="MASTER XML") && to=="DAT"){ // almost the same command for both
553          QString datName;
554 +
555 +        if(from=="MASTER XML"){
556 +            command+=GlobalVars::OniSplitProcSeparator; //insert mark so we know this action will take 2 commands
557 +        }
558 +
559          if(ui->cbDatLevels->isChecked()){
560              if(ui->leTargetDatLevels->text().isEmpty()){
561                  showErrStatusMessage("Checkbox '"+ui->cbDatLevels->text()+"' is selected. The name cannot be empty.");
# Line 541 | Line 567 | QString MainWindow::fileParsingLevels(QS
567              }
568          }
569          else{
570 <            datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::cutName(file).remove("/").replace(".xml",".dat",Qt::CaseInsensitive)); //if none iputted set the same name of input file
570 >            if(from=="ONI FILES"){
571 >                datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::cutName(file).remove("/")+".dat"); //if none iputted set the same name of input file
572 >            }
573 >            else if(from=="MASTER XML"){
574 >                datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::cutName(file).remove("/").replace(".xml",".dat",Qt::CaseInsensitive)); //if none iputted set the same name of input file
575 >            }
576          }
577 <
578 <        if(ui->actionWindows->isChecked()){ //is target plataform select windows?
579 <            command+=this->commandMap.value("general->ONI->"+to+"(PC)")+" "+myOutputFolder+" "+datName; //add second command
577 >        if(from=="ONI FILES"){
578 >            if(ui->actionWindows->isChecked()){ //is target plataform select windows?
579 >                return command=this->commandMap.value(tabTitle+"->"+from+"->"+to+"(PC)")+" "+ file + " "+datName;
580 >            }
581 >            else{
582 >                return command=this->commandMap.value(tabTitle+"->"+from+"->"+to+"(demoPCMAC)")+" "+ file + " "+datName;
583 >            }
584          }
585 <        else{
586 <            command+=this->commandMap.value("general->ONI->"+to+"(demoPCMAC)")+" "+myOutputFolder+" "+datName; //add second command
585 >        else if(from=="MASTER XML"){
586 >            if(ui->actionWindows->isChecked()){ //is target plataform select windows?
587 >                command+=this->commandMap.value(tabTitle+"->ONI FILES->"+to+"(PC)")+" "+myOutputFolder+" "+datName; //add second command
588 >            }
589 >            else{
590 >                command+=this->commandMap.value(tabTitle+"->ONI FILES->"+to+"(demoPCMAC)")+" "+myOutputFolder+" "+datName; //add second command
591 >            }
592          }
593      }
594  
# Line 574 | Line 614 | QString MainWindow::fileParsingLevels(QS
614  
615          //parse all files (separated by spaces)
616          while(true){
617 <            nextIndex=additionalFiles.indexOf(" ",currentIndex+1);
617 >            nextIndex=additionalFiles.indexOf(";",currentIndex+1);
618  
619              command += " "+Util::normalizeAndQuote(additionalFiles.mid(currentIndex,(nextIndex-currentIndex)));
620  
# Line 586 | Line 626 | QString MainWindow::fileParsingLevels(QS
626      }
627  
628      if(ui->cbGridsLevels->isChecked()){
629 <        command+=GlobalVars::OniSplitProcSeparator+this->commandMap.value("levels->"+ui->cbGridsLevels->text())+" "+Util::normalizeAndQuote(ui->leBnvLevels->text())+" "+file+" -out:"+myOutputFolder;
629 >        command+=GlobalVars::OniSplitProcSeparator+this->commandMap.value(tabTitle+"->"+ui->cbGridsLevels->text())+" "+Util::normalizeAndQuote(ui->leBnvLevels->text())+" "+file+" -out:"+myOutputFolder;
630      }
631  
632      return command;
# Line 615 | Line 655 | void MainWindow::addRowTable(DropTableWi
655      myTable->updateTableToolTips(twSize); //Update tool tips
656   }
657  
658 < void MainWindow::on_pbConvertGeneral_clicked()
658 > void MainWindow::on_pbConvertXML_clicked()
659   {
660 <    startConversion(ui->twSourcesGeneral);
660 >    startConversion(ui->twSourcesXML);
661   }
662  
663   void MainWindow::on_pbConvertTextures_clicked()
# Line 625 | Line 665 | void MainWindow::on_pbConvertTextures_cl
665      startConversion(ui->twSourcesTextures);
666   }
667  
668 < void MainWindow::on_pbConvertModels_clicked()
668 > void MainWindow::on_pbConvertObjects_clicked()
669   {
670 <    startConversion(ui->twSourcesModels);
670 >    startConversion(ui->twSourcesObjects);
671   }
672  
673 < void MainWindow::on_pbConvertAnimations_clicked()
673 > void MainWindow::on_pbConvertCharacters_clicked()
674   {
675 <    startConversion(ui->twSourcesAnimations);
675 >    startConversion(ui->twSourcesCharacters);
676   }
677  
678   void MainWindow::on_pbConvertLevels_clicked()
# Line 660 | Line 700 | void MainWindow::startConversion(DropTab
700          return;
701      }
702  
703 <    if(myBar->isVisible()){
703 >    if(this->myBar->isVisible()){
704          Util::showErrorPopUp("Another conversion is progress. Please wait until it finishes.");
705          return;
706      }
# Line 679 | Line 719 | void MainWindow::TsetupProgressBar(int m
719      this->myBar->setValue(0);
720      this->myBar->show();
721      this->myBar->setMaximum(max);
722 +    ui->tbAbortConversion->show();
723   }
724  
725   void  MainWindow::TupdateProgressBar(){
# Line 688 | Line 729 | void  MainWindow::TupdateProgressBar(){
729   void MainWindow::TresultConversion(QString result, int numErrors){
730      QApplication::alert(this); //Show a notification if window is not active
731      this->myBar->hide();
732 +    ui->tbAbortConversion->hide();
733  
734      if(numErrors!=0){
735          QString sNumErrors=QString::number(numErrors);
# Line 706 | Line 748 | void MainWindow::TresultConversion(QStri
748      }
749   }
750  
751 + void MainWindow::TconversionAborted(){
752 +    this->myBar->hide();
753 +    ui->tbAbortConversion->hide();
754 +
755 +    showErrStatusMessage("Conversion was aborted.");
756 + }
757 +
758   void MainWindow::showErrStatusMessage(QString message){
759  
760      QPalette myPalete = QPalette();
# Line 725 | Line 774 | void MainWindow::showSuccessStatusMessag
774   }
775  
776   void MainWindow::mapCommands(){
777 <    ////////////////////////////////////////////////////////////////////////General Commands
778 <    this->commandMap.insert("general->DAT->ONI","-export");
779 <    //this->commandMap.insert("general->ONI->DAT","-import"); //Not used.
731 <    this->commandMap.insert("general->ONI->DAT(PC)","-import:nosep");
732 <    this->commandMap.insert("general->ONI->DAT(demoPCMAC)","-import:sep");
733 <    this->commandMap.insert("general->ONI->XML","-extract:xml");
734 <    this->commandMap.insert("general->XML->ONI","-create");
777 >    ////////////////////////////////////////////////////////////////////////XML Commands
778 >    this->commandMap.insert("xml->ONI->XML","-extract:xml");
779 >    this->commandMap.insert("xml->XML->ONI","-create");
780      //######################General Options
781 <    this->commandMap.insert("general->"+ui->cbTRAMGeneral->text(),"-anim-body:");
781 >
782      //Possible Combinations
783 <    this->commandMap.insertMulti("general->DAT","ONI");
784 <    this->commandMap.insertMulti("general->ONI","DAT");
740 <    this->commandMap.insertMulti("general->ONI","XML");
741 <    this->commandMap.insertMulti("general->XML","ONI");
783 >    this->commandMap.insertMulti("xml->ONI","XML");
784 >    this->commandMap.insertMulti("xml->XML","ONI");
785  
786      ////////////////////////////////////////////////////////////////////////Textures Commands
787 <    this->commandMap.insert("textures->DAT / ONI->DDS","-extract:dds");
788 <    this->commandMap.insert("textures->DAT / ONI->TGA","-extract:tga");
789 <    this->commandMap.insert("textures->DAT / ONI->PNG","-extract:png");
790 <    this->commandMap.insert("textures->DAT / ONI->JPG","-extract:jpg");
791 <    this->commandMap.insert("textures->DDS / TGA / PNG / JPG->ONI","-create:txmp");
787 >    this->commandMap.insert("textures->DAT / TXMP ONI->DDS","-extract:dds");
788 >    this->commandMap.insert("textures->DAT / TXMP ONI->TGA","-extract:tga");
789 >    this->commandMap.insert("textures->DAT / TXMP ONI->PNG","-extract:png");
790 >    this->commandMap.insert("textures->DAT / TXMP ONI->JPG","-extract:jpg");
791 >    this->commandMap.insert("textures->TGA / DDS / PNG / JPG->TXMP ONI","-create:txmp");
792      //######################Textures Options
793      this->commandMap.insert("textures->"+ui->rbBGR32->text(),"-format:bgr32");
794      this->commandMap.insert("textures->"+ui->rbBGRA32->text(),"-format:bgra32");
# Line 759 | Line 802 | void MainWindow::mapCommands(){
802      this->commandMap.insert("textures->"+ui->cbLarge->text(),"-large");
803      this->commandMap.insert("textures->"+ui->cbEnvMap->text(),"-envmap:");
804      //Possible Combinations
805 <    this->commandMap.insertMulti("textures->DAT / ONI","DDS");
806 <    this->commandMap.insertMulti("textures->DAT / ONI","TGA");
807 <    this->commandMap.insertMulti("textures->DAT / ONI","PNG");
808 <    this->commandMap.insertMulti("textures->DAT / ONI","JPG");
809 <    this->commandMap.insertMulti("textures->DDS / TGA / PNG / JPG","ONI");
810 <
811 <    ////////////////////////////////////////////////////////////////////////Models Commands
812 <    this->commandMap.insert("models->ONI->OBJ","-extract:obj");
813 <    this->commandMap.insert("models->ONI->DAE","-extract:dae -search "+Util::insertQuotes(this->AeLocation+"/GameDataFolder/level0_Final"));
814 <    this->commandMap.insert("models->OBJ->ONI","-create:m3gm");
815 <    this->commandMap.insert("models->DAE->ONI","-create:trbs");
816 <    //######################Models Options
817 <    this->commandMap.insert("models->"+ui->cbCellShading->text(),"-cel");
818 <    this->commandMap.insert("models->"+ui->cbNormals->text(),"-normals");
819 <    this->commandMap.insert("models->"+ui->cbTexture->text(),"-tex:");
820 <    this->commandMap.insert("models->"+ui->cbWithAnimation->text(),"-anim:");
821 <    this->commandMap.insert("models->No Animation","-noanim"); //No label with this name so can't be dynamic
805 >    this->commandMap.insertMulti("textures->DAT / TXMP ONI","TGA");
806 >    this->commandMap.insertMulti("textures->DAT / TXMP ONI","DDS");
807 >    this->commandMap.insertMulti("textures->DAT / TXMP ONI","PNG");
808 >    this->commandMap.insertMulti("textures->DAT / TXMP ONI","JPG");
809 >    this->commandMap.insertMulti("textures->TGA / DDS / PNG / JPG","TXMP ONI");
810 >
811 >    ////////////////////////////////////////////////////////////////////////Characters Commands
812 >    this->commandMap.insert("characters->TRAM ONI->XML / XML & DAE","-extract:xml");
813 >    this->commandMap.insert("characters->TRBS / ONCC ONI->DAE","-extract:dae");
814 >    this->commandMap.insert("characters->TRBS XML->TRBS ONI","-create");
815 >    this->commandMap.insert("characters->TRBS DAE->TRBS ONI","-create:trbs");
816 >    this->commandMap.insert("characters->FILM DAT->XML","film2xml");
817 >
818 >    //######################Characters Options
819 >    this->commandMap.insert("characters->"+ui->cbWithTRBS_ONCC->text(),"-anim-body:");
820 >    this->commandMap.insert("characters->"+ui->cbCellShading->text(),"-cel");
821 >    this->commandMap.insert("characters->"+ui->cbNormals->text(),"-normals");
822      //Possible Combinations
823 <    this->commandMap.insertMulti("models->ONI","OBJ");
824 <    this->commandMap.insertMulti("models->ONI","DAE");
825 <    this->commandMap.insertMulti("models->OBJ","ONI");
826 <    this->commandMap.insertMulti("models->DAE","ONI");
827 <
828 <    ////////////////////////////////////////////////////////////////////////Animations Commands
829 <    this->commandMap.insert("animations->ONI->DAE","-extract:dae");
830 <    this->commandMap.insert("animations->FILM DAT->XML","film2xml");
831 <    //######################Animations Options
832 <    this->commandMap.insert("animations->"+ui->cbCamera->text(),"-geom:camera");
833 <    this->commandMap.insert("animations->"+ui->cbGeometry->text(),"-geom:");
823 >    this->commandMap.insertMulti("characters->TRAM ONI","XML / XML & DAE");
824 >    this->commandMap.insertMulti("characters->TRBS / ONCC ONI","DAE");
825 >    this->commandMap.insertMulti("characters->DAE","TRBS ONI");
826 >    this->commandMap.insertMulti("characters->TRBS DAE","TRBS ONI");
827 >    this->commandMap.insertMulti("characters->TRBS XML","TRBS ONI");
828 >    this->commandMap.insertMulti("characters->FILM DAT","XML");
829 >
830 >    ////////////////////////////////////////////////////////////////////////Objects Commands
831 >    this->commandMap.insert("objects->M3GM ONI->OBJ","-extract:obj");
832 >    this->commandMap.insert("objects->M3GM ONI->DAE","-extract:dae");
833 >    this->commandMap.insert("objects->ONWC ONI->OBJ","-extract:obj");
834 >    this->commandMap.insert("objects->ONWC ONI->DAE","-extract:dae");
835 >    this->commandMap.insert("objects->OBAN ONI (cam)->DAE","-extract:dae");
836 >    this->commandMap.insert("objects->OBJ->M3GM ONI","-create:m3gm");
837 >    //######################Characters Options
838 >    this->commandMap.insert("objects->"+ui->cbTexture->text(),"-tex:");
839 >    this->commandMap.insert("objects->"+ui->cbWithAnimation->text(),"-geom:");
840      //Possible Combinations
841 <    this->commandMap.insertMulti("animations->ONI","DAE");
842 <    this->commandMap.insertMulti("animations->DAE","ONI");
843 <    this->commandMap.insertMulti("animations->FILM DAT","XML");
841 >    this->commandMap.insertMulti("objects->M3GM ONI","OBJ");
842 >    this->commandMap.insertMulti("objects->M3GM ONI","DAE");
843 >    this->commandMap.insertMulti("objects->ONWC ONI","OBJ");
844 >    this->commandMap.insertMulti("objects->ONWC ONI","DAE");
845 >    this->commandMap.insertMulti("objects->OBAN ONI (cam)","DAE");
846 >    this->commandMap.insertMulti("objects->OBJ","M3GM ONI");
847 >
848  
849      ////////////////////////////////////////////////////////////////////////Levels Commands
850 <    this->commandMap.insert("levels->ONI->DAE","-extract:dae -search "+Util::insertQuotes(this->AeLocation+"/GameDataFolder/level0_Final"));
851 <    this->commandMap.insert("levels->DAE->ONI","-create:akev");
850 >    this->commandMap.insert("levels->DAT->ONI FILES","-export");
851 >    //this->commandMap.insert("levels->ONI FILES->DAT","-import"); //Not used.
852 >    this->commandMap.insert("levels->ONI FILES->DAT(PC)","-import:nosep");
853 >    this->commandMap.insert("levels->ONI FILES->DAT(demoPCMAC)","-import:sep");
854 >    this->commandMap.insert("levels->AKEV ONI->DAE","-extract:dae");
855 >    this->commandMap.insert("levels->DAE->AKEV ONI","-create:akev");
856      this->commandMap.insert("levels->MASTER XML->DAT","-create:level");
857      this->commandMap.insert("levels->MASTER XML->ONI FILES","-create:level");
858      //######################Levels Options
859      this->commandMap.insert("levels->"+ui->cbGridsLevels->text(),"-grid:create");
860      //Possible Combinations
861 <    this->commandMap.insertMulti("levels->ONI","DAE");
862 <    this->commandMap.insertMulti("levels->DAE","ONI");
861 >    this->commandMap.insertMulti("levels->DAT","ONI FILES");
862 >    this->commandMap.insertMulti("levels->ONI FILES","DAT");
863 >    this->commandMap.insertMulti("levels->AKEV ONI","DAE");
864 >    this->commandMap.insertMulti("levels->DAE","AKEV ONI");
865      this->commandMap.insertMulti("levels->MASTER XML","DAT");
866      this->commandMap.insertMulti("levels->MASTER XML","ONI FILES");
867  
868      ////////////////////////////////////////////////////////////////////////Misc Commands
869 <    this->commandMap.insert("misc->DAT / ONI->WAV","-extract:wav");
870 <    this->commandMap.insert("misc->DAT / ONI->AIF","-extract:aif");
871 <    this->commandMap.insert("misc->DAT / ONI->TXT","-extract:txt");
872 <    this->commandMap.insert("misc->WAV / AIF->ONI","-create");
873 <    this->commandMap.insert("misc->TXT->ONI","-create:subt");
869 >    this->commandMap.insert("misc->DAT / SNDD ONI->WAV","-extract:wav");
870 >    this->commandMap.insert("misc->DAT / SNDD ONI->AIF","-extract:aif");
871 >    this->commandMap.insert("misc->DAT / SUBT ONI->TXT","-extract:txt");
872 >    this->commandMap.insert("misc->WAV / AIF->SNDD ONI","-create");
873 >    this->commandMap.insert("misc->TXT->SUBT ONI","-create:subt");
874      //Possible Combinations
875 <    this->commandMap.insertMulti("misc->DAT / ONI","WAV");
876 <    this->commandMap.insertMulti("misc->DAT / ONI","AIF");
877 <    this->commandMap.insertMulti("misc->DAT / ONI","TXT");
878 <    this->commandMap.insertMulti("misc->WAV / AIF","ONI");
879 <    this->commandMap.insertMulti("misc->TXT","ONI");
875 >    this->commandMap.insertMulti("misc->DAT / SNDD ONI","WAV");
876 >    this->commandMap.insertMulti("misc->DAT / SNDD ONI","AIF");
877 >    this->commandMap.insertMulti("misc->DAT / SUBT ONI","TXT");
878 >    this->commandMap.insertMulti("misc->WAV / AIF","SNDD ONI");
879 >    this->commandMap.insertMulti("misc->TXT","SUBT ONI");
880  
881   }
882  
883 < void MainWindow::on_cbFromGeneral_currentIndexChanged(const QString &arg1)
883 > void MainWindow::on_cbFromXML_currentIndexChanged(const QString &arg1)
884   {
885 <    updateComboBox(arg1, ui->cbToGeneral, "general");
885 >    updateComboBox(arg1, ui->cbToXML);
886   }
887  
888 +
889   void MainWindow::on_cbFromTextures_currentIndexChanged(const QString &arg1)
890   {
891      //Options are only used for DAT/ONI -> Image
# Line 836 | Line 896 | void MainWindow::on_cbFromTextures_curre
896          ui->gbTextures->setEnabled(true);
897      }
898  
899 <    updateComboBox(arg1, ui->cbToTextures, "textures");
899 >    updateComboBox(arg1, ui->cbToTextures);
900   }
901  
902 < void MainWindow::on_cbFromModels_currentIndexChanged(const QString &arg1)
902 > void MainWindow::on_cbFromObjects_currentIndexChanged(const QString &arg1)
903   {
844
845    ui->cbCellShading->setEnabled(false);
846    ui->cbCellShading->setChecked(false);
847    ui->cbNormals->setEnabled(false);
848    ui->cbNormals->setChecked(false);
904      ui->cbTexture->setEnabled(false);
905      ui->cbTexture->setChecked(false);
906      ui->cbWithAnimation->setEnabled(false);
907      ui->cbWithAnimation->setChecked(false);
908  
909 <    if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){ //case sensitive is faster
910 <        ui->cbTexture->setEnabled(true);
909 >    if(QString::compare(arg1,"M3GM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
910 >        ui->cbWithAnimation->setEnabled(true);
911      }
912 <    else if(QString::compare(arg1,"DAE",Qt::CaseSensitive)==0){
913 <        ui->cbCellShading->setEnabled(true);
859 <        ui->cbNormals->setEnabled(true);
912 >    else if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){
913 >        ui->cbTexture->setEnabled(true);
914      }
915  
916 <    updateComboBox(arg1, ui->cbToModels, "models");
916 >    updateComboBox(arg1, ui->cbToObjects);
917   }
918  
919 < void MainWindow::on_cbFromAnimations_currentIndexChanged(const QString &arg1)
919 > void MainWindow::on_cbFromCharacters_currentIndexChanged(const QString &arg1)
920   {
921 <    ui->cbCamera->setEnabled(false);
922 <    ui->cbCamera->setChecked(false);
923 <    ui->cbGeometry->setEnabled(false);
924 <    ui->cbGeometry->setChecked(false);
921 >    ui->cbWithTRBS_ONCC->setEnabled(false);
922 >    ui->cbWithTRBS_ONCC->setChecked(false);
923 >    ui->cbCellShading->setEnabled(false);
924 >    ui->cbCellShading->setChecked(false);
925 >    ui->cbNormals->setEnabled(false);
926 >    ui->cbNormals->setChecked(false);
927  
928 <    if(QString::compare(arg1,"ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
929 <        ui->cbCamera->setEnabled(true);
930 <        ui->cbGeometry->setEnabled(true);
928 >    if(QString::compare(arg1,"TRAM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
929 >        ui->cbWithTRBS_ONCC->setEnabled(true);
930 >    }
931 >    else if(QString::compare(arg1,"TRBS DAE",Qt::CaseSensitive)==0){
932 >        ui->cbNormals->setEnabled(true);
933 >        ui->cbCellShading->setEnabled(true);
934      }
935  
936 <    updateComboBox(arg1, ui->cbToAnimations, "animations");
936 >    updateComboBox(arg1, ui->cbToCharacters);
937   }
938  
939   void MainWindow::on_cbFromLevels_currentIndexChanged(const QString &arg1)
940   {
941 <    updateComboBox(arg1, ui->cbToLevels, "levels");
941 >
942 >    ui->cbSpecificFilesLevels->setEnabled(false);
943 >    ui->cbSpecificFilesLevels->setChecked(false);
944 >    ui->cbDatLevels->setEnabled(false);
945 >    ui->cbDatLevels->setChecked(false);
946 >    ui->cbBnvLevels->setEnabled(false);
947 >    ui->cbBnvLevels->setChecked(false);
948 >    ui->cbAdditionalSourcesLevels->setEnabled(false);
949 >    ui->cbAdditionalSourcesLevels->setChecked(false);
950 >    ui->cbGridsLevels->setEnabled(false);
951 >    ui->cbGridsLevels->setChecked(false);
952 >
953 >    if(arg1=="DAT"){ //case sensitive is faster
954 >        ui->cbSpecificFilesLevels->setEnabled(true);
955 >    }
956 >    else if(arg1=="ONI FILES"){ //case sensitive is faster
957 >        ui->cbDatLevels->setEnabled(true);
958 >    }
959 >    else if(arg1=="DAE"){
960 >        ui->cbBnvLevels->setEnabled(true);
961 >        ui->cbAdditionalSourcesLevels->setEnabled(true);
962 >    }
963 >
964 >    updateComboBox(arg1, ui->cbToLevels);
965   }
966  
967   void MainWindow::on_cbFromMisc_currentIndexChanged(const QString &arg1)
968   {
969 <    updateComboBox(arg1, ui->cbToMisc, "misc");
969 >    updateComboBox(arg1, ui->cbToMisc);
970   }
971  
972 < void MainWindow::updateComboBox(const QString &arg1, QComboBox *comboBox, const QString &identifier){
972 > void MainWindow::updateComboBox(const QString &arg1, QComboBox *comboBox){
973 >    QString identifier=ui->tabWidget->tabText(ui->tabWidget->currentIndex()).toLower(); // get current tab title text (lower case)
974 >
975      comboBox->clear();
976  
977      QStringList toUpdate=QStringList();
# Line 914 | Line 998 | void MainWindow::on_actionMac_Windows_de
998      ui->actionWindows->setChecked(false);
999   }
1000  
1001 < void MainWindow::on_pbRemoveSourceGeneral_clicked()
1001 > void MainWindow::on_pbRemoveSourceXML_clicked()
1002   {
1003 <    removeTableContents( ui->twSourcesGeneral);
1003 >    removeTableContents( ui->twSourcesXML);
1004   }
1005  
1006   void MainWindow::on_pbRemoveSourceTextures_clicked()
# Line 924 | Line 1008 | void MainWindow::on_pbRemoveSourceTextur
1008      removeTableContents(ui->twSourcesTextures);
1009   }
1010  
1011 < void MainWindow::on_pbRemoveSourceModels_clicked()
1011 > void MainWindow::on_pbRemoveSourceObjects_clicked()
1012   {
1013 <    removeTableContents(ui->twSourcesModels);
1013 >    removeTableContents(ui->twSourcesObjects);
1014   }
1015  
1016 < void MainWindow::on_pbRemoveSourceAnimations_clicked()
1016 > void MainWindow::on_pbRemoveSourceCharacters_clicked()
1017   {
1018 <    removeTableContents(ui->twSourcesAnimations);
1018 >    removeTableContents(ui->twSourcesCharacters);
1019   }
1020  
1021   void MainWindow::on_pbRemoveSourceLevels_clicked()
# Line 944 | Line 1028 | void MainWindow::on_pbRemoveSourceMisc_c
1028      removeTableContents(ui->twSourcesMisc);
1029   }
1030  
1031 < void MainWindow::on_pbClearSourcesGeneral_clicked()
1031 > void MainWindow::on_pbClearSourcesXML_clicked()
1032   {
1033 <    clearTableContents(ui->twSourcesGeneral);
1033 >    clearTableContents(ui->twSourcesXML);
1034   }
1035  
1036   void MainWindow::on_pbClearSourcesTextures_clicked()
# Line 954 | Line 1038 | void MainWindow::on_pbClearSourcesTextur
1038      clearTableContents(ui->twSourcesTextures);
1039   }
1040  
1041 < void MainWindow::on_pbClearSourcesModels_clicked()
1041 > void MainWindow::on_pbClearSourcesObjects_clicked()
1042   {
1043 <    clearTableContents(ui->twSourcesModels);
1043 >    clearTableContents(ui->twSourcesObjects);
1044   }
1045  
1046 < void MainWindow::on_pbClearSourcesAnimations_clicked()
1046 > void MainWindow::on_pbClearSourcesCharacters_clicked()
1047   {
1048 <    clearTableContents(ui->twSourcesAnimations);
1048 >    clearTableContents(ui->twSourcesCharacters);
1049   }
1050  
1051   void MainWindow::on_pbClearSourcesLevels_clicked()
# Line 977 | Line 1061 | void MainWindow::on_pbClearSourcesMisc_c
1061   void MainWindow::removeTableContents(DropTableWidget *myTable){
1062      int size = myTable->selectionModel()->selectedRows().size();
1063  
1064 +    QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os
1065 +
1066      if(size==0){
1067          Util::showPopUp("Select a row first.");
1068          return;
1069      }
1070  
1071 <    if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){
1071 > #ifdef Q_OS_MAC
1072 >    if(this->useYesAsDefaultWhenRemovingItems){
1073 >        defaultButton = QMessageBox::Yes;
1074 >    }
1075 >    else{
1076 >        defaultButton = QMessageBox::No;
1077 >    }
1078 > #endif
1079 >
1080 >
1081 >    if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?",defaultButton)){
1082          for(int i=0; i<size; i++){
1083              //myTable->removeRow(myTable->selectedItems().at(size-i-1)->row());
1084              myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row());
# Line 992 | Line 1088 | void MainWindow::removeTableContents(Dro
1088   }
1089  
1090   void MainWindow::clearTableContents(DropTableWidget *myTable){
1091 +
1092 +    QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os
1093 +
1094      if(myTable->rowCount()==0){
1095          Util::showPopUp("Nothing to clear.");
1096          return;
1097      }
1098  
1099 <    if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?")){
1099 > #ifdef Q_OS_MAC
1100 >    if(this->useYesAsDefaultWhenRemovingItems){
1101 >        defaultButton = QMessageBox::Yes;
1102 >    }
1103 >    else{
1104 >        defaultButton = QMessageBox::No;
1105 >    }
1106 > #endif
1107 >
1108 >    if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){
1109          myTable->clearContents();
1110          myTable->setRowCount(0);
1111      }
# Line 1021 | Line 1129 | void MainWindow::closeEvent(QCloseEvent
1129      }
1130   }
1131  
1024 void MainWindow::on_cbToGeneral_currentIndexChanged(const QString &arg1)
1025 {
1026
1027    ui->cbDatGeneral->setEnabled(false);
1028    ui->cbDatGeneral->setChecked(false);
1029    ui->cbTRAMGeneral->setEnabled(false);
1030    ui->cbTRAMGeneral->setChecked(false);
1031
1032    if(QString::compare(ui->cbFromGeneral->currentText(),"ONI",Qt::CaseSensitive)==0){
1033        if(QString::compare(arg1,"DAT",Qt::CaseSensitive)==0){
1034            ui->cbDatGeneral->setEnabled(true);
1035        }
1036        else{
1037            ui->cbTRAMGeneral->setEnabled(true);
1038        }
1039    }
1040
1041 }
1042
1043 void MainWindow::on_cbToModels_currentIndexChanged(const QString &arg1)
1044 {
1045    ui->cbWithAnimation->setEnabled(false);
1046    ui->cbWithAnimation->setChecked(false);
1047
1048    if(arg1=="DAE"){
1049        ui->cbWithAnimation->setEnabled(true);
1050    }
1051 }
1052
1132   void MainWindow::on_cbToLevels_currentIndexChanged(const QString &arg1)
1133   {
1134  
1056    ui->cbDatLevels->setEnabled(false);
1057    ui->cbDatLevels->setChecked(false);
1058    ui->cbBnvLevels->setEnabled(false);
1059    ui->cbBnvLevels->setChecked(false);
1060    ui->cbAdditionalSourcesLevels->setEnabled(false);
1061    ui->cbAdditionalSourcesLevels->setChecked(false);
1062    ui->cbGridsLevels->setEnabled(false);
1063    ui->cbGridsLevels->setChecked(false);
1064
1135      if(ui->cbFromLevels->currentText()=="MASTER XML" && arg1=="DAT"){
1136          ui->cbDatLevels->setEnabled(true);
1137      }
1138 <    else if(ui->cbFromLevels->currentText()=="DAE" && arg1=="ONI"){
1139 <        ui->cbBnvLevels->setEnabled(true);
1140 <        ui->cbAdditionalSourcesLevels->setEnabled(true);
1138 >    else if(ui->cbFromLevels->currentText()=="MASTER XML" && arg1=="ONI FILES"){
1139 >        ui->cbDatLevels->setEnabled(false);
1140 >        ui->cbDatLevels->setChecked(false);
1141      }
1072 }
1073
1074 void MainWindow::on_cbDatGeneral_toggled(bool checked)
1075 {
1076    ui->leTargetDatGeneral->setEnabled(checked);
1077 }
1142  
1079 void MainWindow::on_cbTRAMGeneral_toggled(bool checked)
1080 {
1081    ui->leTRAMGeneral->setEnabled(checked);
1082    if(checked){
1083        QString file=QFileDialog::getOpenFileName(this,"Choose the TRAM.oni file...","./" , "All Files (*.*)");
1084        if(!file.isEmpty()){
1085            ui->leTRAMGeneral->setText(file);
1086        }
1087    }
1143   }
1144  
1145   void MainWindow::on_cbDatLevels_toggled(bool checked)
# Line 1125 | Line 1180 | void MainWindow::on_cbAdditionalSourcesL
1180      }
1181   }
1182  
1183 + void MainWindow::on_cbWithTRBS_ONCC_toggled(bool checked)
1184 + {
1185 +    ui->leTRBS_ONCC->setEnabled(checked);
1186 + }
1187 +
1188   void MainWindow::on_actionCheck_OniSplit_version_triggered()
1189   {
1190      QProcess *myProcess = new QProcess();
1191 +    myProcess->setWorkingDirectory(this->AppDir);
1192      myProcess->start(GlobalVars::OniSplitExeName+" -version");
1193      myProcess->waitForFinished(-1);
1194      QString result=myProcess->readAllStandardOutput();
# Line 1138 | Line 1199 | void MainWindow::on_actionCheck_OniSplit
1199   void MainWindow::on_actionCheck_xmlTools_version_triggered()
1200   {
1201      QProcess *myProcess = new QProcess();
1202 +    myProcess->setWorkingDirectory(this->AppDir);
1203      myProcess->start(GlobalVars::XmlToolsExeName+" version");
1204      myProcess->waitForFinished(-1);
1205      QString result=myProcess->readLine();
# Line 1147 | Line 1209 | void MainWindow::on_actionCheck_xmlTools
1209  
1210   /**
1211    Update items loaded
1212 <  **/
1213 < void MainWindow::on_tabWidget_selected(const QString &arg1)
1212 > **/
1213 > void MainWindow::on_tabWidget_currentChanged(int index)
1214   {
1215 <    if(arg1.compare("General",Qt::CaseSensitive)==0){ //case sentive is faster
1216 <        updateItemsLoaded(ui->twSourcesGeneral);
1215 >    QString tabtext = ui->tabWidget->tabText(index);
1216 >
1217 >    if(tabtext.compare("XML",Qt::CaseSensitive)==0){ //case sentive is faster
1218 >        updateItemsLoaded(ui->twSourcesXML);
1219      }
1220 <    else if(arg1.compare("Textures",Qt::CaseSensitive)==0){
1220 >    else if(tabtext.compare("Textures",Qt::CaseSensitive)==0){
1221          updateItemsLoaded(ui->twSourcesTextures);
1222      }
1223 <    else if(arg1.compare("Models",Qt::CaseSensitive)==0){
1224 <        updateItemsLoaded(ui->twSourcesModels);
1223 >    else if(tabtext.compare("Characters",Qt::CaseSensitive)==0){
1224 >        updateItemsLoaded(ui->twSourcesCharacters);
1225 >    }
1226 >    else if(tabtext.compare("Objects",Qt::CaseSensitive)==0){
1227 >        updateItemsLoaded(ui->twSourcesObjects);
1228      }
1229 <    else if(arg1.compare("Levels",Qt::CaseSensitive)==0){
1229 >    else if(tabtext.compare("Levels",Qt::CaseSensitive)==0){
1230          updateItemsLoaded(ui->twSourcesLevels);
1231      }
1232      else{
# Line 1220 | Line 1287 | void MainWindow::on_actionView_log_trigg
1287      Util::openLogFile();
1288   }
1289  
1290 + void MainWindow::on_actionOpen_AE_folder_triggered()
1291 + {
1292 +    QDesktopServices::openUrl(QUrl("file:///"+this->AeLocation));
1293 + }
1294 +
1295   QString MainWindow::getTypeConversion(DropTableWidget *myTable){
1296      QString from,to;
1297  
1298 <    if(myTable==ui->twSourcesGeneral){
1299 <        from=ui->cbFromGeneral->currentText();
1300 <        to=ui->cbToGeneral->currentText();
1298 >    if(myTable==ui->twSourcesXML){
1299 >        from=ui->cbFromXML->currentText();
1300 >        to=ui->cbToXML->currentText();
1301      }
1302      else if(myTable==ui->twSourcesTextures){
1303          from=ui->cbFromTextures->currentText();
1304          to=ui->cbToTextures->currentText();
1305      }
1306 <    else if(myTable==ui->twSourcesModels){
1307 <        from=ui->cbFromModels->currentText();
1308 <        to=ui->cbToModels->currentText();
1309 <    }
1310 <    else if(myTable==ui->twSourcesAnimations){
1311 <        from=ui->cbFromAnimations->currentText();
1312 <        to=ui->cbToAnimations->currentText();
1306 >    else if(myTable==ui->twSourcesObjects){
1307 >        from=ui->cbFromObjects->currentText();
1308 >        to=ui->cbToObjects->currentText();
1309 >    }
1310 >    else if(myTable==ui->twSourcesCharacters){
1311 >        from=ui->cbFromCharacters->currentText();
1312 >        to=ui->cbToCharacters->currentText();
1313      }
1314      else if(myTable==ui->twSourcesLevels){
1315          from=ui->cbFromLevels->currentText();
# Line 1463 | Line 1535 | void MainWindow::changeItemsOutput(DropT
1535   }
1536  
1537   QString MainWindow::getCommand(DropTableWidget* myTable, QString myOutputFolder, QString from, QString to , QString file){
1538 <    if(myTable==ui->twSourcesGeneral){ //So we only need to parse one command.
1539 <        return fileParsingGeneral(myOutputFolder,from,to,file);
1538 >
1539 >    QString tabTitle=ui->tabWidget->tabText(ui->tabWidget->currentIndex()).toLower(); // get current tab title
1540 >
1541 >    if(myTable==ui->twSourcesXML){ //So we only need to parse one command.
1542 >        return fileParsingXML(tabTitle, myOutputFolder,from,to,file);
1543      }
1544      else if(myTable==ui->twSourcesTextures){
1545 <        return fileParsingTextures(myOutputFolder,from,to,file);
1545 >        return fileParsingTextures(tabTitle, myOutputFolder,from,to,file);
1546      }
1547 <    else if(myTable==ui->twSourcesModels){
1548 <        return fileParsingModels(myOutputFolder,from,to,file);
1547 >    else if(myTable==ui->twSourcesObjects){
1548 >        return fileParsingObjects(tabTitle, myOutputFolder,from,to,file);
1549      }
1550 <    else if(myTable==ui->twSourcesAnimations){
1551 <        return fileParsingAnimations(myOutputFolder,from,to,file);
1550 >    else if(myTable==ui->twSourcesCharacters){
1551 >        return fileParsingCharacters(tabTitle, myOutputFolder,from,to,file);
1552      }
1553      else if(myTable==ui->twSourcesLevels){
1554 <        return fileParsingLevels(myOutputFolder,from,to,file);
1554 >        return fileParsingLevels(tabTitle, myOutputFolder,from,to,file);
1555      }
1556      else{
1557          return fileParsingMisc(myOutputFolder,from,to,file);
# Line 1488 | Line 1563 | QString MainWindow::getCommand(DropTable
1563    This is OS indepented. It maintain size ratio over the Windows and Mac.
1564    **/
1565   void MainWindow::setConverterButtonsSize(){
1566 <    int height=ui->pbConvertGeneral->sizeHint().height()*1.3;
1567 <    ui->pbConvertGeneral->setMinimumHeight(height);
1566 >    int height=ui->pbConvertXML->sizeHint().height()*1.3;
1567 >    ui->pbConvertXML->setMinimumHeight(height);
1568      ui->pbConvertTextures->setMinimumHeight(height);
1569 <    ui->pbConvertModels->setMinimumHeight(height);
1570 <    ui->pbConvertAnimations->setMinimumHeight(height);
1569 >    ui->pbConvertObjects->setMinimumHeight(height);
1570 >    ui->pbConvertCharacters->setMinimumHeight(height);
1571      ui->pbConvertLevels->setMinimumHeight(height);
1572      ui->pbConvertMisc->setMinimumHeight(height);
1573   }
1574  
1575 + /**
1576 +  Gets application directory. In mac os gets the .app directory
1577 +  **/
1578 + QString MainWindow::getOSIndependentAppPath(){
1579 + #ifdef Q_OS_MAC
1580 +    QDir dir = QDir(QCoreApplication::applicationDirPath());
1581 +    if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it
1582 +        dir.cdUp();
1583 +        dir.cdUp();
1584 +        dir.cdUp();
1585 +    }
1586 +    return dir.absolutePath();
1587 + #else
1588 +    return  QDir::currentPath();
1589 + #endif
1590 + }
1591 +
1592   void MainWindow::connectSlots(){
1593  
1594      //This signal is for thread that is working setup the progress bar (make it visible and set it's min-max)
# Line 1508 | Line 1600 | void MainWindow::connectSlots(){
1600      //This signal is for thread that is working can show the result of a conversion
1601      connect(myConverter, SIGNAL(resultConversion(QString,int)), this, SLOT(TresultConversion(QString,int)));
1602  
1603 +    //This signal is for thread that is working notify the gui thread that the conversion was aborted with sucess
1604 +    connect(myConverter, SIGNAL(conversionAborted()), this, SLOT(TconversionAborted()));
1605 +
1606 +    // This signal is to the user be able to terminate a conversion (OniSplit process in class myConverter will be terminated)
1607 +    connect(this, SIGNAL(terminateCurrProcess()), myConverter, SLOT(terminateCurrProcess()));
1608 +
1609      //Drop signal for General table
1610 <    connect(ui->twSourcesGeneral, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1610 >    connect(ui->twSourcesXML, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1611  
1612      //Drop signal for Textures table
1613      connect(ui->twSourcesTextures, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1614  
1615 <    //Drop signal for Models table
1616 <    connect(ui->twSourcesModels, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1615 >    //Drop signal for Objects table
1616 >    connect(ui->twSourcesObjects, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1617  
1618 <    //Drop signal for Animations table
1619 <    connect(ui->twSourcesAnimations, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1618 >    //Drop signal for Characters table
1619 >    connect(ui->twSourcesCharacters, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1620  
1621      //Drop signal for Levels table
1622      connect(ui->twSourcesLevels, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
# Line 1527 | Line 1625 | void MainWindow::connectSlots(){
1625      connect(ui->twSourcesMisc, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList)));
1626  
1627      //Context menu for General table
1628 <    connect(ui->twSourcesGeneral, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1628 >    connect(ui->twSourcesXML, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1629  
1630      //Context menu for Textures table
1631      connect(ui->twSourcesTextures, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1632  
1633 <    //Context menu for Models table
1634 <    connect(ui->twSourcesModels, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1633 >    //Context menu for Objects table
1634 >    connect(ui->twSourcesObjects, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1635  
1636 <    //Context menu for Animations table
1637 <    connect(ui->twSourcesAnimations, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1636 >    //Context menu for Characters table
1637 >    connect(ui->twSourcesCharacters, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1638  
1639      //Context menu for Levels table
1640      connect(ui->twSourcesLevels, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
# Line 1544 | Line 1642 | void MainWindow::connectSlots(){
1642      //Context menu for Misc table
1643      connect(ui->twSourcesMisc, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*)));
1644   }
1547
1548

Diff Legend

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