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