| 1 | 
 #include "mainwindow.h" | 
 
 
 
 
 
 | 2 | 
 #include "ui_mainwindow.h" | 
 
 
 
 
 
 | 3 | 
  | 
 
 
 
 
 
 | 4 | 
 const QString MainWindow::VagoSettingsName = "settingsVago.ini"; | 
 
 
 
 
 
 | 5 | 
  | 
 
 
 
 
 
 | 6 | 
 MainWindow::MainWindow(QWidget *parent) : | 
 
 
 
 
 
 | 7 | 
     QMainWindow(parent), | 
 
 
 
 
 
 | 8 | 
     ui(new Ui::MainWindow) | 
 
 
 
 
 
 | 9 | 
 { | 
 
 
 
 
 
 | 10 | 
     ui->setupUi(this); | 
 
 
 
 
 
 | 11 | 
  | 
 
 
 
 
 
 | 12 | 
     this->setWindowTitle("Vago v"+GlobalVars::AppVersion); | 
 
 
 
 
 
 | 13 | 
  | 
 
 
 
 
 
 | 14 | 
     if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitString)){ | 
 
 
 
 
 
 | 15 | 
         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."); | 
 
 
 
 
 
 | 16 | 
         exit(1); | 
 
 
 
 
 
 | 17 | 
     } | 
 
 
 
 
 
 | 18 | 
  | 
 
 
 
 
 
 | 19 | 
     if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsString)){ | 
 
 
 
 
 
 | 20 | 
         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."); | 
 
 
 
 
 
 | 21 | 
         exit(1); | 
 
 
 
 
 
 | 22 | 
     } | 
 
 
 
 
 
 | 23 | 
  | 
 
 
 
 
 
 | 24 | 
     this->vagoSettings = new QSettings(QDir::currentPath() + "/" + this->VagoSettingsName, QSettings::IniFormat); | 
 
 
 
 
 
 | 25 | 
  | 
 
 
 
 
 
 | 26 | 
     //First Execution? Old configuration? Settings missed? | 
 
 
 
 
 
 | 27 | 
     bool iniChanged=false; | 
 
 
 
 
 
 | 28 | 
     if(!this->vagoSettings->contains("VagoVersion") || this->vagoSettings->value("VagoVersion")!=GlobalVars::AppVersion){ | 
 
 
 
 
 
 | 29 | 
         this->vagoSettings->setValue("VagoVersion", GlobalVars::AppVersion); | 
 
 
 
 
 
 | 30 | 
         iniChanged=true; | 
 
 
 
 
 
 | 31 | 
     } | 
 
 
 
 
 
 | 32 | 
     if(!this->vagoSettings->contains("Workspace")){ | 
 
 
 
 
 
 | 33 | 
         this->vagoSettings->setValue("Workspace", QDir::currentPath()+"/VagoWorkspace"); | 
 
 
 
 
 
 | 34 | 
         iniChanged=true; | 
 
 
 
 
 
 | 35 | 
     } | 
 
 
 
 
 
 | 36 | 
     if(!this->vagoSettings->contains("AeFolder")){ | 
 
 
 
 
 
 | 37 | 
  | 
 
 
 
 
 
 | 38 | 
         Util::showPopUp("Seems it's the first time you are executing Vago. \n\nPlease input your Anniversary Edition (AE) Folder."); | 
 
 
 
 
 
 | 39 | 
         QString aefolder=Util::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder...")); | 
 
 
 
 
 
 | 40 | 
  | 
 
 
 
 
 
 | 41 | 
         if(aefolder.isEmpty()){ | 
 
 
 
 
 
 | 42 | 
             Util::showErrorPopUp("AE folder is mandatory. Application will now exit."); | 
 
 
 
 
 
 | 43 | 
             exit(1); | 
 
 
 
 
 
 | 44 | 
         } | 
 
 
 
 
 
 | 45 | 
  | 
 
 
 
 
 
 | 46 | 
         if(!aefolder.endsWith("AE")){ | 
 
 
 
 
 
 | 47 | 
             Util::showWarningPopUp("Seems the folder you selected isn't called 'AE'. \n\nIf you run in any problems you can always change it in Vago preferences window."); | 
 
 
 
 
 
 | 48 | 
         } | 
 
 
 
 
 
 | 49 | 
  | 
 
 
 
 
 
 | 50 | 
         this->vagoSettings->setValue("AeFolder", aefolder); | 
 
 
 
 
 
 | 51 | 
         iniChanged=true; | 
 
 
 
 
 
 | 52 | 
     } | 
 
 
 
 
 
 | 53 | 
     if(!this->vagoSettings->contains("OniWindow")){ | 
 
 
 
 
 
 | 54 | 
         this->vagoSettings->setValue("OniWindow", true); | 
 
 
 
 
 
 | 55 | 
         iniChanged=true; | 
 
 
 
 
 
 | 56 | 
     } | 
 
 
 
 
 
 | 57 | 
     if(!this->vagoSettings->contains("SeparateInWorkspace")){ | 
 
 
 
 
 
 | 58 | 
         this->vagoSettings->setValue("SeparateInWorkspace",true); | 
 
 
 
 
 
 | 59 | 
         iniChanged=true; | 
 
 
 
 
 
 | 60 | 
     } | 
 
 
 
 
 
 | 61 | 
     if(!this->vagoSettings->contains("ConfirmExit")){ | 
 
 
 
 
 
 | 62 | 
         this->vagoSettings->setValue("ConfirmExit", false); | 
 
 
 
 
 
 | 63 | 
         iniChanged=true; | 
 
 
 
 
 
 | 64 | 
     } | 
 
 
 
 
 
 | 65 | 
  | 
 
 
 
 
 
 | 66 | 
     if(iniChanged){ | 
 
 
 
 
 
 | 67 | 
         this->vagoSettings->sync(); | 
 
 
 
 
 
 | 68 | 
     } | 
 
 
 
 
 
 | 69 | 
     /// | 
 
 
 
 
 
 | 70 | 
  | 
 
 
 
 
 
 | 71 | 
     this->workspaceLocation=this->vagoSettings->value("Workspace").toString(); | 
 
 
 
 
 
 | 72 | 
     this->workspaceWizardsLocation=this->workspaceLocation+"/Wizards"; | 
 
 
 
 
 
 | 73 | 
     this->AeLocation=this->vagoSettings->value("AeFolder").toString(); | 
 
 
 
 
 
 | 74 | 
     this->outputFolder=this->workspaceLocation; | 
 
 
 
 
 
 | 75 | 
  | 
 
 
 
 
 
 | 76 | 
     //Create our workspace if it doesn't exists yet | 
 
 
 
 
 
 | 77 | 
     if(!QDir(this->workspaceLocation).exists()){ | 
 
 
 
 
 
 | 78 | 
         QDir().mkdir(this->workspaceLocation); | 
 
 
 
 
 
 | 79 | 
     } | 
 
 
 
 
 
 | 80 | 
     this->itemsLoaded=new QLabel(this); | 
 
 
 
 
 
 | 81 | 
     ui->statusBar->addWidget(this->itemsLoaded); | 
 
 
 
 
 
 | 82 | 
     this->myBar = new QProgressBar(this); | 
 
 
 
 
 
 | 83 | 
     this->myBar->setTextVisible(false); //hides text | 
 
 
 
 
 
 | 84 | 
  | 
 
 
 
 
 
 | 85 | 
     this->myBar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed); | 
 
 
 
 
 
 | 86 | 
     this->myBar->setMinimumWidth(150); | 
 
 
 
 
 
 | 87 | 
     this->myBar->hide(); //hide while not being used | 
 
 
 
 
 
 | 88 | 
  | 
 
 
 
 
 
 | 89 | 
     ui->statusBar->addPermanentWidget(myBar); //this adds automatically in right | 
 
 
 
 
 
 | 90 | 
  | 
 
 
 
 
 
 | 91 | 
     this->myLogger = new Logger(); //start logger | 
 
 
 
 
 
 | 92 | 
  | 
 
 
 
 
 
 | 93 | 
     //Initialize list pointers | 
 
 
 
 
 
 | 94 | 
     this->listToProccess = new QStringList; | 
 
 
 
 
 
 | 95 | 
  | 
 
 
 
 
 
 | 96 | 
     //Create a thread for do the conversion in background | 
 
 
 
 
 
 | 97 | 
     this->myConverter = new Converter(this->myLogger,this->listToProccess); | 
 
 
 
 
 
 | 98 | 
  | 
 
 
 
 
 
 | 99 | 
     // User interface | 
 
 
 
 
 
 | 100 | 
     ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button | 
 
 
 
 
 
 | 101 | 
     ui->mainToolBar->addWidget(ui->emptySpacerLabel); //trick, we can't add directly a space so we add an empty | 
 
 
 
 
 
 | 102 | 
     ui->mainToolBar->addWidget(ui->tbOni); //add oni launch buttonlabel | 
 
 
 
 
 
 | 103 | 
     ui->mainToolBar->addWidget(ui->emptySpacerLabel2); //same as before | 
 
 
 
 
 
 | 104 | 
     ui->mainToolBar->addWidget(ui->tbCommand); //add option to manual onisplit commands | 
 
 
 
 
 
 | 105 | 
     ui->mainToolBar->addWidget(ui->emptySpacerLabel3); //same as before | 
 
 
 
 
 
 | 106 | 
     ui->mainToolBar->addWidget(ui->tbOpenFolder); //add option to open folder with files converted etc | 
 
 
 
 
 
 | 107 | 
  | 
 
 
 
 
 
 | 108 | 
     ui->mainToolBar->setLayoutDirection(Qt::RightToLeft); | 
 
 
 
 
 
 | 109 | 
  | 
 
 
 
 
 
 | 110 | 
     setConverterButtonsSize(); | 
 
 
 
 
 
 | 111 | 
  | 
 
 
 
 
 
 | 112 | 
 #ifdef Q_WS_MAC | 
 
 
 
 
 
 | 113 | 
     // 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 | 
 
 
 
 
 
 | 114 | 
     ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows | 
 
 
 
 
 
 | 115 | 
     // Set mac platform the first one in the menu, and also make it checkable by default | 
 
 
 
 
 
 | 116 | 
     ui->menuTarget_Platform->removeAction(ui->actionWindows); | 
 
 
 
 
 
 | 117 | 
     ui->menuTarget_Platform->addAction(ui->actionWindows); | 
 
 
 
 
 
 | 118 | 
     ui->actionWindows->setChecked(false); | 
 
 
 
 
 
 | 119 | 
     ui->actionMac_Windows_demo->setChecked(true); | 
 
 
 
 
 
 | 120 | 
 #endif | 
 
 
 
 
 
 | 121 | 
  | 
 
 
 
 
 
 | 122 | 
     connectSlots(); | 
 
 
 
 
 
 | 123 | 
  | 
 
 
 
 
 
 | 124 | 
     //Commands Mapping | 
 
 
 
 
 
 | 125 | 
     this->commandMap = QHash<QString, QString>(); | 
 
 
 
 
 
 | 126 | 
     mapCommands(); | 
 
 
 
 
 
 | 127 | 
  | 
 
 
 
 
 
 | 128 | 
     updateItemsLoaded(ui->twSourcesGeneral); | 
 
 
 
 
 
 | 129 | 
  | 
 
 
 
 
 
 | 130 | 
     this->myLogger->writeString("Application started."); | 
 
 
 
 
 
 | 131 | 
 } | 
 
 
 
 
 
 | 132 | 
  | 
 
 
 
 
 
 | 133 | 
 MainWindow::~MainWindow() | 
 
 
 
 
 
 | 134 | 
 { | 
 
 
 
 
 
 | 135 | 
     delete ui; | 
 
 
 
 
 
 | 136 | 
     this->myLogger->writeString("Application Exited."); | 
 
 
 
 
 
 | 137 | 
 } | 
 
 
 
 
 
 | 138 | 
  | 
 
 
 
 
 
 | 139 | 
 void MainWindow::on_actionExit_triggered() | 
 
 
 
 
 
 | 140 | 
 { | 
 
 
 
 
 
 | 141 | 
     close(); | 
 
 
 
 
 
 | 142 | 
 } | 
 
 
 
 
 
 | 143 | 
  | 
 
 
 
 
 
 | 144 | 
 void MainWindow::on_actionAbout_triggered() | 
 
 
 
 
 
 | 145 | 
 { | 
 
 
 
 
 
 | 146 | 
     //Show preferences | 
 
 
 
 
 
 | 147 | 
     About *aboutWindow = new About(this); | 
 
 
 
 
 
 | 148 | 
     aboutWindow->show(); //it destroys itself when finished. | 
 
 
 
 
 
 | 149 | 
 } | 
 
 
 
 
 
 | 150 | 
  | 
 
 
 
 
 
 | 151 | 
 void MainWindow::on_actionAE_Package_Creator_triggered() | 
 
 
 
 
 
 | 152 | 
 { | 
 
 
 
 
 
 | 153 | 
     PackageWizard myWizard = PackageWizard(this->workspaceWizardsLocation, this->vagoSettings, this->myLogger); | 
 
 
 
 
 
 | 154 | 
     myWizard.exec(); | 
 
 
 
 
 
 | 155 | 
 } | 
 
 
 
 
 
 | 156 | 
  | 
 
 
 
 
 
 | 157 | 
 void MainWindow::on_actionSound_Wizard_triggered() | 
 
 
 
 
 
 | 158 | 
 { | 
 
 
 
 
 
 | 159 | 
     SoundWizard myWizard (this->workspaceWizardsLocation, this->myLogger, &this->commandMap); | 
 
 
 
 
 
 | 160 | 
     myWizard.exec(); | 
 
 
 
 
 
 | 161 | 
 } | 
 
 
 
 
 
 | 162 | 
  | 
 
 
 
 
 
 | 163 | 
 void MainWindow::on_tbOni_clicked() | 
 
 
 
 
 
 | 164 | 
 { | 
 
 
 
 
 
 | 165 | 
     QStringList arguments; | 
 
 
 
 
 
 | 166 | 
  | 
 
 
 
 
 
 | 167 | 
     if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window? | 
 
 
 
 
 
 | 168 | 
         arguments << "-noswitch"; | 
 
 
 
 
 
 | 169 | 
     } | 
 
 
 
 
 
 | 170 | 
 #ifdef Q_WS_WIN | 
 
 
 
 
 
 | 171 | 
     else{ | 
 
 
 
 
 
 | 172 | 
         arguments << "-switch"; // only supported on windows. Was added by daodan dll. | 
 
 
 
 
 
 | 173 | 
     } | 
 
 
 
 
 
 | 174 | 
 #endif | 
 
 
 
 
 
 | 175 | 
  | 
 
 
 
 
 
 | 176 | 
     arguments << "-debugfiles"; | 
 
 
 
 
 
 | 177 | 
  | 
 
 
 
 
 
 | 178 | 
     if(!QProcess::startDetached(this->AeLocation+"/"+GlobalVars::OniExe,arguments,this->AeLocation)){ | 
 
 
 
 
 
 | 179 | 
         showErrStatusMessage("Oni could not be started!"); | 
 
 
 
 
 
 | 180 | 
     } | 
 
 
 
 
 
 | 181 | 
 } | 
 
 
 
 
 
 | 182 | 
  | 
 
 
 
 
 
 | 183 | 
 void MainWindow::on_tbAE_clicked() | 
 
 
 
 
 
 | 184 | 
 { | 
 
 
 
 
 
 | 185 | 
     // If the app turn out someday to a native app use QProcess::startDetached instead... | 
 
 
 
 
 
 | 186 | 
  | 
 
 
 
 
 
 | 187 | 
     if(!QDesktopServices::openUrl("file:///"+this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){ | 
 
 
 
 
 
 | 188 | 
         showErrStatusMessage("Could not start AE Installer!"); | 
 
 
 
 
 
 | 189 | 
     } | 
 
 
 
 
 
 | 190 | 
 } | 
 
 
 
 
 
 | 191 | 
  | 
 
 
 
 
 
 | 192 | 
 void MainWindow::on_tbOpenFolder_clicked() | 
 
 
 
 
 
 | 193 | 
 { | 
 
 
 
 
 
 | 194 | 
     QDesktopServices::openUrl(QUrl("file:///"+this->outputFolder)); | 
 
 
 
 
 
 | 195 | 
 } | 
 
 
 
 
 
 | 196 | 
  | 
 
 
 
 
 
 | 197 | 
 void MainWindow::on_cbEnvMap_toggled(bool checked) | 
 
 
 
 
 
 | 198 | 
 { | 
 
 
 
 
 
 | 199 | 
     ui->leEnvMapTexture->setEnabled(checked); | 
 
 
 
 
 
 | 200 | 
 } | 
 
 
 
 
 
 | 201 | 
  | 
 
 
 
 
 
 | 202 | 
 void MainWindow::on_cbTexture_toggled(bool checked) | 
 
 
 
 
 
 | 203 | 
 { | 
 
 
 
 
 
 | 204 | 
     ui->leTextureName->setEnabled(checked); | 
 
 
 
 
 
 | 205 | 
 } | 
 
 
 
 
 
 | 206 | 
  | 
 
 
 
 
 
 | 207 | 
 void MainWindow::on_cbWithAnimation_toggled(bool checked) | 
 
 
 
 
 
 | 208 | 
 { | 
 
 
 
 
 
 | 209 | 
     ui->leAnimationName->setEnabled(checked); | 
 
 
 
 
 
 | 210 | 
 } | 
 
 
 
 
 
 | 211 | 
  | 
 
 
 
 
 
 | 212 | 
 void MainWindow::on_cbCamera_toggled(bool checked) | 
 
 
 
 
 
 | 213 | 
 { | 
 
 
 
 
 
 | 214 | 
     if(checked){ | 
 
 
 
 
 
 | 215 | 
         ui->cbGeometry->setChecked(false); | 
 
 
 
 
 
 | 216 | 
     } | 
 
 
 
 
 
 | 217 | 
 } | 
 
 
 
 
 
 | 218 | 
  | 
 
 
 
 
 
 | 219 | 
 void MainWindow::on_cbGeometry_toggled(bool checked) | 
 
 
 
 
 
 | 220 | 
 { | 
 
 
 
 
 
 | 221 | 
     ui->leGeometryName->setEnabled(checked); | 
 
 
 
 
 
 | 222 | 
     if(checked){ | 
 
 
 
 
 
 | 223 | 
         ui->cbCamera->setChecked(false); | 
 
 
 
 
 
 | 224 | 
     } | 
 
 
 
 
 
 | 225 | 
 } | 
 
 
 
 
 
 | 226 | 
  | 
 
 
 
 
 
 | 227 | 
 void MainWindow::on_actionCheck_For_Updates_triggered() | 
 
 
 
 
 
 | 228 | 
 { | 
 
 
 
 
 
 | 229 | 
  | 
 
 
 
 
 
 | 230 | 
     //let's check in the web if this version is the latest | 
 
 
 
 
 
 | 231 | 
     QNetworkAccessManager *manager = new QNetworkAccessManager(this); | 
 
 
 
 
 
 | 232 | 
     connect(manager, SIGNAL(finished(QNetworkReply*)), | 
 
 
 
 
 
 | 233 | 
             this, SLOT(checkVagoLastVersion(QNetworkReply*))); | 
 
 
 
 
 
 | 234 | 
  | 
 
 
 
 
 
 | 235 | 
     manager->get(QNetworkRequest(QUrl(GlobalVars::VagoCheckUpdatesUrl))); | 
 
 
 
 
 
 | 236 | 
  | 
 
 
 
 
 
 | 237 | 
 } | 
 
 
 
 
 
 | 238 | 
  | 
 
 
 
 
 
 | 239 | 
 void MainWindow::checkVagoLastVersion(QNetworkReply *result){ | 
 
 
 
 
 
 | 240 | 
  | 
 
 
 
 
 
 | 241 | 
     if(result->error()==QNetworkReply::NoError){ | 
 
 
 
 
 
 | 242 | 
         QScriptEngine engine; | 
 
 
 
 
 
 | 243 | 
         QScriptValue sc = engine.evaluate("(" + QString(result->readAll()) + ")"); | 
 
 
 
 
 
 | 244 | 
  | 
 
 
 
 
 
 | 245 | 
         // "field_version":{"und":[{"value":"0.6a","format":null,"safe_value":"0.6a"}]} //Note the use of [{}] which means it's a array of 1 element with one object inside (so the use of [0] bellow | 
 
 
 
 
 
 | 246 | 
  | 
 
 
 
 
 
 | 247 | 
         QString newVersion = sc.property("field_version").toObject().property("und").toObject().property("0").toObject().property("value").toString(); | 
 
 
 
 
 
 | 248 | 
  | 
 
 
 
 
 
 | 249 | 
         if(newVersion!=GlobalVars::AppVersion){ | 
 
 
 
 
 
 | 250 | 
             Util::showRichPopUp("There's a new version of Vago! (v"+newVersion+")<br/><br/>"+ | 
 
 
 
 
 
 | 251 | 
                                 "You can download it <a href='"+GlobalVars::VagoWebUrl+"'>here</a>."); | 
 
 
 
 
 
 | 252 | 
         } | 
 
 
 
 
 
 | 253 | 
         else{ | 
 
 
 
 
 
 | 254 | 
             Util::showPopUp("You are using last version."); | 
 
 
 
 
 
 | 255 | 
         } | 
 
 
 
 
 
 | 256 | 
     } | 
 
 
 
 
 
 | 257 | 
     else{ | 
 
 
 
 
 
 | 258 | 
         Util::showErrorPopUp("An error occurred checking last version:\n\n"+result->errorString()); | 
 
 
 
 
 
 | 259 | 
     } | 
 
 
 
 
 
 | 260 | 
     result->deleteLater(); | 
 
 
 
 
 
 | 261 | 
 } | 
 
 
 
 
 
 | 262 | 
  | 
 
 
 
 
 
 | 263 | 
 void MainWindow::on_pbAddSourceGeneral_clicked() | 
 
 
 
 
 
 | 264 | 
 { | 
 
 
 
 
 
 | 265 | 
     if(QString::compare(ui->cbFromGeneral->currentText(),"ONI",Qt::CaseSensitive)==0 && QString::compare(ui->cbToGeneral->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster) | 
 
 
 
 
 
 | 266 | 
         addFilesSource(ui->twSourcesGeneral,Util::multipleDirDialog("Choose folders with ONIs...")); | 
 
 
 
 
 
 | 267 | 
     } | 
 
 
 
 
 
 | 268 | 
     else{ | 
 
 
 
 
 
 | 269 | 
         addFilesSource( ui->twSourcesGeneral,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 
 | 270 | 
     } | 
 
 
 
 
 
 | 271 | 
 } | 
 
 
 
 
 
 | 272 | 
  | 
 
 
 
 
 
 | 273 | 
 void MainWindow::on_pbAddSourceTextures_clicked() | 
 
 
 
 
 
 | 274 | 
 { | 
 
 
 
 
 
 | 275 | 
     addFilesSource( ui->twSourcesTextures, QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 
 | 276 | 
 } | 
 
 
 
 
 
 | 277 | 
  | 
 
 
 
 
 
 | 278 | 
 void MainWindow::on_pbAddSourceModels_clicked() | 
 
 
 
 
 
 | 279 | 
 { | 
 
 
 
 
 
 | 280 | 
     addFilesSource( ui->twSourcesModels,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 
 | 281 | 
 } | 
 
 
 
 
 
 | 282 | 
  | 
 
 
 
 
 
 | 283 | 
 void MainWindow::on_pbAddSourceAnimations_clicked() | 
 
 
 
 
 
 | 284 | 
 { | 
 
 
 
 
 
 | 285 | 
     addFilesSource( ui->twSourcesAnimations,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 
 | 286 | 
 } | 
 
 
 
 
 
 | 287 | 
  | 
 
 
 
 
 
 | 288 | 
 void MainWindow::on_pbAddSourceLevels_clicked() | 
 
 
 
 
 
 | 289 | 
 { | 
 
 
 
 
 
 | 290 | 
     addFilesSource( ui->twSourcesLevels,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 
 | 291 | 
 } | 
 
 
 
 
 
 | 292 | 
  | 
 
 
 
 
 
 | 293 | 
 void MainWindow::on_pbAddSourceMisc_clicked() | 
 
 
 
 
 
 | 294 | 
 { | 
 
 
 
 
 
 | 295 | 
     addFilesSource( ui->twSourcesMisc,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 
 | 296 | 
 } | 
 
 
 
 
 
 | 297 | 
  | 
 
 
 
 
 
 | 298 | 
 QString MainWindow::getFileOutputFolder(QString fromTo, QString myOutputFolder){ | 
 
 
 
 
 
 | 299 | 
  | 
 
 
 
 
 
 | 300 | 
     if(myOutputFolder==""){ //We may want to change to a non standart location with context menu | 
 
 
 
 
 
 | 301 | 
         myOutputFolder=this->outputFolder; | 
 
 
 
 
 
 | 302 | 
     } | 
 
 
 
 
 
 | 303 | 
  | 
 
 
 
 
 
 | 304 | 
     if(this->vagoSettings->value("SeparateInWorkspace").toBool() && myOutputFolder==this->workspaceLocation){ | 
 
 
 
 
 
 | 305 | 
         myOutputFolder+="/"+ui->tabWidget->tabText(ui->tabWidget->currentIndex()); | 
 
 
 
 
 
 | 306 | 
         myOutputFolder+="/"+QString(fromTo).replace(" / ","_").replace(" > "," - "); | 
 
 
 
 
 
 | 307 | 
     } | 
 
 
 
 
 
 | 308 | 
     return Util::insertQuotes(myOutputFolder+"/"); | 
 
 
 
 
 
 | 309 | 
 } | 
 
 
 
 
 
 | 310 | 
  | 
 
 
 
 
 
 | 311 | 
 void MainWindow::addFilesSource(DropTableWidget *myTable, QStringList files){ | 
 
 
 
 
 
 | 312 | 
  | 
 
 
 
 
 
 | 313 | 
     //Get Conversion pretended | 
 
 
 
 
 
 | 314 | 
     QString from,to; | 
 
 
 
 
 
 | 315 | 
  | 
 
 
 
 
 
 | 316 | 
     QString fromTo = getTypeConversion(myTable); | 
 
 
 
 
 
 | 317 | 
  | 
 
 
 
 
 
 | 318 | 
     from = QString(fromTo).remove(fromTo.indexOf(" >"),fromTo.size()-1); //parse the string to get the from, only 1 time parsed by each group of files = very fast | 
 
 
 
 
 
 | 319 | 
     to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> " | 
 
 
 
 
 
 | 320 | 
  | 
 
 
 
 
 
 | 321 | 
     //Pre-processing (check if the files/folders received are valid), e.g. check for ONI->DAT if are only given folders and not files | 
 
 
 
 
 
 | 322 | 
     if(QString::compare(from,"ONI",Qt::CaseSensitive)==0 && QString::compare(to,"DAT",Qt::CaseSensitive)==0){ | 
 
 
 
 
 
 | 323 | 
         //check if it's a folder | 
 
 
 
 
 
 | 324 | 
         foreach(QString myFile, files){ | 
 
 
 
 
 
 | 325 | 
             if(!QDir(myFile).exists()){ | 
 
 
 
 
 
 | 326 | 
                 showErrStatusMessage("Only folders are allowed for this operation."); | 
 
 
 
 
 
 | 327 | 
                 return; | 
 
 
 
 
 
 | 328 | 
             } | 
 
 
 
 
 
 | 329 | 
         } | 
 
 
 
 
 
 | 330 | 
  | 
 
 
 
 
 
 | 331 | 
     } | 
 
 
 
 
 
 | 332 | 
     else{ | 
 
 
 
 
 
 | 333 | 
         foreach(QString myFile, files){ | 
 
 
 
 
 
 | 334 | 
             //check if it's a file | 
 
 
 
 
 
 | 335 | 
             if(QDir(myFile).exists()){ | 
 
 
 
 
 
 | 336 | 
                 showErrStatusMessage("Only files are allowed for this operation."); | 
 
 
 
 
 
 | 337 | 
                 return; | 
 
 
 
 
 
 | 338 | 
             } | 
 
 
 
 
 
 | 339 | 
         } | 
 
 
 
 
 
 | 340 | 
     } | 
 
 
 
 
 
 | 341 | 
  | 
 
 
 
 
 
 | 342 | 
     //Build command | 
 
 
 
 
 
 | 343 | 
     QString command, lastFileName; | 
 
 
 
 
 
 | 344 | 
  | 
 
 
 
 
 
 | 345 | 
     QString myOutputFolder=getFileOutputFolder(fromTo); | 
 
 
 
 
 
 | 346 | 
  | 
 
 
 
 
 
 | 347 | 
     //if folder doesn't exist onisplit will create it for us :) | 
 
 
 
 
 
 | 348 | 
     foreach(QString currentFile, files){ | 
 
 
 
 
 
 | 349 | 
  | 
 
 
 
 
 
 | 350 | 
         currentFile=Util::normalizeAndQuote(currentFile); //insert quotes ("") in file | 
 
 
 
 
 
 | 351 | 
  | 
 
 
 
 
 
 | 352 | 
         if(lastFileName.isEmpty()){ //Optimization: all commands are the same for each file, just replace the filename | 
 
 
 
 
 
 | 353 | 
  | 
 
 
 
 
 
 | 354 | 
             command=getCommand(myTable,myOutputFolder,from,to,currentFile); | 
 
 
 
 
 
 | 355 | 
  | 
 
 
 
 
 
 | 356 | 
             if(command.isEmpty()){ //something wrong was happening (not inputted a texture name?) | 
 
 
 
 
 
 | 357 | 
                 return; //stop adding files | 
 
 
 
 
 
 | 358 | 
             } | 
 
 
 
 
 
 | 359 | 
             currentFile=Util::cutName(currentFile); | 
 
 
 
 
 
 | 360 | 
         }else{ //one parsing was already made just replace the filename by the old one in the command | 
 
 
 
 
 
 | 361 | 
  | 
 
 
 
 
 
 | 362 | 
             currentFile=Util::cutName(currentFile); | 
 
 
 
 
 
 | 363 | 
  | 
 
 
 
 
 
 | 364 | 
             command.replace(lastFileName,currentFile,Qt::CaseSensitive); //case sentive is faster | 
 
 
 
 
 
 | 365 | 
         } | 
 
 
 
 
 
 | 366 | 
  | 
 
 
 
 
 
 | 367 | 
         lastFileName=currentFile; | 
 
 
 
 
 
 | 368 | 
  | 
 
 
 
 
 
 | 369 | 
         addRowTable(myTable,lastFileName,fromTo,command); | 
 
 
 
 
 
 | 370 | 
     } | 
 
 
 
 
 
 | 371 | 
     updateItemsLoaded(myTable); | 
 
 
 
 
 
 | 372 | 
 } | 
 
 
 
 
 
 | 373 | 
  | 
 
 
 
 
 
 | 374 | 
 QString MainWindow::fileParsingGeneral(QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 
 | 375 | 
  | 
 
 
 
 
 
 | 376 | 
     QString command; | 
 
 
 
 
 
 | 377 | 
  | 
 
 
 
 
 
 | 378 | 
     if(QString::compare(from,"ONI",Qt::CaseSensitive)==0 && QString::compare(to,"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster | 
 
 
 
 
 
 | 379 | 
  | 
 
 
 
 
 
 | 380 | 
         QString datName; | 
 
 
 
 
 
 | 381 | 
  | 
 
 
 
 
 
 | 382 | 
         if(ui->cbDatGeneral->isChecked()){ | 
 
 
 
 
 
 | 383 | 
             if(ui->leTargetDatGeneral->text().isEmpty()){ | 
 
 
 
 
 
 | 384 | 
                 showErrStatusMessage("Checkbox '"+ui->cbDatGeneral->text()+"' is selected. The name cannot be empty."); | 
 
 
 
 
 
 | 385 | 
                 return ""; | 
 
 
 
 
 
 | 386 | 
             } | 
 
 
 
 
 
 | 387 | 
             datName+=QString(myOutputFolder).insert(myOutputFolder.size()-1,ui->leTargetDatGeneral->text()); //set name inputted by user | 
 
 
 
 
 
 | 388 | 
             if(!ui->leTargetDatGeneral->text().toUpper().endsWith(".DAT")){ | 
 
 
 
 
 
 | 389 | 
                 datName.insert(datName.size()-1,".dat"); //append extension if necessary (-1 to maintain final quote) | 
 
 
 
 
 
 | 390 | 
             } | 
 
 
 
 
 
 | 391 | 
         } | 
 
 
 
 
 
 | 392 | 
         else{ | 
 
 
 
 
 
 | 393 | 
             datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::cutName(file).remove("/")+".dat"); //if none iputted set the same name of input file | 
 
 
 
 
 
 | 394 | 
         } | 
 
 
 
 
 
 | 395 | 
  | 
 
 
 
 
 
 | 396 | 
         if(ui->actionWindows->isChecked()){ //is target plataform select windows? | 
 
 
 
 
 
 | 397 | 
             return command=this->commandMap.value("general->"+from+"->"+to+"(PC)")+" "+ file + " "+datName; | 
 
 
 
 
 
 | 398 | 
         } | 
 
 
 
 
 
 | 399 | 
         else{ | 
 
 
 
 
 
 | 400 | 
             return command=this->commandMap.value("general->"+from+"->"+to+"(demoPCMAC)")+" "+ file + " "+datName; | 
 
 
 
 
 
 | 401 | 
         } | 
 
 
 
 
 
 | 402 | 
     } | 
 
 
 
 
 
 | 403 | 
     else if(QString::compare(from,"ONI",Qt::CaseSensitive)==0 && QString::compare(to,"XML",Qt::CaseSensitive)==0 && ui->cbTRAMGeneral->isChecked()){ | 
 
 
 
 
 
 | 404 | 
         if(ui->leTRAMGeneral->text().isEmpty()){ | 
 
 
 
 
 
 | 405 | 
             showErrStatusMessage("Checkbox '"+ui->cbTRAMGeneral->text()+"' is selected. The source cannot be empty."); | 
 
 
 
 
 
 | 406 | 
             return ""; | 
 
 
 
 
 
 | 407 | 
         } | 
 
 
 
 
 
 | 408 | 
         return command=this->commandMap.value("general->"+from+"->"+to)+" "+myOutputFolder+" "+this->commandMap.value("general->"+ui->cbTRAMGeneral->text())+file + " "+ Util::normalizeAndQuote(ui->leTRAMGeneral->text()); | 
 
 
 
 
 
 | 409 | 
     } | 
 
 
 
 
 
 | 410 | 
     else{ | 
 
 
 
 
 
 | 411 | 
         return command=this->commandMap.value("general->"+from+"->"+to)+" "+myOutputFolder+" "+file; | 
 
 
 
 
 
 | 412 | 
     } | 
 
 
 
 
 
 | 413 | 
  | 
 
 
 
 
 
 | 414 | 
 } | 
 
 
 
 
 
 | 415 | 
  | 
 
 
 
 
 
 | 416 | 
 QString MainWindow::fileParsingTextures(QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 
 | 417 | 
  | 
 
 
 
 
 
 | 418 | 
     QString command=this->commandMap.value("textures->"+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()); | 
 
 
 
 
 
 | 424 | 
         } | 
 
 
 
 
 
 | 425 | 
  | 
 
 
 
 
 
 | 426 | 
         if(ui->cbNoUwrap->isChecked()){ | 
 
 
 
 
 
 | 427 | 
             command+=" "+this->commandMap.value("textures->"+ui->cbNoUwrap->text()); | 
 
 
 
 
 
 | 428 | 
         } | 
 
 
 
 
 
 | 429 | 
  | 
 
 
 
 
 
 | 430 | 
         if(ui->cbNoVwrap->isChecked()){ | 
 
 
 
 
 
 | 431 | 
             command+=" "+this->commandMap.value("textures->"+ui->cbNoVwrap->text()); | 
 
 
 
 
 
 | 432 | 
         } | 
 
 
 
 
 
 | 433 | 
  | 
 
 
 
 
 
 | 434 | 
         if(ui->cbLarge->isChecked()){ | 
 
 
 
 
 
 | 435 | 
             command+=" "+this->commandMap.value("textures->"+ui->cbLarge->text()); | 
 
 
 
 
 
 | 436 | 
         } | 
 
 
 
 
 
 | 437 | 
  | 
 
 
 
 
 
 | 438 | 
         if(ui->rbBGR32->isChecked()){ | 
 
 
 
 
 
 | 439 | 
             command+=" "+this->commandMap.value("textures->"+ui->rbBGR32->text()); | 
 
 
 
 
 
 | 440 | 
         } | 
 
 
 
 
 
 | 441 | 
         else if(ui->rbBGRA32->isChecked()){ | 
 
 
 
 
 
 | 442 | 
             command+=" "+this->commandMap.value("textures->"+ui->rbBGRA32->text()); | 
 
 
 
 
 
 | 443 | 
         } | 
 
 
 
 
 
 | 444 | 
         else if(ui->rbBGR555->isChecked()){ | 
 
 
 
 
 
 | 445 | 
             command+=" "+this->commandMap.value("textures->"+ui->rbBGR555->text()); | 
 
 
 
 
 
 | 446 | 
         } | 
 
 
 
 
 
 | 447 | 
         else if(ui->rbBGRA5551->isChecked()){ | 
 
 
 
 
 
 | 448 | 
             command+=" "+this->commandMap.value("textures->"+ui->rbBGRA5551->text()); | 
 
 
 
 
 
 | 449 | 
         } | 
 
 
 
 
 
 | 450 | 
         else if(ui->rbBGRA444->isChecked()){ | 
 
 
 
 
 
 | 451 | 
             command+=" "+this->commandMap.value("textures->"+ui->rbBGRA444->text()); | 
 
 
 
 
 
 | 452 | 
         } | 
 
 
 
 
 
 | 453 | 
         else{ //dxt1 checked | 
 
 
 
 
 
 | 454 | 
             command+=" "+this->commandMap.value("textures->"+ui->rbDxt1->text()); | 
 
 
 
 
 
 | 455 | 
         } | 
 
 
 
 
 
 | 456 | 
  | 
 
 
 
 
 
 | 457 | 
         if(ui->cbEnvMap->isChecked()){ | 
 
 
 
 
 
 | 458 | 
             if(ui->leEnvMapTexture->text().isEmpty()){ | 
 
 
 
 
 
 | 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); | 
 
 
 
 
 
 | 463 | 
         } | 
 
 
 
 
 
 | 464 | 
     } | 
 
 
 
 
 
 | 465 | 
  | 
 
 
 
 
 
 | 466 | 
     return command+=" "+file; //add source | 
 
 
 
 
 
 | 467 | 
 } | 
 
 
 
 
 
 | 468 | 
  | 
 
 
 
 
 
 | 469 | 
 QString MainWindow::fileParsingModels(QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 
 | 470 | 
  | 
 
 
 
 
 
 | 471 | 
     QString command=this->commandMap.value("models->"+from+"->"+to)+" "+myOutputFolder; | 
 
 
 
 
 
 | 472 | 
  | 
 
 
 
 
 
 | 473 | 
     //TODO: This can be optimized. When some are not enable others are. | 
 
 
 
 
 
 | 474 | 
     if(ui->cbTexture->isChecked()){ | 
 
 
 
 
 
 | 475 | 
         if(ui->leTextureName->text().isEmpty()){ | 
 
 
 
 
 
 | 476 | 
             showErrStatusMessage("Checkbox '"+ui->cbTexture->text()+"' is selected. The name cannot be empty."); | 
 
 
 
 
 
 | 477 | 
             return ""; | 
 
 
 
 
 
 | 478 | 
         } | 
 
 
 
 
 
 | 479 | 
         command+=" "+this->commandMap.value("models->"+ui->cbTexture->text()) + ui->leTextureName->text().remove(".oni",Qt::CaseInsensitive); | 
 
 
 
 
 
 | 480 | 
     } | 
 
 
 
 
 
 | 481 | 
  | 
 
 
 
 
 
 | 482 | 
     if(ui->cbCellShading->isChecked()){ | 
 
 
 
 
 
 | 483 | 
         command+=" "+this->commandMap.value("models->"+ui->cbCellShading->text()); | 
 
 
 
 
 
 | 484 | 
     } | 
 
 
 
 
 
 | 485 | 
  | 
 
 
 
 
 
 | 486 | 
     if(ui->cbNormals->isChecked()){ | 
 
 
 
 
 
 | 487 | 
         command+=" "+this->commandMap.value("models->"+ui->cbNormals->text()); | 
 
 
 
 
 
 | 488 | 
     } | 
 
 
 
 
 
 | 489 | 
  | 
 
 
 
 
 
 | 490 | 
     if(ui->cbWithAnimation->isEnabled()){ | 
 
 
 
 
 
 | 491 | 
         if(ui->cbWithAnimation->isChecked()){ | 
 
 
 
 
 
 | 492 | 
             command+=" "+this->commandMap.value("models->"+ui->cbWithAnimation->text())+ui->leAnimationName->text().remove(".oni",Qt::CaseInsensitive); | 
 
 
 
 
 
 | 493 | 
         } | 
 
 
 
 
 
 | 494 | 
         else{ | 
 
 
 
 
 
 | 495 | 
             command+=" "+this->commandMap.value("models->No Animation"); | 
 
 
 
 
 
 | 496 | 
         } | 
 
 
 
 
 
 | 497 | 
     } | 
 
 
 
 
 
 | 498 | 
  | 
 
 
 
 
 
 | 499 | 
  | 
 
 
 
 
 
 | 500 | 
     return command+=" "+file; //add source | 
 
 
 
 
 
 | 501 | 
 } | 
 
 
 
 
 
 | 502 | 
  | 
 
 
 
 
 
 | 503 | 
 QString MainWindow::fileParsingAnimations(QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 
 | 504 | 
  | 
 
 
 
 
 
 | 505 | 
     QString command=this->commandMap.value("animations->"+from+"->"+to)+" "+myOutputFolder + " " + file ; | 
 
 
 
 
 
 | 506 | 
  | 
 
 
 
 
 
 | 507 | 
     if(ui->cbCamera->isChecked()){ | 
 
 
 
 
 
 | 508 | 
         command+=" "+this->commandMap.value("animations->"+ui->cbCamera->text()); | 
 
 
 
 
 
 | 509 | 
     } | 
 
 
 
 
 
 | 510 | 
     else if(ui->cbGeometry->isChecked()){ | 
 
 
 
 
 
 | 511 | 
         if(ui->leGeometryName->text().isEmpty()){ | 
 
 
 
 
 
 | 512 | 
             showErrStatusMessage("Checkbox '"+ui->cbGeometry->text()+"' is selected. The geometry file path cannot be empty."); | 
 
 
 
 
 
 | 513 | 
             return ""; | 
 
 
 
 
 
 | 514 | 
         } | 
 
 
 
 
 
 | 515 | 
         command+=" "+this->commandMap.value("animations->"+ui->cbGeometry->text()) + (ui->leGeometryName->text().startsWith('"')?ui->leGeometryName->text():Util::insertQuotes(ui->leGeometryName->text())); | 
 
 
 
 
 
 | 516 | 
     } | 
 
 
 
 
 
 | 517 | 
  | 
 
 
 
 
 
 | 518 | 
     return command; | 
 
 
 
 
 
 | 519 | 
 } | 
 
 
 
 
 
 | 520 | 
  | 
 
 
 
 
 
 | 521 | 
 QString MainWindow::fileParsingLevels(QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 
 | 522 | 
  | 
 
 
 
 
 
 | 523 | 
     QString datName, command; | 
 
 
 
 
 
 | 524 | 
  | 
 
 
 
 
 
 | 525 | 
     command=this->commandMap.value("levels->"+from+"->"+to)+" "+myOutputFolder+" "+file; | 
 
 
 
 
 
 | 526 | 
  | 
 
 
 
 
 
 | 527 | 
     if(from=="MASTER XML" && to=="DAT"){ | 
 
 
 
 
 
 | 528 | 
         command+=GlobalVars::OniSplitProcSeparator; //insert mark so we know this action will take 2 commands | 
 
 
 
 
 
 | 529 | 
  | 
 
 
 
 
 
 | 530 | 
         QString datName; | 
 
 
 
 
 
 | 531 | 
         if(ui->cbDatLevels->isChecked()){ | 
 
 
 
 
 
 | 532 | 
             if(ui->leTargetDatLevels->text().isEmpty()){ | 
 
 
 
 
 
 | 533 | 
                 showErrStatusMessage("Checkbox '"+ui->cbDatLevels->text()+"' is selected. The name cannot be empty."); | 
 
 
 
 
 
 | 534 | 
                 return ""; | 
 
 
 
 
 
 | 535 | 
             } | 
 
 
 
 
 
 | 536 | 
             datName+=QString(myOutputFolder).insert(myOutputFolder.size()-1,ui->leTargetDatLevels->text()); //set name inputted by user | 
 
 
 
 
 
 | 537 | 
             if(!ui->leTargetDatLevels->text().toUpper().endsWith(".DAT")){ | 
 
 
 
 
 
 | 538 | 
                 datName.insert(datName.size()-1,".dat"); //append extension if necessary (-1 to maintain final quote) | 
 
 
 
 
 
 | 539 | 
             } | 
 
 
 
 
 
 | 540 | 
         } | 
 
 
 
 
 
 | 541 | 
         else{ | 
 
 
 
 
 
 | 542 | 
             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 | 
 
 
 
 
 
 | 543 | 
         } | 
 
 
 
 
 
 | 544 | 
  | 
 
 
 
 
 
 | 545 | 
         if(ui->actionWindows->isChecked()){ //is target plataform select windows? | 
 
 
 
 
 
 | 546 | 
             command+=this->commandMap.value("general->ONI->"+to+"(PC)")+" "+myOutputFolder+" "+datName; //add second command | 
 
 
 
 
 
 | 547 | 
         } | 
 
 
 
 
 
 | 548 | 
         else{ | 
 
 
 
 
 
 | 549 | 
             command+=this->commandMap.value("general->ONI->"+to+"(demoPCMAC)")+" "+myOutputFolder+" "+datName; //add second command | 
 
 
 
 
 
 | 550 | 
         } | 
 
 
 
 
 
 | 551 | 
     } | 
 
 
 
 
 
 | 552 | 
  | 
 
 
 
 
 
 | 553 | 
     if(ui->cbBnvLevels->isChecked()){ | 
 
 
 
 
 
 | 554 | 
  | 
 
 
 
 
 
 | 555 | 
         if(ui->leBnvLevels->text().isEmpty()){ | 
 
 
 
 
 
 | 556 | 
             showErrStatusMessage("Checkbox '"+ui->cbBnvLevels->text()+"' is selected. The BNV file cannot be empty."); | 
 
 
 
 
 
 | 557 | 
             return ""; | 
 
 
 
 
 
 | 558 | 
         } | 
 
 
 
 
 
 | 559 | 
         command+=" "+Util::normalizeAndQuote(ui->leBnvLevels->text()); | 
 
 
 
 
 
 | 560 | 
     } | 
 
 
 
 
 
 | 561 | 
  | 
 
 
 
 
 
 | 562 | 
     if(ui->cbAdditionalSourcesLevels->isChecked()){ | 
 
 
 
 
 
 | 563 | 
  | 
 
 
 
 
 
 | 564 | 
         if(ui->leAdditSourcesLevels->text().isEmpty()){ | 
 
 
 
 
 
 | 565 | 
             showErrStatusMessage("Checkbox '"+ui->cbAdditionalSourcesLevels->text()+"' is selected. The source files cannot be empty."); | 
 
 
 
 
 
 | 566 | 
             return ""; | 
 
 
 
 
 
 | 567 | 
         } | 
 
 
 
 
 
 | 568 | 
  | 
 
 
 
 
 
 | 569 | 
         QString additionalFiles=ui->leAdditSourcesLevels->text(); | 
 
 
 
 
 
 | 570 | 
  | 
 
 
 
 
 
 | 571 | 
         int currentIndex=0, nextIndex=0; | 
 
 
 
 
 
 | 572 | 
  | 
 
 
 
 
 
 | 573 | 
         //parse all files (separated by spaces) | 
 
 
 
 
 
 | 574 | 
         while(true){ | 
 
 
 
 
 
 | 575 | 
             nextIndex=additionalFiles.indexOf(" ",currentIndex+1); | 
 
 
 
 
 
 | 576 | 
  | 
 
 
 
 
 
 | 577 | 
             command += " "+Util::normalizeAndQuote(additionalFiles.mid(currentIndex,(nextIndex-currentIndex))); | 
 
 
 
 
 
 | 578 | 
  | 
 
 
 
 
 
 | 579 | 
             if(nextIndex==-1){ //we got to the end, stop parsing | 
 
 
 
 
 
 | 580 | 
                 break; | 
 
 
 
 
 
 | 581 | 
             } | 
 
 
 
 
 
 | 582 | 
             currentIndex=nextIndex+1; //update currentIndex +1 for start after the separator | 
 
 
 
 
 
 | 583 | 
         } | 
 
 
 
 
 
 | 584 | 
     } | 
 
 
 
 
 
 | 585 | 
  | 
 
 
 
 
 
 | 586 | 
     if(ui->cbGridsLevels->isChecked()){ | 
 
 
 
 
 
 | 587 | 
         command+=GlobalVars::OniSplitProcSeparator+this->commandMap.value("levels->"+ui->cbGridsLevels->text())+" "+Util::normalizeAndQuote(ui->leBnvLevels->text())+" "+file+" -out:"+myOutputFolder; | 
 
 
 
 
 
 | 588 | 
     } | 
 
 
 
 
 
 | 589 | 
  | 
 
 
 
 
 
 | 590 | 
     return command; | 
 
 
 
 
 
 | 591 | 
 } | 
 
 
 
 
 
 | 592 | 
  | 
 
 
 
 
 
 | 593 | 
 QString MainWindow::fileParsingMisc(QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 
 | 594 | 
     return this->commandMap.value("misc->"+from+"->"+to)+" "+myOutputFolder+" "+file; | 
 
 
 
 
 
 | 595 | 
 } | 
 
 
 
 
 
 | 596 | 
  | 
 
 
 
 
 
 | 597 | 
 void MainWindow::addRowTable(DropTableWidget *myTable, QString fileName, QString fromTo, QString command){ | 
 
 
 
 
 
 | 598 | 
     //Get actual number rows | 
 
 
 
 
 
 | 599 | 
     int twSize=myTable->rowCount(); | 
 
 
 
 
 
 | 600 | 
  | 
 
 
 
 
 
 | 601 | 
     //increase the rows for the new item | 
 
 
 
 
 
 | 602 | 
     myTable->setRowCount(twSize+1); | 
 
 
 
 
 
 | 603 | 
  | 
 
 
 
 
 
 | 604 | 
     //Add to table and list to | 
 
 
 
 
 
 | 605 | 
     QTableWidgetItem *newFile = new QTableWidgetItem(fileName); | 
 
 
 
 
 
 | 606 | 
     QTableWidgetItem *newConversion = new QTableWidgetItem(fromTo); | 
 
 
 
 
 
 | 607 | 
     QTableWidgetItem *newCommand = new QTableWidgetItem(command); | 
 
 
 
 
 
 | 608 | 
  | 
 
 
 
 
 
 | 609 | 
     myTable->setItem(twSize,0,newFile); | 
 
 
 
 
 
 | 610 | 
     myTable->setItem(twSize,1,newConversion); | 
 
 
 
 
 
 | 611 | 
     myTable->setItem(twSize,2,newCommand); | 
 
 
 
 
 
 | 612 | 
  | 
 
 
 
 
 
 | 613 | 
     myTable->updateTableToolTips(twSize); //Update tool tips | 
 
 
 
 
 
 | 614 | 
 } | 
 
 
 
 
 
 | 615 | 
  | 
 
 
 
 
 
 | 616 | 
 void MainWindow::on_pbConvertGeneral_clicked() | 
 
 
 
 
 
 | 617 | 
 { | 
 
 
 
 
 
 | 618 | 
     startConversion(ui->twSourcesGeneral); | 
 
 
 
 
 
 | 619 | 
 } | 
 
 
 
 
 
 | 620 | 
  | 
 
 
 
 
 
 | 621 | 
 void MainWindow::on_pbConvertTextures_clicked() | 
 
 
 
 
 
 | 622 | 
 { | 
 
 
 
 
 
 | 623 | 
     startConversion(ui->twSourcesTextures); | 
 
 
 
 
 
 | 624 | 
 } | 
 
 
 
 
 
 | 625 | 
  | 
 
 
 
 
 
 | 626 | 
 void MainWindow::on_pbConvertModels_clicked() | 
 
 
 
 
 
 | 627 | 
 { | 
 
 
 
 
 
 | 628 | 
     startConversion(ui->twSourcesModels); | 
 
 
 
 
 
 | 629 | 
 } | 
 
 
 
 
 
 | 630 | 
  | 
 
 
 
 
 
 | 631 | 
 void MainWindow::on_pbConvertAnimations_clicked() | 
 
 
 
 
 
 | 632 | 
 { | 
 
 
 
 
 
 | 633 | 
     startConversion(ui->twSourcesAnimations); | 
 
 
 
 
 
 | 634 | 
 } | 
 
 
 
 
 
 | 635 | 
  | 
 
 
 
 
 
 | 636 | 
 void MainWindow::on_pbConvertLevels_clicked() | 
 
 
 
 
 
 | 637 | 
 { | 
 
 
 
 
 
 | 638 | 
     startConversion(ui->twSourcesLevels); | 
 
 
 
 
 
 | 639 | 
 } | 
 
 
 
 
 
 | 640 | 
  | 
 
 
 
 
 
 | 641 | 
 void MainWindow::on_pbConvertMisc_clicked() | 
 
 
 
 
 
 | 642 | 
 { | 
 
 
 
 
 
 | 643 | 
     startConversion(ui->twSourcesMisc); | 
 
 
 
 
 
 | 644 | 
 } | 
 
 
 
 
 
 | 645 | 
  | 
 
 
 
 
 
 | 646 | 
 void MainWindow::startConversion(DropTableWidget *myTable){ | 
 
 
 
 
 
 | 647 | 
  | 
 
 
 
 
 
 | 648 | 
     bool ready=false; | 
 
 
 
 
 
 | 649 | 
     for(int i=0; i<myTable->rowCount(); i++){ //There are items to process? | 
 
 
 
 
 
 | 650 | 
         if(myTable->item(i,2)->background()!=myTable->disabledBackStyle){ | 
 
 
 
 
 
 | 651 | 
             ready=true; | 
 
 
 
 
 
 | 652 | 
             break; | 
 
 
 
 
 
 | 653 | 
         } | 
 
 
 
 
 
 | 654 | 
     } | 
 
 
 
 
 
 | 655 | 
  | 
 
 
 
 
 
 | 656 | 
     if(!ready){ | 
 
 
 
 
 
 | 657 | 
         showErrStatusMessage("Please add sources to convert first."); | 
 
 
 
 
 
 | 658 | 
         return; | 
 
 
 
 
 
 | 659 | 
     } | 
 
 
 
 
 
 | 660 | 
  | 
 
 
 
 
 
 | 661 | 
     if(myBar->isVisible()){ | 
 
 
 
 
 
 | 662 | 
         Util::showErrorPopUp("Another conversion is progress. Please wait until it finishes."); | 
 
 
 
 
 
 | 663 | 
         return; | 
 
 
 
 
 
 | 664 | 
     } | 
 
 
 
 
 
 | 665 | 
  | 
 
 
 
 
 
 | 666 | 
     for(int i=0; i<myTable->rowCount(); i++){ | 
 
 
 
 
 
 | 667 | 
         //Only process enabled items | 
 
 
 
 
 
 | 668 | 
         if(myTable->item(i,2)->background()!=myTable->disabledBackStyle){ | 
 
 
 
 
 
 | 669 | 
             this->listToProccess->append(myTable->item(i,2)->text()); | 
 
 
 
 
 
 | 670 | 
         } | 
 
 
 
 
 
 | 671 | 
     } | 
 
 
 
 
 
 | 672 | 
  | 
 
 
 
 
 
 | 673 | 
     this->myConverter->start(); | 
 
 
 
 
 
 | 674 | 
 } | 
 
 
 
 
 
 | 675 | 
  | 
 
 
 
 
 
 | 676 | 
 void MainWindow::TsetupProgressBar(int max){ | 
 
 
 
 
 
 | 677 | 
     this->myBar->setValue(0); | 
 
 
 
 
 
 | 678 | 
     this->myBar->show(); | 
 
 
 
 
 
 | 679 | 
     this->myBar->setMaximum(max); | 
 
 
 
 
 
 | 680 | 
 } | 
 
 
 
 
 
 | 681 | 
  | 
 
 
 
 
 
 | 682 | 
 void  MainWindow::TupdateProgressBar(){ | 
 
 
 
 
 
 | 683 | 
     this->myBar->setValue(this->myBar->value()+1); //more one task done | 
 
 
 
 
 
 | 684 | 
 } | 
 
 
 
 
 
 | 685 | 
  | 
 
 
 
 
 
 | 686 | 
 void MainWindow::TresultConversion(QString result, int numErrors){ | 
 
 
 
 
 
 | 687 | 
     QApplication::alert(this); //Show a notification if window is not active | 
 
 
 
 
 
 | 688 | 
     this->myBar->hide(); | 
 
 
 
 
 
 | 689 | 
  | 
 
 
 
 
 
 | 690 | 
     if(numErrors!=0){ | 
 
 
 
 
 
 | 691 | 
         QString sNumErrors=QString::number(numErrors); | 
 
 
 
 
 
 | 692 | 
         if(numErrors>1){ | 
 
 
 
 
 
 | 693 | 
             Util::showErrorLogPopUp(result+"\n This is the last of "+sNumErrors+" Errors."); | 
 
 
 
 
 
 | 694 | 
             showErrStatusMessage("Something gone wrong. Check log file ("+sNumErrors+" Errors)."); | 
 
 
 
 
 
 | 695 | 
         } | 
 
 
 
 
 
 | 696 | 
         else{ | 
 
 
 
 
 
 | 697 | 
             Util::showErrorLogPopUp(result); | 
 
 
 
 
 
 | 698 | 
             showErrStatusMessage("Something gone wrong. Check log file."); | 
 
 
 
 
 
 | 699 | 
         } | 
 
 
 
 
 
 | 700 | 
  | 
 
 
 
 
 
 | 701 | 
     } | 
 
 
 
 
 
 | 702 | 
     else{ | 
 
 
 
 
 
 | 703 | 
         showSuccessStatusMessage("Everything went well!"); | 
 
 
 
 
 
 | 704 | 
     } | 
 
 
 
 
 
 | 705 | 
 } | 
 
 
 
 
 
 | 706 | 
  | 
 
 
 
 
 
 | 707 | 
 void MainWindow::showErrStatusMessage(QString message){ | 
 
 
 
 
 
 | 708 | 
  | 
 
 
 
 
 
 | 709 | 
     QPalette myPalete = QPalette(); | 
 
 
 
 
 
 | 710 | 
     myPalete.setColor( QPalette::WindowText, QColor(255,0,0)); | 
 
 
 
 
 
 | 711 | 
     statusBar()->setPalette( myPalete ); | 
 
 
 
 
 
 | 712 | 
     ui->statusBar->showMessage(message,10000); //display by 10 seconds | 
 
 
 
 
 
 | 713 | 
  | 
 
 
 
 
 
 | 714 | 
 } | 
 
 
 
 
 
 | 715 | 
  | 
 
 
 
 
 
 | 716 | 
 void MainWindow::showSuccessStatusMessage(QString message){ | 
 
 
 
 
 
 | 717 | 
  | 
 
 
 
 
 
 | 718 | 
     QPalette myPalete = QPalette(); | 
 
 
 
 
 
 | 719 | 
     myPalete.setColor( QPalette::WindowText, QColor(0,150,0)); | 
 
 
 
 
 
 | 720 | 
     statusBar()->setPalette( myPalete ); | 
 
 
 
 
 
 | 721 | 
     ui->statusBar->showMessage(message,10000); //display by 10 seconds | 
 
 
 
 
 
 | 722 | 
  | 
 
 
 
 
 
 | 723 | 
 } | 
 
 
 
 
 
 | 724 | 
  | 
 
 
 
 
 
 | 725 | 
 void MainWindow::mapCommands(){ | 
 
 
 
 
 
 | 726 | 
     ////////////////////////////////////////////////////////////////////////General Commands | 
 
 
 
 
 
 | 727 | 
     this->commandMap.insert("general->DAT->ONI","-export"); | 
 
 
 
 
 
 | 728 | 
     //this->commandMap.insert("general->ONI->DAT","-import"); //Not used. | 
 
 
 
 
 
 | 729 | 
     this->commandMap.insert("general->ONI->DAT(PC)","-import:nosep"); | 
 
 
 
 
 
 | 730 | 
     this->commandMap.insert("general->ONI->DAT(demoPCMAC)","-import:sep"); | 
 
 
 
 
 
 | 731 | 
     this->commandMap.insert("general->ONI->XML","-extract:xml"); | 
 
 
 
 
 
 | 732 | 
     this->commandMap.insert("general->XML->ONI","-create"); | 
 
 
 
 
 
 | 733 | 
     //######################General Options | 
 
 
 
 
 
 | 734 | 
     this->commandMap.insert("general->"+ui->cbTRAMGeneral->text(),"-anim-body:"); | 
 
 
 
 
 
 | 735 | 
     //Possible Combinations | 
 
 
 
 
 
 | 736 | 
     this->commandMap.insertMulti("general->DAT","ONI"); | 
 
 
 
 
 
 | 737 | 
     this->commandMap.insertMulti("general->ONI","DAT"); | 
 
 
 
 
 
 | 738 | 
     this->commandMap.insertMulti("general->ONI","XML"); | 
 
 
 
 
 
 | 739 | 
     this->commandMap.insertMulti("general->XML","ONI"); | 
 
 
 
 
 
 | 740 | 
  | 
 
 
 
 
 
 | 741 | 
     ////////////////////////////////////////////////////////////////////////Textures Commands | 
 
 
 
 
 
 | 742 | 
     this->commandMap.insert("textures->DAT / ONI->DDS","-extract:dds"); | 
 
 
 
 
 
 | 743 | 
     this->commandMap.insert("textures->DAT / ONI->TGA","-extract:tga"); | 
 
 
 
 
 
 | 744 | 
     this->commandMap.insert("textures->DAT / ONI->PNG","-extract:png"); | 
 
 
 
 
 
 | 745 | 
     this->commandMap.insert("textures->DAT / ONI->JPG","-extract:jpg"); | 
 
 
 
 
 
 | 746 | 
     this->commandMap.insert("textures->DDS / TGA / PNG / JPG->ONI","-create:txmp"); | 
 
 
 
 
 
 | 747 | 
     //######################Textures Options | 
 
 
 
 
 
 | 748 | 
     this->commandMap.insert("textures->"+ui->rbBGR32->text(),"-format:bgr32"); | 
 
 
 
 
 
 | 749 | 
     this->commandMap.insert("textures->"+ui->rbBGRA32->text(),"-format:bgra32"); | 
 
 
 
 
 
 | 750 | 
     this->commandMap.insert("textures->"+ui->rbBGR555->text(),"-format:bgr555"); | 
 
 
 
 
 
 | 751 | 
     this->commandMap.insert("textures->"+ui->rbBGRA5551->text(),"-format:bgra5551"); | 
 
 
 
 
 
 | 752 | 
     this->commandMap.insert("textures->"+ui->rbBGRA444->text(),"-format:bgra4444"); | 
 
 
 
 
 
 | 753 | 
     this->commandMap.insert("textures->"+ui->rbDxt1->text(),"-format:dxt1"); | 
 
 
 
 
 
 | 754 | 
     this->commandMap.insert("textures->"+ui->cbMipMapsTextures->text(),"-genmipmaps"); | 
 
 
 
 
 
 | 755 | 
     this->commandMap.insert("textures->"+ui->cbNoUwrap->text(),"-nouwrap"); | 
 
 
 
 
 
 | 756 | 
     this->commandMap.insert("textures->"+ui->cbNoVwrap->text(),"-novwrap"); | 
 
 
 
 
 
 | 757 | 
     this->commandMap.insert("textures->"+ui->cbLarge->text(),"-large"); | 
 
 
 
 
 
 | 758 | 
     this->commandMap.insert("textures->"+ui->cbEnvMap->text(),"-envmap:"); | 
 
 
 
 
 
 | 759 | 
     //Possible Combinations | 
 
 
 
 
 
 | 760 | 
     this->commandMap.insertMulti("textures->DAT / ONI","DDS"); | 
 
 
 
 
 
 | 761 | 
     this->commandMap.insertMulti("textures->DAT / ONI","TGA"); | 
 
 
 
 
 
 | 762 | 
     this->commandMap.insertMulti("textures->DAT / ONI","PNG"); | 
 
 
 
 
 
 | 763 | 
     this->commandMap.insertMulti("textures->DAT / ONI","JPG"); | 
 
 
 
 
 
 | 764 | 
     this->commandMap.insertMulti("textures->DDS / TGA / PNG / JPG","ONI"); | 
 
 
 
 
 
 | 765 | 
  | 
 
 
 
 
 
 | 766 | 
     ////////////////////////////////////////////////////////////////////////Models Commands | 
 
 
 
 
 
 | 767 | 
     this->commandMap.insert("models->ONI->OBJ","-extract:obj"); | 
 
 
 
 
 
 | 768 | 
     this->commandMap.insert("models->ONI->DAE","-extract:dae -search "+Util::insertQuotes(this->AeLocation+"/GameDataFolder/level0_Final")); | 
 
 
 
 
 
 | 769 | 
     this->commandMap.insert("models->OBJ->ONI","-create:m3gm"); | 
 
 
 
 
 
 | 770 | 
     this->commandMap.insert("models->DAE->ONI","-create:trbs"); | 
 
 
 
 
 
 | 771 | 
     //######################Models Options | 
 
 
 
 
 
 | 772 | 
     this->commandMap.insert("models->"+ui->cbCellShading->text(),"-cel"); | 
 
 
 
 
 
 | 773 | 
     this->commandMap.insert("models->"+ui->cbNormals->text(),"-normals"); | 
 
 
 
 
 
 | 774 | 
     this->commandMap.insert("models->"+ui->cbTexture->text(),"-tex:"); | 
 
 
 
 
 
 | 775 | 
     this->commandMap.insert("models->"+ui->cbWithAnimation->text(),"-anim:"); | 
 
 
 
 
 
 | 776 | 
     this->commandMap.insert("models->No Animation","-noanim"); //No label with this name so can't be dynamic | 
 
 
 
 
 
 | 777 | 
     //Possible Combinations | 
 
 
 
 
 
 | 778 | 
     this->commandMap.insertMulti("models->ONI","OBJ"); | 
 
 
 
 
 
 | 779 | 
     this->commandMap.insertMulti("models->ONI","DAE"); | 
 
 
 
 
 
 | 780 | 
     this->commandMap.insertMulti("models->OBJ","ONI"); | 
 
 
 
 
 
 | 781 | 
     this->commandMap.insertMulti("models->DAE","ONI"); | 
 
 
 
 
 
 | 782 | 
  | 
 
 
 
 
 
 | 783 | 
     ////////////////////////////////////////////////////////////////////////Animations Commands | 
 
 
 
 
 
 | 784 | 
     this->commandMap.insert("animations->ONI->DAE","-extract:dae"); | 
 
 
 
 
 
 | 785 | 
     this->commandMap.insert("animations->FILM DAT->XML","film2xml"); | 
 
 
 
 
 
 | 786 | 
     //######################Animations Options | 
 
 
 
 
 
 | 787 | 
     this->commandMap.insert("animations->"+ui->cbCamera->text(),"-geom:camera"); | 
 
 
 
 
 
 | 788 | 
     this->commandMap.insert("animations->"+ui->cbGeometry->text(),"-geom:"); | 
 
 
 
 
 
 | 789 | 
     //Possible Combinations | 
 
 
 
 
 
 | 790 | 
     this->commandMap.insertMulti("animations->ONI","DAE"); | 
 
 
 
 
 
 | 791 | 
     this->commandMap.insertMulti("animations->DAE","ONI"); | 
 
 
 
 
 
 | 792 | 
     this->commandMap.insertMulti("animations->FILM DAT","XML"); | 
 
 
 
 
 
 | 793 | 
  | 
 
 
 
 
 
 | 794 | 
     ////////////////////////////////////////////////////////////////////////Levels Commands | 
 
 
 
 
 
 | 795 | 
     this->commandMap.insert("levels->ONI->DAE","-extract:dae -search "+Util::insertQuotes(this->AeLocation+"/GameDataFolder/level0_Final")); | 
 
 
 
 
 
 | 796 | 
     this->commandMap.insert("levels->DAE->ONI","-create:akev"); | 
 
 
 
 
 
 | 797 | 
     this->commandMap.insert("levels->MASTER XML->DAT","-create:level"); | 
 
 
 
 
 
 | 798 | 
     this->commandMap.insert("levels->MASTER XML->ONI FILES","-create:level"); | 
 
 
 
 
 
 | 799 | 
     //######################Levels Options | 
 
 
 
 
 
 | 800 | 
     this->commandMap.insert("levels->"+ui->cbGridsLevels->text(),"-grid:create"); | 
 
 
 
 
 
 | 801 | 
     //Possible Combinations | 
 
 
 
 
 
 | 802 | 
     this->commandMap.insertMulti("levels->ONI","DAE"); | 
 
 
 
 
 
 | 803 | 
     this->commandMap.insertMulti("levels->DAE","ONI"); | 
 
 
 
 
 
 | 804 | 
     this->commandMap.insertMulti("levels->MASTER XML","DAT"); | 
 
 
 
 
 
 | 805 | 
     this->commandMap.insertMulti("levels->MASTER XML","ONI FILES"); | 
 
 
 
 
 
 | 806 | 
  | 
 
 
 
 
 
 | 807 | 
     ////////////////////////////////////////////////////////////////////////Misc Commands | 
 
 
 
 
 
 | 808 | 
     this->commandMap.insert("misc->DAT / ONI->WAV","-extract:wav"); | 
 
 
 
 
 
 | 809 | 
     this->commandMap.insert("misc->DAT / ONI->AIF","-extract:aif"); | 
 
 
 
 
 
 | 810 | 
     this->commandMap.insert("misc->DAT / ONI->TXT","-extract:txt"); | 
 
 
 
 
 
 | 811 | 
     this->commandMap.insert("misc->WAV / AIF->ONI","-create"); | 
 
 
 
 
 
 | 812 | 
     this->commandMap.insert("misc->TXT->ONI","-create:subt"); | 
 
 
 
 
 
 | 813 | 
     //Possible Combinations | 
 
 
 
 
 
 | 814 | 
     this->commandMap.insertMulti("misc->DAT / ONI","WAV"); | 
 
 
 
 
 
 | 815 | 
     this->commandMap.insertMulti("misc->DAT / ONI","AIF"); | 
 
 
 
 
 
 | 816 | 
     this->commandMap.insertMulti("misc->DAT / ONI","TXT"); | 
 
 
 
 
 
 | 817 | 
     this->commandMap.insertMulti("misc->WAV / AIF","ONI"); | 
 
 
 
 
 
 | 818 | 
     this->commandMap.insertMulti("misc->TXT","ONI"); | 
 
 
 
 
 
 | 819 | 
  | 
 
 
 
 
 
 | 820 | 
 } | 
 
 
 
 
 
 | 821 | 
  | 
 
 
 
 
 
 | 822 | 
 void MainWindow::on_cbFromGeneral_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 823 | 
 { | 
 
 
 
 
 
 | 824 | 
     updateComboBox(arg1, ui->cbToGeneral, "general"); | 
 
 
 
 
 
 | 825 | 
 } | 
 
 
 
 
 
 | 826 | 
  | 
 
 
 
 
 
 | 827 | 
 void MainWindow::on_cbFromTextures_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 828 | 
 { | 
 
 
 
 
 
 | 829 | 
     //Options are only used for DAT/ONI -> Image | 
 
 
 
 
 
 | 830 | 
     if(QString::compare(arg1,"DAT / ONI",Qt::CaseSensitive)==0){ //case sensitive is faster | 
 
 
 
 
 
 | 831 | 
         ui->gbTextures->setEnabled(false); | 
 
 
 
 
 
 | 832 | 
     } | 
 
 
 
 
 
 | 833 | 
     else{ | 
 
 
 
 
 
 | 834 | 
         ui->gbTextures->setEnabled(true); | 
 
 
 
 
 
 | 835 | 
     } | 
 
 
 
 
 
 | 836 | 
  | 
 
 
 
 
 
 | 837 | 
     updateComboBox(arg1, ui->cbToTextures, "textures"); | 
 
 
 
 
 
 | 838 | 
 } | 
 
 
 
 
 
 | 839 | 
  | 
 
 
 
 
 
 | 840 | 
 void MainWindow::on_cbFromModels_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 841 | 
 { | 
 
 
 
 
 
 | 842 | 
  | 
 
 
 
 
 
 | 843 | 
     ui->cbCellShading->setEnabled(false); | 
 
 
 
 
 
 | 844 | 
     ui->cbCellShading->setChecked(false); | 
 
 
 
 
 
 | 845 | 
     ui->cbNormals->setEnabled(false); | 
 
 
 
 
 
 | 846 | 
     ui->cbNormals->setChecked(false); | 
 
 
 
 
 
 | 847 | 
     ui->cbTexture->setEnabled(false); | 
 
 
 
 
 
 | 848 | 
     ui->cbTexture->setChecked(false); | 
 
 
 
 
 
 | 849 | 
     ui->cbWithAnimation->setEnabled(false); | 
 
 
 
 
 
 | 850 | 
     ui->cbWithAnimation->setChecked(false); | 
 
 
 
 
 
 | 851 | 
  | 
 
 
 
 
 
 | 852 | 
     if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){ //case sensitive is faster | 
 
 
 
 
 
 | 853 | 
         ui->cbTexture->setEnabled(true); | 
 
 
 
 
 
 | 854 | 
     } | 
 
 
 
 
 
 | 855 | 
     else if(QString::compare(arg1,"DAE",Qt::CaseSensitive)==0){ | 
 
 
 
 
 
 | 856 | 
         ui->cbCellShading->setEnabled(true); | 
 
 
 
 
 
 | 857 | 
         ui->cbNormals->setEnabled(true); | 
 
 
 
 
 
 | 858 | 
     } | 
 
 
 
 
 
 | 859 | 
  | 
 
 
 
 
 
 | 860 | 
     updateComboBox(arg1, ui->cbToModels, "models"); | 
 
 
 
 
 
 | 861 | 
 } | 
 
 
 
 
 
 | 862 | 
  | 
 
 
 
 
 
 | 863 | 
 void MainWindow::on_cbFromAnimations_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 864 | 
 { | 
 
 
 
 
 
 | 865 | 
     ui->cbCamera->setEnabled(false); | 
 
 
 
 
 
 | 866 | 
     ui->cbCamera->setChecked(false); | 
 
 
 
 
 
 | 867 | 
     ui->cbGeometry->setEnabled(false); | 
 
 
 
 
 
 | 868 | 
     ui->cbGeometry->setChecked(false); | 
 
 
 
 
 
 | 869 | 
  | 
 
 
 
 
 
 | 870 | 
     if(QString::compare(arg1,"ONI",Qt::CaseSensitive)==0){ //case sensitive is faster | 
 
 
 
 
 
 | 871 | 
         ui->cbCamera->setEnabled(true); | 
 
 
 
 
 
 | 872 | 
         ui->cbGeometry->setEnabled(true); | 
 
 
 
 
 
 | 873 | 
     } | 
 
 
 
 
 
 | 874 | 
  | 
 
 
 
 
 
 | 875 | 
     updateComboBox(arg1, ui->cbToAnimations, "animations"); | 
 
 
 
 
 
 | 876 | 
 } | 
 
 
 
 
 
 | 877 | 
  | 
 
 
 
 
 
 | 878 | 
 void MainWindow::on_cbFromLevels_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 879 | 
 { | 
 
 
 
 
 
 | 880 | 
     updateComboBox(arg1, ui->cbToLevels, "levels"); | 
 
 
 
 
 
 | 881 | 
 } | 
 
 
 
 
 
 | 882 | 
  | 
 
 
 
 
 
 | 883 | 
 void MainWindow::on_cbFromMisc_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 884 | 
 { | 
 
 
 
 
 
 | 885 | 
     updateComboBox(arg1, ui->cbToMisc, "misc"); | 
 
 
 
 
 
 | 886 | 
 } | 
 
 
 
 
 
 | 887 | 
  | 
 
 
 
 
 
 | 888 | 
 void MainWindow::updateComboBox(const QString &arg1, QComboBox *comboBox, const QString &identifier){ | 
 
 
 
 
 
 | 889 | 
     comboBox->clear(); | 
 
 
 
 
 
 | 890 | 
  | 
 
 
 
 
 
 | 891 | 
     QStringList toUpdate=QStringList(); | 
 
 
 
 
 
 | 892 | 
  | 
 
 
 
 
 
 | 893 | 
     QStringList values=commandMap.values(identifier+"->"+arg1); | 
 
 
 
 
 
 | 894 | 
  | 
 
 
 
 
 
 | 895 | 
     for (int i = values.size()-1; i >= 0; i--){ //By defaut MultiItems have the inversed order (http://qt-project.org/doc/qt-4.8/qhash.html#insertMulti) | 
 
 
 
 
 
 | 896 | 
         toUpdate << values.at(i); | 
 
 
 
 
 
 | 897 | 
     } | 
 
 
 
 
 
 | 898 | 
  | 
 
 
 
 
 
 | 899 | 
     comboBox->addItems(toUpdate); | 
 
 
 
 
 
 | 900 | 
 } | 
 
 
 
 
 
 | 901 | 
  | 
 
 
 
 
 
 | 902 | 
  | 
 
 
 
 
 
 | 903 | 
 void MainWindow::on_actionWindows_triggered() | 
 
 
 
 
 
 | 904 | 
 { | 
 
 
 
 
 
 | 905 | 
     ui->actionWindows->setChecked(true); | 
 
 
 
 
 
 | 906 | 
     ui->actionMac_Windows_demo->setChecked(false); | 
 
 
 
 
 
 | 907 | 
 } | 
 
 
 
 
 
 | 908 | 
  | 
 
 
 
 
 
 | 909 | 
 void MainWindow::on_actionMac_Windows_demo_triggered() | 
 
 
 
 
 
 | 910 | 
 { | 
 
 
 
 
 
 | 911 | 
     ui->actionMac_Windows_demo->setChecked(true); | 
 
 
 
 
 
 | 912 | 
     ui->actionWindows->setChecked(false); | 
 
 
 
 
 
 | 913 | 
 } | 
 
 
 
 
 
 | 914 | 
  | 
 
 
 
 
 
 | 915 | 
 void MainWindow::on_pbRemoveSourceGeneral_clicked() | 
 
 
 
 
 
 | 916 | 
 { | 
 
 
 
 
 
 | 917 | 
     removeTableContents( ui->twSourcesGeneral); | 
 
 
 
 
 
 | 918 | 
 } | 
 
 
 
 
 
 | 919 | 
  | 
 
 
 
 
 
 | 920 | 
 void MainWindow::on_pbRemoveSourceTextures_clicked() | 
 
 
 
 
 
 | 921 | 
 { | 
 
 
 
 
 
 | 922 | 
     removeTableContents(ui->twSourcesTextures); | 
 
 
 
 
 
 | 923 | 
 } | 
 
 
 
 
 
 | 924 | 
  | 
 
 
 
 
 
 | 925 | 
 void MainWindow::on_pbRemoveSourceModels_clicked() | 
 
 
 
 
 
 | 926 | 
 { | 
 
 
 
 
 
 | 927 | 
     removeTableContents(ui->twSourcesModels); | 
 
 
 
 
 
 | 928 | 
 } | 
 
 
 
 
 
 | 929 | 
  | 
 
 
 
 
 
 | 930 | 
 void MainWindow::on_pbRemoveSourceAnimations_clicked() | 
 
 
 
 
 
 | 931 | 
 { | 
 
 
 
 
 
 | 932 | 
     removeTableContents(ui->twSourcesAnimations); | 
 
 
 
 
 
 | 933 | 
 } | 
 
 
 
 
 
 | 934 | 
  | 
 
 
 
 
 
 | 935 | 
 void MainWindow::on_pbRemoveSourceLevels_clicked() | 
 
 
 
 
 
 | 936 | 
 { | 
 
 
 
 
 
 | 937 | 
     removeTableContents(ui->twSourcesLevels); | 
 
 
 
 
 
 | 938 | 
 } | 
 
 
 
 
 
 | 939 | 
  | 
 
 
 
 
 
 | 940 | 
 void MainWindow::on_pbRemoveSourceMisc_clicked() | 
 
 
 
 
 
 | 941 | 
 { | 
 
 
 
 
 
 | 942 | 
     removeTableContents(ui->twSourcesMisc); | 
 
 
 
 
 
 | 943 | 
 } | 
 
 
 
 
 
 | 944 | 
  | 
 
 
 
 
 
 | 945 | 
 void MainWindow::on_pbClearSourcesGeneral_clicked() | 
 
 
 
 
 
 | 946 | 
 { | 
 
 
 
 
 
 | 947 | 
     clearTableContents(ui->twSourcesGeneral); | 
 
 
 
 
 
 | 948 | 
 } | 
 
 
 
 
 
 | 949 | 
  | 
 
 
 
 
 
 | 950 | 
 void MainWindow::on_pbClearSourcesTextures_clicked() | 
 
 
 
 
 
 | 951 | 
 { | 
 
 
 
 
 
 | 952 | 
     clearTableContents(ui->twSourcesTextures); | 
 
 
 
 
 
 | 953 | 
 } | 
 
 
 
 
 
 | 954 | 
  | 
 
 
 
 
 
 | 955 | 
 void MainWindow::on_pbClearSourcesModels_clicked() | 
 
 
 
 
 
 | 956 | 
 { | 
 
 
 
 
 
 | 957 | 
     clearTableContents(ui->twSourcesModels); | 
 
 
 
 
 
 | 958 | 
 } | 
 
 
 
 
 
 | 959 | 
  | 
 
 
 
 
 
 | 960 | 
 void MainWindow::on_pbClearSourcesAnimations_clicked() | 
 
 
 
 
 
 | 961 | 
 { | 
 
 
 
 
 
 | 962 | 
     clearTableContents(ui->twSourcesAnimations); | 
 
 
 
 
 
 | 963 | 
 } | 
 
 
 
 
 
 | 964 | 
  | 
 
 
 
 
 
 | 965 | 
 void MainWindow::on_pbClearSourcesLevels_clicked() | 
 
 
 
 
 
 | 966 | 
 { | 
 
 
 
 
 
 | 967 | 
     clearTableContents(ui->twSourcesLevels); | 
 
 
 
 
 
 | 968 | 
 } | 
 
 
 
 
 
 | 969 | 
  | 
 
 
 
 
 
 | 970 | 
 void MainWindow::on_pbClearSourcesMisc_clicked() | 
 
 
 
 
 
 | 971 | 
 { | 
 
 
 
 
 
 | 972 | 
     clearTableContents(ui->twSourcesMisc); | 
 
 
 
 
 
 | 973 | 
 } | 
 
 
 
 
 
 | 974 | 
  | 
 
 
 
 
 
 | 975 | 
 void MainWindow::removeTableContents(DropTableWidget *myTable){ | 
 
 
 
 
 
 | 976 | 
     int size = myTable->selectionModel()->selectedRows().size(); | 
 
 
 
 
 
 | 977 | 
  | 
 
 
 
 
 
 | 978 | 
     if(size==0){ | 
 
 
 
 
 
 | 979 | 
         Util::showPopUp("Select a row first."); | 
 
 
 
 
 
 | 980 | 
         return; | 
 
 
 
 
 
 | 981 | 
     } | 
 
 
 
 
 
 | 982 | 
  | 
 
 
 
 
 
 | 983 | 
     if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){ | 
 
 
 
 
 
 | 984 | 
         for(int i=0; i<size; i++){ | 
 
 
 
 
 
 | 985 | 
             //myTable->removeRow(myTable->selectedItems().at(size-i-1)->row()); | 
 
 
 
 
 
 | 986 | 
             myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row()); | 
 
 
 
 
 
 | 987 | 
         } | 
 
 
 
 
 
 | 988 | 
         updateItemsLoaded(myTable); | 
 
 
 
 
 
 | 989 | 
     } | 
 
 
 
 
 
 | 990 | 
 } | 
 
 
 
 
 
 | 991 | 
  | 
 
 
 
 
 
 | 992 | 
 void MainWindow::clearTableContents(DropTableWidget *myTable){ | 
 
 
 
 
 
 | 993 | 
     if(myTable->rowCount()==0){ | 
 
 
 
 
 
 | 994 | 
         Util::showPopUp("Nothing to clear."); | 
 
 
 
 
 
 | 995 | 
         return; | 
 
 
 
 
 
 | 996 | 
     } | 
 
 
 
 
 
 | 997 | 
  | 
 
 
 
 
 
 | 998 | 
     if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?")){ | 
 
 
 
 
 
 | 999 | 
         myTable->clearContents(); | 
 
 
 
 
 
 | 1000 | 
         myTable->setRowCount(0); | 
 
 
 
 
 
 | 1001 | 
     } | 
 
 
 
 
 
 | 1002 | 
     updateItemsLoaded(myTable); | 
 
 
 
 
 
 | 1003 | 
 } | 
 
 
 
 
 
 | 1004 | 
  | 
 
 
 
 
 
 | 1005 | 
  | 
 
 
 
 
 
 | 1006 | 
 void MainWindow::on_actionPreferences_triggered() | 
 
 
 
 
 
 | 1007 | 
 { | 
 
 
 
 
 
 | 1008 | 
     //Show preferences | 
 
 
 
 
 
 | 1009 | 
     Preferences *preferencesWindow = new Preferences(this,this->vagoSettings); | 
 
 
 
 
 
 | 1010 | 
     preferencesWindow->exec(); //it destroys itself when finished. | 
 
 
 
 
 
 | 1011 | 
 } | 
 
 
 
 
 
 | 1012 | 
  | 
 
 
 
 
 
 | 1013 | 
  | 
 
 
 
 
 
 | 1014 | 
 void MainWindow::closeEvent(QCloseEvent *event){ | 
 
 
 
 
 
 | 1015 | 
     if(this->vagoSettings->value("ConfirmExit").toBool()){ | 
 
 
 
 
 
 | 1016 | 
         if(!Util::showQuestionPopUp(this,"Exit Vago?")){ | 
 
 
 
 
 
 | 1017 | 
             event->ignore(); | 
 
 
 
 
 
 | 1018 | 
         } | 
 
 
 
 
 
 | 1019 | 
     } | 
 
 
 
 
 
 | 1020 | 
 } | 
 
 
 
 
 
 | 1021 | 
  | 
 
 
 
 
 
 | 1022 | 
 void MainWindow::on_cbToGeneral_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 1023 | 
 { | 
 
 
 
 
 
 | 1024 | 
  | 
 
 
 
 
 
 | 1025 | 
     ui->cbDatGeneral->setEnabled(false); | 
 
 
 
 
 
 | 1026 | 
     ui->cbDatGeneral->setChecked(false); | 
 
 
 
 
 
 | 1027 | 
     ui->cbTRAMGeneral->setEnabled(false); | 
 
 
 
 
 
 | 1028 | 
     ui->cbTRAMGeneral->setChecked(false); | 
 
 
 
 
 
 | 1029 | 
  | 
 
 
 
 
 
 | 1030 | 
     if(QString::compare(ui->cbFromGeneral->currentText(),"ONI",Qt::CaseSensitive)==0){ | 
 
 
 
 
 
 | 1031 | 
         if(QString::compare(arg1,"DAT",Qt::CaseSensitive)==0){ | 
 
 
 
 
 
 | 1032 | 
             ui->cbDatGeneral->setEnabled(true); | 
 
 
 
 
 
 | 1033 | 
         } | 
 
 
 
 
 
 | 1034 | 
         else{ | 
 
 
 
 
 
 | 1035 | 
             ui->cbTRAMGeneral->setEnabled(true); | 
 
 
 
 
 
 | 1036 | 
         } | 
 
 
 
 
 
 | 1037 | 
     } | 
 
 
 
 
 
 | 1038 | 
  | 
 
 
 
 
 
 | 1039 | 
 } | 
 
 
 
 
 
 | 1040 | 
  | 
 
 
 
 
 
 | 1041 | 
 void MainWindow::on_cbToModels_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 1042 | 
 { | 
 
 
 
 
 
 | 1043 | 
     ui->cbWithAnimation->setEnabled(false); | 
 
 
 
 
 
 | 1044 | 
     ui->cbWithAnimation->setChecked(false); | 
 
 
 
 
 
 | 1045 | 
  | 
 
 
 
 
 
 | 1046 | 
     if(arg1=="DAE"){ | 
 
 
 
 
 
 | 1047 | 
         ui->cbWithAnimation->setEnabled(true); | 
 
 
 
 
 
 | 1048 | 
     } | 
 
 
 
 
 
 | 1049 | 
 } | 
 
 
 
 
 
 | 1050 | 
  | 
 
 
 
 
 
 | 1051 | 
 void MainWindow::on_cbToLevels_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 
 | 1052 | 
 { | 
 
 
 
 
 
 | 1053 | 
  | 
 
 
 
 
 
 | 1054 | 
     ui->cbDatLevels->setEnabled(false); | 
 
 
 
 
 
 | 1055 | 
     ui->cbDatLevels->setChecked(false); | 
 
 
 
 
 
 | 1056 | 
     ui->cbBnvLevels->setEnabled(false); | 
 
 
 
 
 
 | 1057 | 
     ui->cbBnvLevels->setChecked(false); | 
 
 
 
 
 
 | 1058 | 
     ui->cbAdditionalSourcesLevels->setEnabled(false); | 
 
 
 
 
 
 | 1059 | 
     ui->cbAdditionalSourcesLevels->setChecked(false); | 
 
 
 
 
 
 | 1060 | 
     ui->cbGridsLevels->setEnabled(false); | 
 
 
 
 
 
 | 1061 | 
     ui->cbGridsLevels->setChecked(false); | 
 
 
 
 
 
 | 1062 | 
  | 
 
 
 
 
 
 | 1063 | 
     if(ui->cbFromLevels->currentText()=="MASTER XML" && arg1=="DAT"){ | 
 
 
 
 
 
 | 1064 | 
         ui->cbDatLevels->setEnabled(true); | 
 
 
 
 
 
 | 1065 | 
     } | 
 
 
 
 
 
 | 1066 | 
     else if(ui->cbFromLevels->currentText()=="DAE" && arg1=="ONI"){ | 
 
 
 
 
 
 | 1067 | 
         ui->cbBnvLevels->setEnabled(true); | 
 
 
 
 
 
 | 1068 | 
         ui->cbAdditionalSourcesLevels->setEnabled(true); | 
 
 
 
 
 
 | 1069 | 
     } | 
 
 
 
 
 
 | 1070 | 
 } | 
 
 
 
 
 
 | 1071 | 
  | 
 
 
 
 
 
 | 1072 | 
 void MainWindow::on_cbDatGeneral_toggled(bool checked) | 
 
 
 
 
 
 | 1073 | 
 { | 
 
 
 
 
 
 | 1074 | 
     ui->leTargetDatGeneral->setEnabled(checked); | 
 
 
 
 
 
 | 1075 | 
 } | 
 
 
 
 
 
 | 1076 | 
  | 
 
 
 
 
 
 | 1077 | 
 void MainWindow::on_cbTRAMGeneral_toggled(bool checked) | 
 
 
 
 
 
 | 1078 | 
 { | 
 
 
 
 
 
 | 1079 | 
     ui->leTRAMGeneral->setEnabled(checked); | 
 
 
 
 
 
 | 1080 | 
     if(checked){ | 
 
 
 
 
 
 | 1081 | 
         QString file=QFileDialog::getOpenFileName(this,"Choose the TRAM.oni file...","./" , "All Files (*.*)"); | 
 
 
 
 
 
 | 1082 | 
         if(!file.isEmpty()){ | 
 
 
 
 
 
 | 1083 | 
             ui->leTRAMGeneral->setText(file); | 
 
 
 
 
 
 | 1084 | 
         } | 
 
 
 
 
 
 | 1085 | 
     } | 
 
 
 
 
 
 | 1086 | 
 } | 
 
 
 
 
 
 | 1087 | 
  | 
 
 
 
 
 
 | 1088 | 
 void MainWindow::on_cbDatLevels_toggled(bool checked) | 
 
 
 
 
 
 | 1089 | 
 { | 
 
 
 
 
 
 | 1090 | 
     ui->leTargetDatLevels->setEnabled(checked); | 
 
 
 
 
 
 | 1091 | 
 } | 
 
 
 
 
 
 | 1092 | 
  | 
 
 
 
 
 
 | 1093 | 
 void MainWindow::on_cbBnvLevels_toggled(bool checked) | 
 
 
 
 
 
 | 1094 | 
 { | 
 
 
 
 
 
 | 1095 | 
     ui->leBnvLevels->setEnabled(checked); | 
 
 
 
 
 
 | 1096 | 
     ui->cbGridsLevels->setEnabled(checked); | 
 
 
 
 
 
 | 1097 | 
     ui->cbGridsLevels->setChecked(checked); | 
 
 
 
 
 
 | 1098 | 
     if(checked){ | 
 
 
 
 
 
 | 1099 | 
         QString file=QFileDialog::getOpenFileName(this,"Choose the BNV.dae file...","./" , "All Files (*.*)"); | 
 
 
 
 
 
 | 1100 | 
         if(!file.isEmpty()){ | 
 
 
 
 
 
 | 1101 | 
             ui->leBnvLevels->setText(file); | 
 
 
 
 
 
 | 1102 | 
         } | 
 
 
 
 
 
 | 1103 | 
     } | 
 
 
 
 
 
 | 1104 | 
 } | 
 
 
 
 
 
 | 1105 | 
  | 
 
 
 
 
 
 | 1106 | 
 void MainWindow::on_cbAdditionalSourcesLevels_toggled(bool checked) | 
 
 
 
 
 
 | 1107 | 
 { | 
 
 
 
 
 
 | 1108 | 
     ui->leAdditSourcesLevels->setEnabled(checked); | 
 
 
 
 
 
 | 1109 | 
  | 
 
 
 
 
 
 | 1110 | 
     if(checked){ | 
 
 
 
 
 
 | 1111 | 
         QStringList filesSelected=QFileDialog::getOpenFileNames(this,"Choose the additional .dae files...","./" , "All Files (*.*)"); | 
 
 
 
 
 
 | 1112 | 
         QString filesJoined; | 
 
 
 
 
 
 | 1113 | 
         int size=filesSelected.size(); | 
 
 
 
 
 
 | 1114 | 
  | 
 
 
 
 
 
 | 1115 | 
         if(!filesSelected.isEmpty()){ | 
 
 
 
 
 
 | 1116 | 
             for(int i=0; i<size-1; i++){ | 
 
 
 
 
 
 | 1117 | 
                 filesJoined+=filesSelected.at(i)+" "; | 
 
 
 
 
 
 | 1118 | 
             } | 
 
 
 
 
 
 | 1119 | 
             filesJoined+=filesSelected.at(size-1); //last doesn't have space after | 
 
 
 
 
 
 | 1120 | 
             ui->leAdditSourcesLevels->setText(filesJoined); | 
 
 
 
 
 
 | 1121 | 
         } | 
 
 
 
 
 
 | 1122 | 
  | 
 
 
 
 
 
 | 1123 | 
     } | 
 
 
 
 
 
 | 1124 | 
 } | 
 
 
 
 
 
 | 1125 | 
  | 
 
 
 
 
 
 | 1126 | 
 void MainWindow::on_actionCheck_OniSplit_version_triggered() | 
 
 
 
 
 
 | 1127 | 
 { | 
 
 
 
 
 
 | 1128 | 
     QProcess *myProcess = new QProcess(); | 
 
 
 
 
 
 | 1129 | 
     myProcess->start(GlobalVars::OniSplitExeName+" -version"); | 
 
 
 
 
 
 | 1130 | 
     myProcess->waitForFinished(-1); | 
 
 
 
 
 
 | 1131 | 
     QString result=myProcess->readAllStandardOutput(); | 
 
 
 
 
 
 | 1132 | 
     delete myProcess; | 
 
 
 
 
 
 | 1133 | 
     Util::showPopUp("This Vago version was built with base in OniSplit version "+GlobalVars::BuiltOniSplitVersion+"\n\nActual version is:\n"+result); | 
 
 
 
 
 
 | 1134 | 
 } | 
 
 
 
 
 
 | 1135 | 
  | 
 
 
 
 
 
 | 1136 | 
 void MainWindow::on_actionCheck_xmlTools_version_triggered() | 
 
 
 
 
 
 | 1137 | 
 { | 
 
 
 
 
 
 | 1138 | 
     QProcess *myProcess = new QProcess(); | 
 
 
 
 
 
 | 1139 | 
     myProcess->start(GlobalVars::XmlToolsExeName+" version"); | 
 
 
 
 
 
 | 1140 | 
     myProcess->waitForFinished(-1); | 
 
 
 
 
 
 | 1141 | 
     QString result=myProcess->readLine(); | 
 
 
 
 
 
 | 1142 | 
     delete myProcess; | 
 
 
 
 
 
 | 1143 | 
     Util::showPopUp("This Vago version was built with base in xmlTools version "+GlobalVars::BuiltXmlToolsVersion+"\n\nActual version is:\n"+result); | 
 
 
 
 
 
 | 1144 | 
 } | 
 
 
 
 
 
 | 1145 | 
  | 
 
 
 
 
 
 | 1146 | 
 /** | 
 
 
 
 
 
 | 1147 | 
   Update items loaded | 
 
 
 
 
 
 | 1148 | 
   **/ | 
 
 
 
 
 
 | 1149 | 
 void MainWindow::on_tabWidget_selected(const QString &arg1) | 
 
 
 
 
 
 | 1150 | 
 { | 
 
 
 
 
 
 | 1151 | 
     if(arg1.compare("General",Qt::CaseSensitive)==0){ //case sentive is faster | 
 
 
 
 
 
 | 1152 | 
         updateItemsLoaded(ui->twSourcesGeneral); | 
 
 
 
 
 
 | 1153 | 
     } | 
 
 
 
 
 
 | 1154 | 
     else if(arg1.compare("Textures",Qt::CaseSensitive)==0){ | 
 
 
 
 
 
 | 1155 | 
         updateItemsLoaded(ui->twSourcesTextures); | 
 
 
 
 
 
 | 1156 | 
     } | 
 
 
 
 
 
 | 1157 | 
     else if(arg1.compare("Models",Qt::CaseSensitive)==0){ | 
 
 
 
 
 
 | 1158 | 
         updateItemsLoaded(ui->twSourcesModels); | 
 
 
 
 
 
 | 1159 | 
     } | 
 
 
 
 
 
 | 1160 | 
     else if(arg1.compare("Levels",Qt::CaseSensitive)==0){ | 
 
 
 
 
 
 | 1161 | 
         updateItemsLoaded(ui->twSourcesLevels); | 
 
 
 
 
 
 | 1162 | 
     } | 
 
 
 
 
 
 | 1163 | 
     else{ | 
 
 
 
 
 
 | 1164 | 
         updateItemsLoaded(ui->twSourcesMisc); | 
 
 
 
 
 
 | 1165 | 
     } | 
 
 
 
 
 
 | 1166 | 
 } | 
 
 
 
 
 
 | 1167 | 
  | 
 
 
 
 
 
 | 1168 | 
 void MainWindow::updateItemsLoaded(DropTableWidget *currentTable){ | 
 
 
 
 
 
 | 1169 | 
  | 
 
 
 
 
 
 | 1170 | 
     int numItems=currentTable->rowCount(); | 
 
 
 
 
 
 | 1171 | 
  | 
 
 
 
 
 
 | 1172 | 
     this->itemsLoaded->setText(QString().setNum(numItems)+ (numItems==1?" item ":" items ") +"loaded"); | 
 
 
 
 
 
 | 1173 | 
 } | 
 
 
 
 
 
 | 1174 | 
  | 
 
 
 
 
 
 | 1175 | 
 void MainWindow::on_tbCommand_clicked() | 
 
 
 
 
 
 | 1176 | 
 { | 
 
 
 
 
 
 | 1177 | 
     //Show preferences | 
 
 
 
 
 
 | 1178 | 
     ManualCommands *commandsWindow = new ManualCommands(this); | 
 
 
 
 
 
 | 1179 | 
     commandsWindow->show(); //it destroys itself when finished. | 
 
 
 
 
 
 | 1180 | 
 } | 
 
 
 
 
 
 | 1181 | 
  | 
 
 
 
 
 
 | 1182 | 
 void MainWindow::on_actionWorkspace_triggered() | 
 
 
 
 
 
 | 1183 | 
 { | 
 
 
 
 
 
 | 1184 | 
     ui->actionWorkspace->setChecked(true); | 
 
 
 
 
 
 | 1185 | 
     ui->actionOther->setChecked(false); | 
 
 
 
 
 
 | 1186 | 
     this->outputFolder=this->workspaceLocation; | 
 
 
 
 
 
 | 1187 | 
     ui->tbOpenFolder->setToolTip("Open Vago workspace"); | 
 
 
 
 
 
 | 1188 | 
     showSuccessStatusMessage("Vago is now outputting the NEW items for Vago workspace."); | 
 
 
 
 
 
 | 1189 | 
 } | 
 
 
 
 
 
 | 1190 | 
  | 
 
 
 
 
 
 | 1191 | 
 void MainWindow::on_actionOther_triggered() | 
 
 
 
 
 
 | 1192 | 
 { | 
 
 
 
 
 
 | 1193 | 
     QString newDir=QFileDialog::getExistingDirectory(this,"Choose the folder for output NEW files directly...",this->AeLocation+"/GameDataFolder"); | 
 
 
 
 
 
 | 1194 | 
     newDir=Util::normalizePath(newDir); | 
 
 
 
 
 
 | 1195 | 
  | 
 
 
 
 
 
 | 1196 | 
     if(newDir.isEmpty()){ | 
 
 
 
 
 
 | 1197 | 
         ui->actionOther->setChecked(false); | 
 
 
 
 
 
 | 1198 | 
         return; //do nothing | 
 
 
 
 
 
 | 1199 | 
     } | 
 
 
 
 
 
 | 1200 | 
  | 
 
 
 
 
 
 | 1201 | 
     if(newDir==this->workspaceLocation){ | 
 
 
 
 
 
 | 1202 | 
         on_actionWorkspace_triggered(); //set it to vago workspace | 
 
 
 
 
 
 | 1203 | 
         return; | 
 
 
 
 
 
 | 1204 | 
     } | 
 
 
 
 
 
 | 1205 | 
  | 
 
 
 
 
 
 | 1206 | 
     ui->actionOther->setChecked(true); | 
 
 
 
 
 
 | 1207 | 
     ui->actionWorkspace->setChecked(false); | 
 
 
 
 
 
 | 1208 | 
  | 
 
 
 
 
 
 | 1209 | 
     this->outputFolder=newDir; | 
 
 
 
 
 
 | 1210 | 
  | 
 
 
 
 
 
 | 1211 | 
     QString newDirName=Util::cutName(newDir); | 
 
 
 
 
 
 | 1212 | 
     ui->tbOpenFolder->setToolTip("Open "+newDirName+" output folder"); | 
 
 
 
 
 
 | 1213 | 
     showSuccessStatusMessage("Vago is now outputting the NEW items for "+newDirName+"."); | 
 
 
 
 
 
 | 1214 | 
 } | 
 
 
 
 
 
 | 1215 | 
  | 
 
 
 
 
 
 | 1216 | 
 void MainWindow::on_actionView_log_triggered() | 
 
 
 
 
 
 | 1217 | 
 { | 
 
 
 
 
 
 | 1218 | 
     Util::openLogFile(); | 
 
 
 
 
 
 | 1219 | 
 } | 
 
 
 
 
 
 | 1220 | 
  | 
 
 
 
 
 
 | 1221 | 
 QString MainWindow::getTypeConversion(DropTableWidget *myTable){ | 
 
 
 
 
 
 | 1222 | 
     QString from,to; | 
 
 
 
 
 
 | 1223 | 
  | 
 
 
 
 
 
 | 1224 | 
     if(myTable==ui->twSourcesGeneral){ | 
 
 
 
 
 
 | 1225 | 
         from=ui->cbFromGeneral->currentText(); | 
 
 
 
 
 
 | 1226 | 
         to=ui->cbToGeneral->currentText(); | 
 
 
 
 
 
 | 1227 | 
     } | 
 
 
 
 
 
 | 1228 | 
     else if(myTable==ui->twSourcesTextures){ | 
 
 
 
 
 
 | 1229 | 
         from=ui->cbFromTextures->currentText(); | 
 
 
 
 
 
 | 1230 | 
         to=ui->cbToTextures->currentText(); | 
 
 
 
 
 
 | 1231 | 
     } | 
 
 
 
 
 
 | 1232 | 
     else if(myTable==ui->twSourcesModels){ | 
 
 
 
 
 
 | 1233 | 
         from=ui->cbFromModels->currentText(); | 
 
 
 
 
 
 | 1234 | 
         to=ui->cbToModels->currentText(); | 
 
 
 
 
 
 | 1235 | 
     } | 
 
 
 
 
 
 | 1236 | 
     else if(myTable==ui->twSourcesAnimations){ | 
 
 
 
 
 
 | 1237 | 
         from=ui->cbFromAnimations->currentText(); | 
 
 
 
 
 
 | 1238 | 
         to=ui->cbToAnimations->currentText(); | 
 
 
 
 
 
 | 1239 | 
     } | 
 
 
 
 
 
 | 1240 | 
     else if(myTable==ui->twSourcesLevels){ | 
 
 
 
 
 
 | 1241 | 
         from=ui->cbFromLevels->currentText(); | 
 
 
 
 
 
 | 1242 | 
         to=ui->cbToLevels->currentText(); | 
 
 
 
 
 
 | 1243 | 
     } | 
 
 
 
 
 
 | 1244 | 
     else{ | 
 
 
 
 
 
 | 1245 | 
         from=ui->cbFromMisc->currentText(); | 
 
 
 
 
 
 | 1246 | 
         to=ui->cbToMisc->currentText(); | 
 
 
 
 
 
 | 1247 | 
     } | 
 
 
 
 
 
 | 1248 | 
  | 
 
 
 
 
 
 | 1249 | 
     return from + " > " + to; | 
 
 
 
 
 
 | 1250 | 
 } | 
 
 
 
 
 
 | 1251 | 
  | 
 
 
 
 
 
 | 1252 | 
 //Drop table widget context menu | 
 
 
 
 
 
 | 1253 | 
 void MainWindow::dtContextMenu(DropTableWidget* myTable, QContextMenuEvent *event){ | 
 
 
 
 
 
 | 1254 | 
     QModelIndex index = myTable->indexAt(event->pos()); | 
 
 
 
 
 
 | 1255 | 
  | 
 
 
 
 
 
 | 1256 | 
     //item exists? | 
 
 
 
 
 
 | 1257 | 
     if(!index.isValid()) | 
 
 
 
 
 
 | 1258 | 
         return; | 
 
 
 
 
 
 | 1259 | 
  | 
 
 
 
 
 
 | 1260 | 
     if(myTable->selectionModel()->selectedRows().size()==0){ //No multiple rows selected | 
 
 
 
 
 
 | 1261 | 
         myTable->selectRow(myTable->itemAt(event->pos())->row()); //select all the row of the item clicked | 
 
 
 
 
 
 | 1262 | 
     } | 
 
 
 
 
 
 | 1263 | 
  | 
 
 
 
 
 
 | 1264 | 
     QList<int> selectedRows = QList<int>(); | 
 
 
 
 
 
 | 1265 | 
  | 
 
 
 
 
 
 | 1266 | 
     foreach(QModelIndex rowItem, myTable->selectionModel()->selectedRows()){ | 
 
 
 
 
 
 | 1267 | 
         selectedRows << rowItem.row(); | 
 
 
 
 
 
 | 1268 | 
     } | 
 
 
 
 
 
 | 1269 | 
  | 
 
 
 
 
 
 | 1270 | 
     QMenu *menu = new QMenu(); | 
 
 
 
 
 
 | 1271 | 
     QAction *copy = new QAction("Copy",myTable); | 
 
 
 
 
 
 | 1272 | 
     QAction *moveUp = new QAction("Move Up",myTable); | 
 
 
 
 
 
 | 1273 | 
     QAction *moveDown = new QAction("Move Down",myTable); | 
 
 
 
 
 
 | 1274 | 
     QAction *changeOptions = new QAction("Change To Current Options",myTable); | 
 
 
 
 
 
 | 1275 | 
     QMenu *changeOutput = new QMenu("Change Output for:"); | 
 
 
 
 
 
 | 1276 | 
     QAction *outWorkspace = new QAction("Workspace",myTable); | 
 
 
 
 
 
 | 1277 | 
     QAction *outCurrOutput = new QAction("Current Output Folder",myTable); | 
 
 
 
 
 
 | 1278 | 
     QAction *outOther = new QAction("Other...",myTable); | 
 
 
 
 
 
 | 1279 | 
     QAction *edisable = new QAction("Enable/Disable",myTable); | 
 
 
 
 
 
 | 1280 | 
  | 
 
 
 
 
 
 | 1281 | 
     menu->addAction(copy); | 
 
 
 
 
 
 | 1282 | 
     menu->addSeparator(); | 
 
 
 
 
 
 | 1283 | 
     menu->addAction(moveUp); | 
 
 
 
 
 
 | 1284 | 
     menu->addAction(moveDown); | 
 
 
 
 
 
 | 1285 | 
     menu->addSeparator(); | 
 
 
 
 
 
 | 1286 | 
     menu->addAction(changeOptions); | 
 
 
 
 
 
 | 1287 | 
     menu->addMenu(changeOutput); | 
 
 
 
 
 
 | 1288 | 
     changeOutput->addActions(QList<QAction*>() << outWorkspace << outCurrOutput << outOther); | 
 
 
 
 
 
 | 1289 | 
     menu->addAction(edisable); | 
 
 
 
 
 
 | 1290 | 
  | 
 
 
 
 
 
 | 1291 | 
  | 
 
 
 
 
 
 | 1292 | 
     //if it's in the first row it can't be setted up | 
 
 
 
 
 
 | 1293 | 
     if(selectedRows.at(0)==0){ | 
 
 
 
 
 
 | 1294 | 
         moveUp->setEnabled(false); | 
 
 
 
 
 
 | 1295 | 
     } | 
 
 
 
 
 
 | 1296 | 
  | 
 
 
 
 
 
 | 1297 | 
     //if we are at bottom we can't go down | 
 
 
 
 
 
 | 1298 | 
     if(selectedRows.at(selectedRows.size()-1)==myTable->rowCount()-1){ | 
 
 
 
 
 
 | 1299 | 
         moveDown->setEnabled(false); | 
 
 
 
 
 
 | 1300 | 
     } | 
 
 
 
 
 
 | 1301 | 
  | 
 
 
 
 
 
 | 1302 | 
     //Can we change the settings? (the conversion must be the same) | 
 
 
 
 
 
 | 1303 | 
     QString currentSettings = (getTypeConversion(myTable)); //call function at the mainWindow with a signal (different threads?) | 
 
 
 
 
 
 | 1304 | 
     foreach(int row, selectedRows){ | 
 
 
 
 
 
 | 1305 | 
         if( myTable->item(row,1)->text() != currentSettings){ //If we find out any of the selected items can't be convert disable operation | 
 
 
 
 
 
 | 1306 | 
             changeOptions->setEnabled(false); | 
 
 
 
 
 
 | 1307 | 
             break; | 
 
 
 
 
 
 | 1308 | 
         } | 
 
 
 
 
 
 | 1309 | 
     } | 
 
 
 
 
 
 | 1310 | 
  | 
 
 
 
 
 
 | 1311 | 
     QAction* selectedOption = menu->exec(event->globalPos()); | 
 
 
 
 
 
 | 1312 | 
  | 
 
 
 
 
 
 | 1313 | 
     if(selectedOption==copy){ | 
 
 
 
 
 
 | 1314 | 
         //Let's copy the contents to the clipboard | 
 
 
 
 
 
 | 1315 | 
  | 
 
 
 
 
 
 | 1316 | 
         QString toCopy; | 
 
 
 
 
 
 | 1317 | 
  | 
 
 
 
 
 
 | 1318 | 
         int size=selectedRows.size(); | 
 
 
 
 
 
 | 1319 | 
  | 
 
 
 
 
 
 | 1320 | 
         //Let's format it a bit... | 
 
 
 
 
 
 | 1321 | 
         for(int i=0; i<size; i++){ | 
 
 
 
 
 
 | 1322 | 
             for(int j=0; j<myTable->columnCount(); j++){ | 
 
 
 
 
 
 | 1323 | 
                 toCopy+=myTable->item(selectedRows.at(i),j)->text(); | 
 
 
 
 
 
 | 1324 | 
                 if(j!=myTable->columnCount()-1){ | 
 
 
 
 
 
 | 1325 | 
                     toCopy+="\t"; | 
 
 
 
 
 
 | 1326 | 
                 } | 
 
 
 
 
 
 | 1327 | 
             } | 
 
 
 
 
 
 | 1328 | 
             if(i!=size-1){ | 
 
 
 
 
 
 | 1329 | 
                 toCopy+="\n"; | 
 
 
 
 
 
 | 1330 | 
             } | 
 
 
 
 
 
 | 1331 | 
         } | 
 
 
 
 
 
 | 1332 | 
  | 
 
 
 
 
 
 | 1333 | 
         QApplication::clipboard()->setText(toCopy); | 
 
 
 
 
 
 | 1334 | 
         showSuccessStatusMessage(QString::number(size) + (size==1?" item ":" items ")+ "copied to the clipboard"); | 
 
 
 
 
 
 | 1335 | 
     } | 
 
 
 
 
 
 | 1336 | 
     else if(selectedOption==moveUp){ | 
 
 
 
 
 
 | 1337 | 
         qSort(selectedRows); //let's order the selections by the row number, so we know exactly how to swap it | 
 
 
 
 
 
 | 1338 | 
         myTable->swapPositions(selectedRows,-1); | 
 
 
 
 
 
 | 1339 | 
     } | 
 
 
 
 
 
 | 1340 | 
     else if(selectedOption==moveDown){ | 
 
 
 
 
 
 | 1341 | 
         qSort(selectedRows); | 
 
 
 
 
 
 | 1342 | 
         myTable->swapPositions(selectedRows,+1); | 
 
 
 
 
 
 | 1343 | 
     } | 
 
 
 
 
 
 | 1344 | 
     else if(selectedOption==changeOptions){ | 
 
 
 
 
 
 | 1345 | 
         changeToCurrentSettings(selectedRows,myTable); | 
 
 
 
 
 
 | 1346 | 
     } | 
 
 
 
 
 
 | 1347 | 
     else if(selectedOption==outWorkspace){ | 
 
 
 
 
 
 | 1348 | 
         changeItemsOutput(myTable,selectedRows,this->workspaceLocation); | 
 
 
 
 
 
 | 1349 | 
     } | 
 
 
 
 
 
 | 1350 | 
     else if(selectedOption==outCurrOutput){ | 
 
 
 
 
 
 | 1351 | 
         changeItemsOutput(myTable,selectedRows,this->outputFolder); | 
 
 
 
 
 
 | 1352 | 
     } | 
 
 
 
 
 
 | 1353 | 
     else if(selectedOption==outOther){ | 
 
 
 
 
 
 | 1354 | 
  | 
 
 
 
 
 
 | 1355 | 
         QString newDir=QFileDialog::getExistingDirectory(this,"Choose the folder for the output of the files selected...",this->AeLocation+"/GameDataFolder"); | 
 
 
 
 
 
 | 1356 | 
         newDir=Util::normalizePath(newDir); | 
 
 
 
 
 
 | 1357 | 
  | 
 
 
 
 
 
 | 1358 | 
         if(newDir.isEmpty()){ | 
 
 
 
 
 
 | 1359 | 
             return; //do nothing | 
 
 
 
 
 
 | 1360 | 
         } | 
 
 
 
 
 
 | 1361 | 
  | 
 
 
 
 
 
 | 1362 | 
         changeItemsOutput(myTable,selectedRows,newDir); | 
 
 
 
 
 
 | 1363 | 
  | 
 
 
 
 
 
 | 1364 | 
     } | 
 
 
 
 
 
 | 1365 | 
     else if(selectedOption==edisable){ | 
 
 
 
 
 
 | 1366 | 
  | 
 
 
 
 
 
 | 1367 | 
         int enabledCount=0, disabledCount=0; | 
 
 
 
 
 
 | 1368 | 
  | 
 
 
 
 
 
 | 1369 | 
         for(int i=0; i<selectedRows.size(); i++){ | 
 
 
 
 
 
 | 1370 | 
  | 
 
 
 
 
 
 | 1371 | 
             for(int j=0; j<myTable->columnCount(); j++){ | 
 
 
 
 
 
 | 1372 | 
                 QTableWidgetItem *currentItem=myTable->item(selectedRows.at(i),j); | 
 
 
 
 
 
 | 1373 | 
  | 
 
 
 
 
 
 | 1374 | 
                 if(currentItem->background()!=myTable->disabledBackStyle){ | 
 
 
 
 
 
 | 1375 | 
                     myTable->setDisableStyleWidgetItem(currentItem); | 
 
 
 
 
 
 | 1376 | 
                     if(j==0){ //Only count the row, not the columns | 
 
 
 
 
 
 | 1377 | 
                         disabledCount++; | 
 
 
 
 
 
 | 1378 | 
                     } | 
 
 
 
 
 
 | 1379 | 
                 } | 
 
 
 
 
 
 | 1380 | 
                 else{ //reset to initial state (enable) | 
 
 
 
 
 
 | 1381 | 
                     myTable->resetStyleWidgetItem(currentItem); | 
 
 
 
 
 
 | 1382 | 
                     if(j==0){ | 
 
 
 
 
 
 | 1383 | 
                         enabledCount++; | 
 
 
 
 
 
 | 1384 | 
                     } | 
 
 
 
 
 
 | 1385 | 
                 } | 
 
 
 
 
 
 | 1386 | 
             } | 
 
 
 
 
 
 | 1387 | 
         } | 
 
 
 
 
 
 | 1388 | 
  | 
 
 
 
 
 
 | 1389 | 
         QString result; | 
 
 
 
 
 
 | 1390 | 
  | 
 
 
 
 
 
 | 1391 | 
         if(enabledCount!=0){ | 
 
 
 
 
 
 | 1392 | 
             result+=QString::number(enabledCount) + (enabledCount==1?" item ":" items ") + "Enabled"; | 
 
 
 
 
 
 | 1393 | 
         } | 
 
 
 
 
 
 | 1394 | 
         if(enabledCount!=0 && disabledCount!=0){ | 
 
 
 
 
 
 | 1395 | 
             result+=" and "; | 
 
 
 
 
 
 | 1396 | 
         } | 
 
 
 
 
 
 | 1397 | 
         if(disabledCount!=0){ | 
 
 
 
 
 
 | 1398 | 
             result+=QString::number(disabledCount) + (disabledCount==1?" item ":" items ") + "Disabled"; | 
 
 
 
 
 
 | 1399 | 
         } | 
 
 
 
 
 
 | 1400 | 
  | 
 
 
 
 
 
 | 1401 | 
         showSuccessStatusMessage(result); | 
 
 
 
 
 
 | 1402 | 
     } | 
 
 
 
 
 
 | 1403 | 
  | 
 
 
 
 
 
 | 1404 | 
     delete copy; | 
 
 
 
 
 
 | 1405 | 
     delete moveUp; | 
 
 
 
 
 
 | 1406 | 
     delete moveDown; | 
 
 
 
 
 
 | 1407 | 
     delete changeOptions; | 
 
 
 
 
 
 | 1408 | 
     delete outWorkspace; | 
 
 
 
 
 
 | 1409 | 
     delete outCurrOutput; | 
 
 
 
 
 
 | 1410 | 
     delete outOther; | 
 
 
 
 
 
 | 1411 | 
     delete changeOutput; | 
 
 
 
 
 
 | 1412 | 
     delete edisable; | 
 
 
 
 
 
 | 1413 | 
     delete menu; | 
 
 
 
 
 
 | 1414 | 
 } | 
 
 
 
 
 
 | 1415 | 
  | 
 
 
 
 
 
 | 1416 | 
 void MainWindow::changeToCurrentSettings(QList<int> rows, DropTableWidget* myTable){ | 
 
 
 
 
 
 | 1417 | 
     //construct a command for each one | 
 
 
 
 
 
 | 1418 | 
     //Output a status message saying the number of changed files | 
 
 
 
 
 
 | 1419 | 
     QString fromTo=getTypeConversion(myTable); | 
 
 
 
 
 
 | 1420 | 
     QString from = QString(fromTo).remove(fromTo.indexOf(" >"),fromTo.size()-1); //parse the string to get the from, only 1 time parsed by each group of files = very fast | 
 
 
 
 
 
 | 1421 | 
     QString to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> " | 
 
 
 
 
 
 | 1422 | 
  | 
 
 
 
 
 
 | 1423 | 
     QString command; | 
 
 
 
 
 
 | 1424 | 
  | 
 
 
 
 
 
 | 1425 | 
     foreach(int row, rows){ | 
 
 
 
 
 
 | 1426 | 
  | 
 
 
 
 
 
 | 1427 | 
         command=getCommand(myTable,getFileOutputFolder(fromTo,myTable->getOutputAbsolute(row)),from,to,myTable->getFileAbsolute(row)); | 
 
 
 
 
 
 | 1428 | 
  | 
 
 
 
 
 
 | 1429 | 
         if(command.isEmpty()){ //something wrong was happening (not inputted a texture name?) | 
 
 
 
 
 
 | 1430 | 
             return; //stop changing settings | 
 
 
 
 
 
 | 1431 | 
         } | 
 
 
 
 
 
 | 1432 | 
  | 
 
 
 
 
 
 | 1433 | 
         myTable->item(row,2)->setText(command); //update settings to the current row | 
 
 
 
 
 
 | 1434 | 
         myTable->updateTableToolTips(row); | 
 
 
 
 
 
 | 1435 | 
     } | 
 
 
 
 
 
 | 1436 | 
  | 
 
 
 
 
 
 | 1437 | 
     showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed to the current settings"); | 
 
 
 
 
 
 | 1438 | 
 } | 
 
 
 
 
 
 | 1439 | 
  | 
 
 
 
 
 
 | 1440 | 
 void MainWindow::changeItemsOutput(DropTableWidget* myTable, QList<int> rows, QString newOutput){ | 
 
 
 
 
 
 | 1441 | 
  | 
 
 
 
 
 
 | 1442 | 
     QString command, currentAbsoluteFile, fromTo, from, to; | 
 
 
 
 
 
 | 1443 | 
  | 
 
 
 
 
 
 | 1444 | 
     foreach(int row, rows){ //No optimization possible here, commands may be different | 
 
 
 
 
 
 | 1445 | 
         fromTo=myTable->item(row,1)->text(); | 
 
 
 
 
 
 | 1446 | 
         from = QString(fromTo).remove(fromTo.indexOf(" >"),fromTo.size()-1); //parse the string to get the from | 
 
 
 
 
 
 | 1447 | 
         to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> " | 
 
 
 
 
 
 | 1448 | 
  | 
 
 
 
 
 
 | 1449 | 
         currentAbsoluteFile=myTable->getFileAbsolute(row); | 
 
 
 
 
 
 | 1450 | 
         command=getCommand(myTable,getFileOutputFolder(fromTo,newOutput),from,to,currentAbsoluteFile); | 
 
 
 
 
 
 | 1451 | 
  | 
 
 
 
 
 
 | 1452 | 
         if(command.isEmpty()){ //something wrong was happening (not inputted a texture name?) | 
 
 
 
 
 
 | 1453 | 
             return; //stop changing output | 
 
 
 
 
 
 | 1454 | 
         } | 
 
 
 
 
 
 | 1455 | 
  | 
 
 
 
 
 
 | 1456 | 
         myTable->item(row,2)->setText(command); //update command to the current row | 
 
 
 
 
 
 | 1457 | 
         myTable->updateTableToolTips(row); | 
 
 
 
 
 
 | 1458 | 
     } | 
 
 
 
 
 
 | 1459 | 
  | 
 
 
 
 
 
 | 1460 | 
     showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed the output to "+(newOutput!=this->workspaceLocation?Util::cutName(newOutput):"Vago workspace")); | 
 
 
 
 
 
 | 1461 | 
 } | 
 
 
 
 
 
 | 1462 | 
  | 
 
 
 
 
 
 | 1463 | 
 QString MainWindow::getCommand(DropTableWidget* myTable, QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 
 | 1464 | 
     if(myTable==ui->twSourcesGeneral){ //So we only need to parse one command. | 
 
 
 
 
 
 | 1465 | 
         return fileParsingGeneral(myOutputFolder,from,to,file); | 
 
 
 
 
 
 | 1466 | 
     } | 
 
 
 
 
 
 | 1467 | 
     else if(myTable==ui->twSourcesTextures){ | 
 
 
 
 
 
 | 1468 | 
         return fileParsingTextures(myOutputFolder,from,to,file); | 
 
 
 
 
 
 | 1469 | 
     } | 
 
 
 
 
 
 | 1470 | 
     else if(myTable==ui->twSourcesModels){ | 
 
 
 
 
 
 | 1471 | 
         return fileParsingModels(myOutputFolder,from,to,file); | 
 
 
 
 
 
 | 1472 | 
     } | 
 
 
 
 
 
 | 1473 | 
     else if(myTable==ui->twSourcesAnimations){ | 
 
 
 
 
 
 | 1474 | 
         return fileParsingAnimations(myOutputFolder,from,to,file); | 
 
 
 
 
 
 | 1475 | 
     } | 
 
 
 
 
 
 | 1476 | 
     else if(myTable==ui->twSourcesLevels){ | 
 
 
 
 
 
 | 1477 | 
         return fileParsingLevels(myOutputFolder,from,to,file); | 
 
 
 
 
 
 | 1478 | 
     } | 
 
 
 
 
 
 | 1479 | 
     else{ | 
 
 
 
 
 
 | 1480 | 
         return fileParsingMisc(myOutputFolder,from,to,file); | 
 
 
 
 
 
 | 1481 | 
     } | 
 
 
 
 
 
 | 1482 | 
  | 
 
 
 
 
 
 | 1483 | 
 } | 
 
 
 
 
 
 | 1484 | 
  | 
 
 
 
 
 
 | 1485 | 
 /** | 
 
 
 
 
 
 | 1486 | 
   This is OS indepented. It maintain size ratio over the Windows and Mac. | 
 
 
 
 
 
 | 1487 | 
   **/ | 
 
 
 
 
 
 | 1488 | 
 void MainWindow::setConverterButtonsSize(){ | 
 
 
 
 
 
 | 1489 | 
     int height=ui->pbConvertGeneral->sizeHint().height()*1.3; | 
 
 
 
 
 
 | 1490 | 
     ui->pbConvertGeneral->setMinimumHeight(height); | 
 
 
 
 
 
 | 1491 | 
     ui->pbConvertTextures->setMinimumHeight(height); | 
 
 
 
 
 
 | 1492 | 
     ui->pbConvertModels->setMinimumHeight(height); | 
 
 
 
 
 
 | 1493 | 
     ui->pbConvertAnimations->setMinimumHeight(height); | 
 
 
 
 
 
 | 1494 | 
     ui->pbConvertLevels->setMinimumHeight(height); | 
 
 
 
 
 
 | 1495 | 
     ui->pbConvertMisc->setMinimumHeight(height); | 
 
 
 
 
 
 | 1496 | 
 } | 
 
 
 
 
 
 | 1497 | 
  | 
 
 
 
 
 
 | 1498 | 
 void MainWindow::connectSlots(){ | 
 
 
 
 
 
 | 1499 | 
  | 
 
 
 
 
 
 | 1500 | 
     //This signal is for thread that is working setup the progress bar (make it visible and set it's min-max) | 
 
 
 
 
 
 | 1501 | 
     connect(myConverter, SIGNAL(setupPB(int)), this, SLOT(TsetupProgressBar(int)), Qt::BlockingQueuedConnection); | 
 
 
 
 
 
 | 1502 | 
  | 
 
 
 
 
 
 | 1503 | 
     //This signal is for thread that is working can update the progress bar of the gui | 
 
 
 
 
 
 | 1504 | 
     connect(myConverter, SIGNAL(taskDone()), this, SLOT(TupdateProgressBar()),Qt::BlockingQueuedConnection); | 
 
 
 
 
 
 | 1505 | 
  | 
 
 
 
 
 
 | 1506 | 
     //This signal is for thread that is working can show the result of a conversion | 
 
 
 
 
 
 | 1507 | 
     connect(myConverter, SIGNAL(resultConversion(QString,int)), this, SLOT(TresultConversion(QString,int))); | 
 
 
 
 
 
 | 1508 | 
  | 
 
 
 
 
 
 | 1509 | 
     //Drop signal for General table | 
 
 
 
 
 
 | 1510 | 
     connect(ui->twSourcesGeneral, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 
 | 1511 | 
  | 
 
 
 
 
 
 | 1512 | 
     //Drop signal for Textures table | 
 
 
 
 
 
 | 1513 | 
     connect(ui->twSourcesTextures, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 
 | 1514 | 
  | 
 
 
 
 
 
 | 1515 | 
     //Drop signal for Models table | 
 
 
 
 
 
 | 1516 | 
     connect(ui->twSourcesModels, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 
 | 1517 | 
  | 
 
 
 
 
 
 | 1518 | 
     //Drop signal for Animations table | 
 
 
 
 
 
 | 1519 | 
     connect(ui->twSourcesAnimations, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 
 | 1520 | 
  | 
 
 
 
 
 
 | 1521 | 
     //Drop signal for Levels table | 
 
 
 
 
 
 | 1522 | 
     connect(ui->twSourcesLevels, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 
 | 1523 | 
  | 
 
 
 
 
 
 | 1524 | 
     //Drop signal for Misc table | 
 
 
 
 
 
 | 1525 | 
     connect(ui->twSourcesMisc, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 
 | 1526 | 
  | 
 
 
 
 
 
 | 1527 | 
     //Context menu for General table | 
 
 
 
 
 
 | 1528 | 
     connect(ui->twSourcesGeneral, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 
 | 1529 | 
  | 
 
 
 
 
 
 | 1530 | 
     //Context menu for Textures table | 
 
 
 
 
 
 | 1531 | 
     connect(ui->twSourcesTextures, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 
 | 1532 | 
  | 
 
 
 
 
 
 | 1533 | 
     //Context menu for Models table | 
 
 
 
 
 
 | 1534 | 
     connect(ui->twSourcesModels, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 
 | 1535 | 
  | 
 
 
 
 
 
 | 1536 | 
     //Context menu for Animations table | 
 
 
 
 
 
 | 1537 | 
     connect(ui->twSourcesAnimations, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 
 | 1538 | 
  | 
 
 
 
 
 
 | 1539 | 
     //Context menu for Levels table | 
 
 
 
 
 
 | 1540 | 
     connect(ui->twSourcesLevels, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 
 | 1541 | 
  | 
 
 
 
 
 
 | 1542 | 
     //Context menu for Misc table | 
 
 
 
 
 
 | 1543 | 
     connect(ui->twSourcesMisc, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 
 | 1544 | 
 } | 
 
 
 
 
 
 | 1545 | 
  | 
 
 
 
 
 
 | 1546 | 
  |