| 9 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 10 | 
   | 
     ui->setupUi(this); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 12 | 
 < | 
     this->setWindowTitle("Vago v"+GlobalVars::AppVersion); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 | 
 > | 
     this->AppDir=getOSIndependentAppPath(); | 
 
 
 
 
 
 | 13 | 
 > | 
  | 
 
 
 
 
 
 | 14 | 
 > | 
     this->myLogger = new Logger(this->AppDir); //start logger | 
 
 
 
 
 
 
 
 
 
 
 
 | 15 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 16 | 
 < | 
     // QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale ()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 16 | 
 > | 
     this->myLogger->writeString("Detected AppDir: "+this->AppDir); | 
 
 
 
 
 
 | 17 | 
 > | 
     this->myLogger->writeString("True app dir: "+QDir::currentPath()); | 
 
 
 
 
 
 
 
 
 
 
 
 | 18 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 19 | 
 < | 
     if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitExeName)){ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 19 | 
 > | 
     this->setWindowTitle("Vago v"+GlobalVars::AppVersion); | 
 
 
 
 
 
 | 20 | 
 > | 
  | 
 
 
 
 
 
 | 21 | 
 > | 
     if(!QFile::exists(this->AppDir+"/"+GlobalVars::OniSplitString)){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 22 | 
   | 
         Util::showErrorPopUp("OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit."); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 | 
   | 
         exit(1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 26 | 
 < | 
     if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsExeName)){ | 
 
 
 
 
 
 
 
 
 
 | 26 | 
 > | 
     if(!QFile::exists(this->AppDir+"/"+GlobalVars::XmlToolsString)){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 27 | 
   | 
         Util::showErrorPopUp("xmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit."); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 | 
   | 
         exit(1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 30 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 31 | 
 < | 
     this->vagoSettings = new QSettings(QDir::currentPath() + "/" + this->VagoSettingsName, QSettings::IniFormat); | 
 
 
 
 
 
 
 
 
 
 | 31 | 
 > | 
     this->vagoSettings = new QSettings(this->AppDir + "/" + this->VagoSettingsName, QSettings::IniFormat); | 
 
 
 
 
 
 
 
 
 
 
 
 | 32 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 33 | 
   | 
     //First Execution? Old configuration? Settings missed? | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 | 
   | 
     bool iniChanged=false; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 | 
   | 
         iniChanged=true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 39 | 
   | 
     if(!this->vagoSettings->contains("Workspace")){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 40 | 
 < | 
         this->vagoSettings->setValue("Workspace", QDir::currentPath()+"/VagoWorkspace"); | 
 
 
 
 
 
 
 
 
 
 | 40 | 
 > | 
         this->vagoSettings->setValue("Workspace", this->AppDir+"/VagoWorkspace"); | 
 
 
 
 
 
 
 
 
 
 
 
 | 41 | 
   | 
         iniChanged=true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 42 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 43 | 
   | 
     if(!this->vagoSettings->contains("AeFolder")){ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 46 | 
   | 
         QString aefolder=Util::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder...")); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 47 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 48 | 
   | 
         if(aefolder.isEmpty()){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 49 | 
 < | 
             Util::showErrorPopUp("AE folder is mandatory. Application will exit."); | 
 
 
 
 
 
 
 
 
 
 | 49 | 
 > | 
             Util::showErrorPopUp("AE folder is mandatory. Application will now exit."); | 
 
 
 
 
 
 
 
 
 
 
 
 | 50 | 
   | 
             exit(1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 51 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 52 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 95 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 96 | 
   | 
     ui->statusBar->addPermanentWidget(myBar); //this adds automatically in right | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 97 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 93 | 
 – | 
     this->myLogger = new Logger(); //start logger | 
 
 
 
 
 
 
 
 
 
 | 94 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 98 | 
   | 
     //Initialize list pointers | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 99 | 
   | 
     this->listToProccess = new QStringList; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 100 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
   | 
     //Create a thread for do the conversion in background | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 | 
   | 
     this->myConverter = new Converter(this->myLogger,this->listToProccess); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 103 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 104 | 
 + | 
     // User interface | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
   | 
     ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 | 
   | 
     ui->mainToolBar->addWidget(ui->emptySpacerLabel); //trick, we can't add directly a space so we add an empty | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 | 
   | 
     ui->mainToolBar->addWidget(ui->tbOni); //add oni launch buttonlabel | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 112 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 113 | 
   | 
     ui->mainToolBar->setLayoutDirection(Qt::RightToLeft); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 114 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 115 | 
 + | 
     setConverterButtonsSize(); | 
 
 
 
 
 
 
 
 
 | 116 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 117 | 
 + | 
 #ifdef Q_WS_MAC | 
 
 
 
 
 
 
 
 
 | 118 | 
 + | 
     // 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 | 
 
 
 
 
 
 
 
 
 | 119 | 
 + | 
     ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows | 
 
 
 
 
 
 
 
 
 | 120 | 
 + | 
     // Set mac platform the first one in the menu, and also make it checkable by default | 
 
 
 
 
 
 
 
 
 | 121 | 
 + | 
     ui->menuTarget_Platform->removeAction(ui->actionWindows); | 
 
 
 
 
 
 
 
 
 | 122 | 
 + | 
     ui->menuTarget_Platform->addAction(ui->actionWindows); | 
 
 
 
 
 
 
 
 
 | 123 | 
 + | 
     ui->actionWindows->setChecked(false); | 
 
 
 
 
 
 
 
 
 | 124 | 
 + | 
     ui->actionMac_Windows_demo->setChecked(true); | 
 
 
 
 
 
 
 
 
 | 125 | 
 + | 
     resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better | 
 
 
 
 
 
 
 
 
 | 126 | 
 + | 
     // because the components on mac use more space | 
 
 
 
 
 
 
 
 
 | 127 | 
 + | 
 #else | 
 
 
 
 
 
 
 
 
 | 128 | 
 + | 
     resize(640,480); | 
 
 
 
 
 
 
 
 
 | 129 | 
 + | 
 #endif | 
 
 
 
 
 
 
 
 
 | 130 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 131 | 
   | 
     connectSlots(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 132 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 133 | 
   | 
     //Commands Mapping | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 165 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 166 | 
   | 
 void MainWindow::on_actionSound_Wizard_triggered() | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 167 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 | 168 | 
 < | 
     SoundWizard myWizard (this->workspaceWizardsLocation, this->myLogger, &this->commandMap); | 
 
 
 
 
 
 
 
 
 
 | 168 | 
 > | 
     SoundWizard myWizard (this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap); | 
 
 
 
 
 
 
 
 
 
 
 
 | 169 | 
   | 
     myWizard.exec(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 170 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 171 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 173 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 174 | 
   | 
     QStringList arguments; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 175 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 176 | 
 < | 
     if(this->vagoSettings->value("OniWindow").toBool()){ //Run in a window? | 
 
 
 
 
 
 
 
 
 
 | 176 | 
 > | 
     if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window? | 
 
 
 
 
 
 
 
 
 
 
 
 | 177 | 
   | 
         arguments << "-noswitch"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 178 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 | 179 | 
 + | 
 #ifdef Q_WS_WIN | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 180 | 
   | 
     else{ | 
 
 
 
 
 
 
 
 
 
 
 
 | 181 | 
 < | 
         arguments << "-switch"; | 
 
 
 
 
 
 
 
 
 
 | 181 | 
 > | 
         arguments << "-switch"; // only supported on windows. Was added by daodan dll. | 
 
 
 
 
 
 
 
 
 
 
 
 | 182 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 | 183 | 
 + | 
 #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 184 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 185 | 
 < | 
     arguments << " -debugfiles"; | 
 
 
 
 
 
 
 
 
 
 | 185 | 
 > | 
     arguments << "-debugfiles"; | 
 
 
 
 
 
 
 
 
 
 
 
 | 186 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 187 | 
 < | 
     if(!QProcess::startDetached(this->AeLocation+"/Oni.exe",arguments,this->AeLocation)){ | 
 
 
 
 
 
 
 
 
 
 | 187 | 
 > | 
     if(!QProcess::startDetached(this->AeLocation+"/"+GlobalVars::OniExe,arguments,this->AeLocation)){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 188 | 
   | 
         showErrStatusMessage("Oni could not be started!"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 189 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 190 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 193 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 194 | 
   | 
     // If the app turn out someday to a native app use QProcess::startDetached instead... | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 195 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 196 | 
 < | 
     if(!QDesktopServices::openUrl(this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){ | 
 
 
 
 
 
 
 
 
 
 | 196 | 
 > | 
     if(!QDesktopServices::openUrl("file:///"+this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 197 | 
   | 
         showErrStatusMessage("Could not start AE Installer!"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 198 | 
   | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 199 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1491 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1492 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1493 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 1494 | 
 + | 
 /** | 
 
 
 
 
 
 
 
 
 | 1495 | 
 + | 
   This is OS indepented. It maintain size ratio over the Windows and Mac. | 
 
 
 
 
 
 
 
 
 | 1496 | 
 + | 
   **/ | 
 
 
 
 
 
 
 
 
 | 1497 | 
 + | 
 void MainWindow::setConverterButtonsSize(){ | 
 
 
 
 
 
 
 
 
 | 1498 | 
 + | 
     int height=ui->pbConvertGeneral->sizeHint().height()*1.3; | 
 
 
 
 
 
 
 
 
 | 1499 | 
 + | 
     ui->pbConvertGeneral->setMinimumHeight(height); | 
 
 
 
 
 
 
 
 
 | 1500 | 
 + | 
     ui->pbConvertTextures->setMinimumHeight(height); | 
 
 
 
 
 
 
 
 
 | 1501 | 
 + | 
     ui->pbConvertModels->setMinimumHeight(height); | 
 
 
 
 
 
 
 
 
 | 1502 | 
 + | 
     ui->pbConvertAnimations->setMinimumHeight(height); | 
 
 
 
 
 
 
 
 
 | 1503 | 
 + | 
     ui->pbConvertLevels->setMinimumHeight(height); | 
 
 
 
 
 
 
 
 
 | 1504 | 
 + | 
     ui->pbConvertMisc->setMinimumHeight(height); | 
 
 
 
 
 
 
 
 
 | 1505 | 
 + | 
 } | 
 
 
 
 
 
 
 
 
 | 1506 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 1507 | 
 + | 
 /** | 
 
 
 
 
 
 
 
 
 | 1508 | 
 + | 
   Gets application directory. In mac os gets the .app directory | 
 
 
 
 
 
 
 
 
 | 1509 | 
 + | 
   **/ | 
 
 
 
 
 
 
 
 
 | 1510 | 
 + | 
 QString MainWindow::getOSIndependentAppPath(){ | 
 
 
 
 
 
 
 
 
 | 1511 | 
 + | 
 #ifdef Q_WS_MAC | 
 
 
 
 
 
 
 
 
 | 1512 | 
 + | 
     QDir dir = QDir::current(); | 
 
 
 
 
 
 
 
 
 | 1513 | 
 + | 
     if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it | 
 
 
 
 
 
 
 
 
 | 1514 | 
 + | 
         dir.cdUp(); | 
 
 
 
 
 
 
 
 
 | 1515 | 
 + | 
         dir.cdUp(); | 
 
 
 
 
 
 
 
 
 | 1516 | 
 + | 
         dir.cdUp(); | 
 
 
 
 
 
 
 
 
 | 1517 | 
 + | 
     } | 
 
 
 
 
 
 
 
 
 | 1518 | 
 + | 
     return dir.absolutePath(); | 
 
 
 
 
 
 
 
 
 | 1519 | 
 + | 
 #else | 
 
 
 
 
 
 
 
 
 | 1520 | 
 + | 
     return  QDir::currentPath(); | 
 
 
 
 
 
 
 
 
 | 1521 | 
 + | 
 #endif | 
 
 
 
 
 
 
 
 
 | 1522 | 
 + | 
 } | 
 
 
 
 
 
 
 
 
 | 1523 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1524 | 
   | 
 void MainWindow::connectSlots(){ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1525 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1526 | 
   | 
     //This signal is for thread that is working setup the progress bar (make it visible and set it's min-max) |