| 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->myLogger = new Logger(UtilVago::getAppPath(), GlobalVars::AppLogName); //start logger | 
 
 
 
 
 | 13 |  | 
 
 
 
 
 | 14 | this->myLogger->writeString("Detected AppDir: "+UtilVago::getAppPath()); | 
 
 
 
 
 | 15 | this->myLogger->writeString("True app dir: "+QDir::currentPath()); | 
 
 
 
 
 | 16 |  | 
 
 
 
 
 | 17 | setVagoWindowTitle(); | 
 
 
 
 
 | 18 |  | 
 
 
 
 
 | 19 | if(!QFile::exists(UtilVago::getOniSplitExeAbsolutePath())){ | 
 
 
 
 
 | 20 | UtilVago::showAndLogErrorPopUp(this->myLogger, "OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit."); | 
 
 
 
 
 | 21 | exit(1); | 
 
 
 
 
 | 22 | } | 
 
 
 
 
 | 23 |  | 
 
 
 
 
 | 24 | if(!QFile::exists(UtilVago::getXmlToolsExeAbsolutePath())){ | 
 
 
 
 
 | 25 | UtilVago::showAndLogErrorPopUp(this->myLogger, "XmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit."); | 
 
 
 
 
 | 26 | exit(1); | 
 
 
 
 
 | 27 | } | 
 
 
 
 
 | 28 |  | 
 
 
 
 
 | 29 | this->vagoSettings = new QSettings(UtilVago::getAppPath() + "/" + this->VagoSettingsName, QSettings::IniFormat); | 
 
 
 
 
 | 30 |  | 
 
 
 
 
 | 31 | //First Execution? Old configuration? Settings missed? | 
 
 
 
 
 | 32 | bool iniChanged=false; | 
 
 
 
 
 | 33 | if(!this->vagoSettings->contains("VagoVersion") || this->vagoSettings->value("VagoVersion")!=GlobalVars::AppVersion){ | 
 
 
 
 
 | 34 | this->vagoSettings->setValue("VagoVersion", GlobalVars::AppVersion); | 
 
 
 
 
 | 35 | iniChanged=true; | 
 
 
 
 
 | 36 | } | 
 
 
 
 
 | 37 | if(!this->vagoSettings->contains("Workspace")){ | 
 
 
 
 
 | 38 | this->vagoSettings->setValue("Workspace", UtilVago::getAppPath()+"/VagoWorkspace"); | 
 
 
 
 
 | 39 | iniChanged=true; | 
 
 
 
 
 | 40 | } | 
 
 
 
 
 | 41 | if(!this->vagoSettings->contains("AeFolder")){ | 
 
 
 
 
 | 42 |  | 
 
 
 
 
 | 43 | Util::showPopUp("Seems it's the first time you are executing Vago. \n\nPlease input your Anniversary Edition (AE) Folder."); | 
 
 
 
 
 | 44 | QString aefolder=Util::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder...")); | 
 
 
 
 
 | 45 |  | 
 
 
 
 
 | 46 | if(aefolder.isEmpty()){ | 
 
 
 
 
 | 47 | UtilVago::showAndLogErrorPopUp(this->myLogger, "AE folder is mandatory. Application will now exit."); | 
 
 
 
 
 | 48 | exit(1); | 
 
 
 
 
 | 49 | } | 
 
 
 
 
 | 50 |  | 
 
 
 
 
 | 51 | if(!aefolder.endsWith("AE")){ | 
 
 
 
 
 | 52 | 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."); | 
 
 
 
 
 | 53 | } | 
 
 
 
 
 | 54 |  | 
 
 
 
 
 | 55 | this->vagoSettings->setValue("AeFolder", aefolder); | 
 
 
 
 
 | 56 | iniChanged=true; | 
 
 
 
 
 | 57 | } | 
 
 
 
 
 | 58 | if(!this->vagoSettings->contains("WindowWidth")){ | 
 
 
 
 
 | 59 | this->vagoSettings->setValue("WindowWidth", GlobalVars::DefaultWindowWidth); | 
 
 
 
 
 | 60 | iniChanged=true; | 
 
 
 
 
 | 61 | } | 
 
 
 
 
 | 62 | if(!this->vagoSettings->contains("WindowHeight")){ | 
 
 
 
 
 | 63 | this->vagoSettings->setValue("WindowHeight", GlobalVars::DefaultWindowHeight); | 
 
 
 
 
 | 64 | iniChanged=true; | 
 
 
 
 
 | 65 | } | 
 
 
 
 
 | 66 | if(!this->vagoSettings->contains("OniWindow")){ | 
 
 
 
 
 | 67 | this->vagoSettings->setValue("OniWindow", true); | 
 
 
 
 
 | 68 | iniChanged=true; | 
 
 
 
 
 | 69 | } | 
 
 
 
 
 | 70 | if(!this->vagoSettings->contains("SeparateInWorkspace")){ | 
 
 
 
 
 | 71 | this->vagoSettings->setValue("SeparateInWorkspace",true); | 
 
 
 
 
 | 72 | iniChanged=true; | 
 
 
 
 
 | 73 | } | 
 
 
 
 
 | 74 | if(!this->vagoSettings->contains("ConfirmExit")){ | 
 
 
 
 
 | 75 | this->vagoSettings->setValue("ConfirmExit", false); | 
 
 
 
 
 | 76 | iniChanged=true; | 
 
 
 
 
 | 77 | } | 
 
 
 
 
 | 78 | if(!this->vagoSettings->contains("LastProjectPath")){ | 
 
 
 
 
 | 79 | this->vagoSettings->setValue("LastProjectPath", this->vagoSettings->value("Workspace")); | 
 
 
 
 
 | 80 | iniChanged=true; | 
 
 
 
 
 | 81 | } | 
 
 
 
 
 | 82 | for(int i=0; i<this->recentProjectsMaxSize; i++){ | 
 
 
 
 
 | 83 | if(!this->vagoSettings->contains("RecentProject" + QString::number(i+1))){ | 
 
 
 
 
 | 84 | this->vagoSettings->setValue("RecentProject" + QString::number(i+1), ""); | 
 
 
 
 
 | 85 | iniChanged=true; | 
 
 
 
 
 | 86 | } | 
 
 
 
 
 | 87 | } | 
 
 
 
 
 | 88 | #ifdef Q_OS_MAC | 
 
 
 
 
 | 89 | if(!this->vagoSettings->contains("useYesAsDefaultWhenRemovingItems")){ | 
 
 
 
 
 | 90 | this->vagoSettings->setValue("useYesAsDefaultWhenRemovingItems", false); | 
 
 
 
 
 | 91 | iniChanged=true; | 
 
 
 
 
 | 92 | } | 
 
 
 
 
 | 93 | #endif | 
 
 
 
 
 | 94 |  | 
 
 
 
 
 | 95 | if(iniChanged){ | 
 
 
 
 
 | 96 | this->vagoSettings->sync(); | 
 
 
 
 
 | 97 | } | 
 
 
 
 
 | 98 | /// | 
 
 
 
 
 | 99 |  | 
 
 
 
 
 | 100 | this->workspaceLocation=this->vagoSettings->value("Workspace").toString(); | 
 
 
 
 
 | 101 | this->workspaceWizardsLocation=this->workspaceLocation+"/Wizards"; | 
 
 
 
 
 | 102 | this->AeLocation=this->vagoSettings->value("AeFolder").toString(); | 
 
 
 
 
 | 103 | this->outputFolder=this->workspaceLocation; | 
 
 
 
 
 | 104 | this->startedWindowWidth=this->vagoSettings->value("WindowWidth").toInt(); | 
 
 
 
 
 | 105 | this->startedWindowHeight=this->vagoSettings->value("WindowHeight").toInt(); | 
 
 
 
 
 | 106 | #ifdef Q_OS_MAC | 
 
 
 
 
 | 107 | this->useYesAsDefaultWhenRemovingItems=this->vagoSettings->value("useYesAsDefaultWhenRemovingItems").toBool(); | 
 
 
 
 
 | 108 | #endif | 
 
 
 
 
 | 109 |  | 
 
 
 
 
 | 110 | //Create our workspace if it doesn't exists yet | 
 
 
 
 
 | 111 | if(!QDir(this->workspaceLocation).exists()){ | 
 
 
 
 
 | 112 | QDir().mkdir(this->workspaceLocation); | 
 
 
 
 
 | 113 | } | 
 
 
 
 
 | 114 | this->itemsLoaded=new QLabel(this); | 
 
 
 
 
 | 115 | ui->statusBar->addWidget(this->itemsLoaded); | 
 
 
 
 
 | 116 | this->myBar = new QProgressBar(this); | 
 
 
 
 
 | 117 | this->myBar->setTextVisible(false); //hides text | 
 
 
 
 
 | 118 |  | 
 
 
 
 
 | 119 | this->myBar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed); | 
 
 
 
 
 | 120 | this->myBar->setMinimumWidth(150); | 
 
 
 
 
 | 121 | this->myBar->hide(); //hide while not being used | 
 
 
 
 
 | 122 | ui->tbAbortConversion->hide(); //hide while not being used | 
 
 
 
 
 | 123 |  | 
 
 
 
 
 | 124 | ui->statusBar->addPermanentWidget(this->myBar); //this adds automatically in right | 
 
 
 
 
 | 125 | ui->statusBar->addPermanentWidget(ui->tbAbortConversion); | 
 
 
 
 
 | 126 |  | 
 
 
 
 
 | 127 | //Initialize list pointers | 
 
 
 
 
 | 128 | this->listToProccess = new QStringList; | 
 
 
 
 
 | 129 |  | 
 
 
 
 
 | 130 | // User interface | 
 
 
 
 
 | 131 | ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button | 
 
 
 
 
 | 132 | ui->mainToolBar->addWidget(ui->emptySpacerLabel); //trick, we can't add directly a space so we add an empty | 
 
 
 
 
 | 133 | ui->mainToolBar->addWidget(ui->tbOni); //add oni launch buttonlabel | 
 
 
 
 
 | 134 | ui->mainToolBar->addWidget(ui->emptySpacerLabel2); //same as before | 
 
 
 
 
 | 135 | ui->mainToolBar->addWidget(ui->tbCommand); //add option to manual onisplit commands | 
 
 
 
 
 | 136 | ui->mainToolBar->addWidget(ui->emptySpacerLabel3); //same as before | 
 
 
 
 
 | 137 | ui->mainToolBar->addWidget(ui->tbOpenFolder); //add option to open folder with files converted etc | 
 
 
 
 
 | 138 |  | 
 
 
 
 
 | 139 | ui->mainToolBar->setLayoutDirection(Qt::RightToLeft); | 
 
 
 
 
 | 140 |  | 
 
 
 
 
 | 141 | ui->pbConvert->setMinimumHeight(ui->pbConvert->sizeHint().height()*1.5); // This is OS indepented. It maintain size ratio over the Windows and Mac. | 
 
 
 
 
 | 142 |  | 
 
 
 
 
 | 143 |  | 
 
 
 
 
 | 144 | #ifdef Q_OS_MAC | 
 
 
 
 
 | 145 | // 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 | 
 
 
 
 
 | 146 | ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows | 
 
 
 
 
 | 147 | // Set mac platform the first one in the menu, and also make it checkable by default | 
 
 
 
 
 | 148 | ui->menuTarget_Platform->removeAction(ui->actionWindows); | 
 
 
 
 
 | 149 | ui->menuTarget_Platform->addAction(ui->actionWindows); | 
 
 
 
 
 | 150 | ui->actionWindows->setChecked(false); | 
 
 
 
 
 | 151 | ui->actionMac_Windows_demo->setChecked(true); | 
 
 
 
 
 | 152 | // resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better | 
 
 
 
 
 | 153 | //// because the components on mac use more space | 
 
 
 
 
 | 154 | #endif | 
 
 
 
 
 | 155 |  | 
 
 
 
 
 | 156 | resize(this->startedWindowWidth,this->startedWindowHeight); | 
 
 
 
 
 | 157 |  | 
 
 
 
 
 | 158 | #ifdef Q_OS_MAC | 
 
 
 
 
 | 159 | ui->pbConvert->setToolTip(ui->pbConvert->toolTip() + " (⌘ + Enter)"); | 
 
 
 
 
 | 160 | #else | 
 
 
 
 
 | 161 | ui->pbConvert->setToolTip(ui->pbConvert->toolTip() + " (Ctrl + Enter)"); | 
 
 
 
 
 | 162 | #endif | 
 
 
 
 
 | 163 |  | 
 
 
 
 
 | 164 | //Commands Mapping | 
 
 
 
 
 | 165 | this->commandMap = QHash<QString, QString>(); | 
 
 
 
 
 | 166 | mapCommands(); | 
 
 
 
 
 | 167 |  | 
 
 
 
 
 | 168 | updateItemsLoaded(ui->twSourcesXML); | 
 
 
 
 
 | 169 |  | 
 
 
 
 
 | 170 | loadRecentProjects(); | 
 
 
 
 
 | 171 | } | 
 
 
 
 
 | 172 |  | 
 
 
 
 
 | 173 | MainWindow::~MainWindow() | 
 
 
 
 
 | 174 | { | 
 
 
 
 
 | 175 | delete ui; | 
 
 
 
 
 | 176 | this->myLogger->writeString("Application Exited."); | 
 
 
 
 
 | 177 | } | 
 
 
 
 
 | 178 |  | 
 
 
 
 
 | 179 |  | 
 
 
 
 
 | 180 | void MainWindow::showEvent(QShowEvent *e) | 
 
 
 
 
 | 181 | { | 
 
 
 
 
 | 182 | #ifdef Q_OS_WIN | 
 
 
 
 
 | 183 | // QProgressBar only works after the windows was shown | 
 
 
 
 
 | 184 | // http://stackoverflow.com/questions/24840941/qwintaskbarprogress-wont-show (Kervala answer) | 
 
 
 
 
 | 185 |  | 
 
 
 
 
 | 186 | this->win7TaskBarButton = new QWinTaskbarButton(); | 
 
 
 
 
 | 187 |  | 
 
 
 
 
 | 188 | this->win7TaskBarButton->setWindow(this->windowHandle()); | 
 
 
 
 
 | 189 |  | 
 
 
 
 
 | 190 | this->win7TaskBarProgress = this->win7TaskBarButton->progress(); | 
 
 
 
 
 | 191 |  | 
 
 
 
 
 | 192 | //Create a thread for do the conversion in background | 
 
 
 
 
 | 193 | this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, this->listToProccess, this->win7TaskBarProgress); | 
 
 
 
 
 | 194 | #else | 
 
 
 
 
 | 195 | this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, this->listToProccess); | 
 
 
 
 
 | 196 | #endif | 
 
 
 
 
 | 197 |  | 
 
 
 
 
 | 198 | connectSlots(); | 
 
 
 
 
 | 199 |  | 
 
 
 
 
 | 200 | this->myLogger->writeString("Application started."); | 
 
 
 
 
 | 201 |  | 
 
 
 
 
 | 202 | e->accept(); | 
 
 
 
 
 | 203 | } | 
 
 
 
 
 | 204 |  | 
 
 
 
 
 | 205 |  | 
 
 
 
 
 | 206 | void MainWindow::on_actionExit_triggered() | 
 
 
 
 
 | 207 | { | 
 
 
 
 
 | 208 | close(); | 
 
 
 
 
 | 209 | } | 
 
 
 
 
 | 210 |  | 
 
 
 
 
 | 211 | void MainWindow::on_actionAbout_triggered() | 
 
 
 
 
 | 212 | { | 
 
 
 
 
 | 213 | //Show preferences | 
 
 
 
 
 | 214 | About *aboutWindow = new About(this); | 
 
 
 
 
 | 215 | aboutWindow->show(); //it destroys itself when finished. | 
 
 
 
 
 | 216 | } | 
 
 
 
 
 | 217 |  | 
 
 
 
 
 | 218 | void MainWindow::on_actionAE_Package_Creator_triggered() | 
 
 
 
 
 | 219 | { | 
 
 
 
 
 | 220 | PackageWizard myWizard = PackageWizard(this->workspaceWizardsLocation, this->vagoSettings, this->myLogger); | 
 
 
 
 
 | 221 | myWizard.exec(); | 
 
 
 
 
 | 222 | } | 
 
 
 
 
 | 223 |  | 
 
 
 
 
 | 224 | void MainWindow::on_actionSound_Wizard_triggered() | 
 
 
 
 
 | 225 | { | 
 
 
 
 
 | 226 | SoundWizard myWizard (UtilVago::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap); | 
 
 
 
 
 | 227 | myWizard.exec(); | 
 
 
 
 
 | 228 | } | 
 
 
 
 
 | 229 |  | 
 
 
 
 
 | 230 | void MainWindow::on_tbOni_clicked() | 
 
 
 
 
 | 231 | { | 
 
 
 
 
 | 232 | QStringList arguments; | 
 
 
 
 
 | 233 |  | 
 
 
 
 
 | 234 | if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window? | 
 
 
 
 
 | 235 | arguments << "-noswitch"; | 
 
 
 
 
 | 236 | } | 
 
 
 
 
 | 237 | #ifdef Q_OS_WIN | 
 
 
 
 
 | 238 | else{ | 
 
 
 
 
 | 239 | arguments << "-switch"; // only supported on windows. Was added by daodan dll. | 
 
 
 
 
 | 240 | } | 
 
 
 
 
 | 241 | #endif | 
 
 
 
 
 | 242 |  | 
 
 
 
 
 | 243 | arguments << "-debugfiles"; | 
 
 
 
 
 | 244 |  | 
 
 
 
 
 | 245 | if(!QProcess::startDetached(this->AeLocation+"/"+GlobalVars::OniExe,arguments,this->AeLocation)){ | 
 
 
 
 
 | 246 | showErrStatusMessage("Oni could not be started!"); | 
 
 
 
 
 | 247 | } | 
 
 
 
 
 | 248 | } | 
 
 
 
 
 | 249 |  | 
 
 
 
 
 | 250 | void MainWindow::on_tbAE_clicked() | 
 
 
 
 
 | 251 | { | 
 
 
 
 
 | 252 | // If the app turn out someday to a native app use QProcess::startDetached instead... | 
 
 
 
 
 | 253 |  | 
 
 
 
 
 | 254 | if(!QDesktopServices::openUrl("file:///"+this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){ | 
 
 
 
 
 | 255 | showErrStatusMessage("Could not start AE Installer!"); | 
 
 
 
 
 | 256 | } | 
 
 
 
 
 | 257 | } | 
 
 
 
 
 | 258 |  | 
 
 
 
 
 | 259 | void MainWindow::on_tbOpenFolder_clicked() | 
 
 
 
 
 | 260 | { | 
 
 
 
 
 | 261 | QDesktopServices::openUrl(QUrl("file:///"+this->outputFolder)); | 
 
 
 
 
 | 262 | } | 
 
 
 
 
 | 263 |  | 
 
 
 
 
 | 264 | void MainWindow::on_tbAbortConversion_clicked() | 
 
 
 
 
 | 265 | { | 
 
 
 
 
 | 266 | if(Util::showQuestionPopUp(this,"Are you sure you want to abort the current conversion?")){ | 
 
 
 
 
 | 267 | emit terminateCurrProcess(); | 
 
 
 
 
 | 268 | } | 
 
 
 
 
 | 269 | } | 
 
 
 
 
 | 270 |  | 
 
 
 
 
 | 271 | void MainWindow::on_cbEnvMap_toggled(bool checked) | 
 
 
 
 
 | 272 | { | 
 
 
 
 
 | 273 | ui->leEnvMapTexture->setEnabled(checked); | 
 
 
 
 
 | 274 | } | 
 
 
 
 
 | 275 |  | 
 
 
 
 
 | 276 | void MainWindow::on_cbTexture_toggled(bool checked) | 
 
 
 
 
 | 277 | { | 
 
 
 
 
 | 278 | ui->leTextureName->setEnabled(checked); | 
 
 
 
 
 | 279 | } | 
 
 
 
 
 | 280 |  | 
 
 
 
 
 | 281 | void MainWindow::on_cbWithAnimation_toggled(bool checked) | 
 
 
 
 
 | 282 | { | 
 
 
 
 
 | 283 | ui->leAnimationName->setEnabled(checked); | 
 
 
 
 
 | 284 | } | 
 
 
 
 
 | 285 |  | 
 
 
 
 
 | 286 | void MainWindow::on_cbSpecificFilesLevels_toggled(bool checked) | 
 
 
 
 
 | 287 | { | 
 
 
 
 
 | 288 | ui->leSpecificFilesLevels->setEnabled(checked); | 
 
 
 
 
 | 289 | } | 
 
 
 
 
 | 290 |  | 
 
 
 
 
 | 291 | void MainWindow::on_actionCheck_For_Updates_triggered() | 
 
 
 
 
 | 292 | { | 
 
 
 
 
 | 293 |  | 
 
 
 
 
 | 294 | //let's check in the web if this version is the latest | 
 
 
 
 
 | 295 | QNetworkAccessManager *manager = new QNetworkAccessManager(this); | 
 
 
 
 
 | 296 | connect(manager, SIGNAL(finished(QNetworkReply*)), | 
 
 
 
 
 | 297 | this, SLOT(checkVagoLastVersion(QNetworkReply*))); | 
 
 
 
 
 | 298 |  | 
 
 
 
 
 | 299 | manager->get(QNetworkRequest(QUrl(GlobalVars::VagoCheckUpdatesUrl))); | 
 
 
 
 
 | 300 |  | 
 
 
 
 
 | 301 | } | 
 
 
 
 
 | 302 |  | 
 
 
 
 
 | 303 | void MainWindow::checkVagoLastVersion(QNetworkReply *result){ | 
 
 
 
 
 | 304 |  | 
 
 
 
 
 | 305 | if(result->error()==QNetworkReply::NoError){ | 
 
 
 
 
 | 306 | QScriptEngine engine; | 
 
 
 
 
 | 307 | QScriptValue sc = engine.evaluate("(" + QString(result->readAll()) + ")"); | 
 
 
 
 
 | 308 |  | 
 
 
 
 
 | 309 | // "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 | 
 
 
 
 
 | 310 |  | 
 
 
 
 
 | 311 | QString newVersion = sc.property("field_version").toObject().property("und").toObject().property("0").toObject().property("value").toString(); | 
 
 
 
 
 | 312 |  | 
 
 
 
 
 | 313 | if(newVersion!=GlobalVars::AppVersion){ | 
 
 
 
 
 | 314 | Util::showRichPopUp("There's a new version of Vago! (v"+newVersion+")<br/><br/>"+ | 
 
 
 
 
 | 315 | "You can download it <a href='"+GlobalVars::VagoWebUrl+"'>here</a>."); | 
 
 
 
 
 | 316 | } | 
 
 
 
 
 | 317 | else{ | 
 
 
 
 
 | 318 | Util::showPopUp("You are using last version."); | 
 
 
 
 
 | 319 | } | 
 
 
 
 
 | 320 | } | 
 
 
 
 
 | 321 | else{ | 
 
 
 
 
 | 322 | UtilVago::showAndLogErrorPopUp(this->myLogger, "An error occurred checking last version:\n\n"+result->errorString()); | 
 
 
 
 
 | 323 | } | 
 
 
 
 
 | 324 | result->deleteLater(); | 
 
 
 
 
 | 325 | } | 
 
 
 
 
 | 326 |  | 
 
 
 
 
 | 327 | void MainWindow::on_pbAddSourceXML_clicked() | 
 
 
 
 
 | 328 | { | 
 
 
 
 
 | 329 | addFilesSource( ui->twSourcesXML,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 | 330 | } | 
 
 
 
 
 | 331 |  | 
 
 
 
 
 | 332 | void MainWindow::on_pbAddSourceTextures_clicked() | 
 
 
 
 
 | 333 | { | 
 
 
 
 
 | 334 | addFilesSource( ui->twSourcesTextures, QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 | 335 | } | 
 
 
 
 
 | 336 |  | 
 
 
 
 
 | 337 | void MainWindow::on_pbAddSourceObjects_clicked() | 
 
 
 
 
 | 338 | { | 
 
 
 
 
 | 339 | addFilesSource( ui->twSourcesObjects,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 | 340 | } | 
 
 
 
 
 | 341 |  | 
 
 
 
 
 | 342 | void MainWindow::on_pbAddSourceCharacters_clicked() | 
 
 
 
 
 | 343 | { | 
 
 
 
 
 | 344 | addFilesSource( ui->twSourcesCharacters,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 | 345 | } | 
 
 
 
 
 | 346 |  | 
 
 
 
 
 | 347 | void MainWindow::on_pbAddSourceLevels_clicked() | 
 
 
 
 
 | 348 | { | 
 
 
 
 
 | 349 | if(QString::compare(ui->cbFromLevels->currentText(),"ONI FILES",Qt::CaseSensitive)==0 && QString::compare(ui->cbToLevels->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster) | 
 
 
 
 
 | 350 | addFilesSource(ui->twSourcesLevels,Util::multipleDirDialog("Choose folders with ONIs...")); | 
 
 
 
 
 | 351 | } | 
 
 
 
 
 | 352 | else{ | 
 
 
 
 
 | 353 | addFilesSource(ui->twSourcesLevels,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 | 354 | } | 
 
 
 
 
 | 355 | } | 
 
 
 
 
 | 356 |  | 
 
 
 
 
 | 357 | void MainWindow::on_pbAddSourceMisc_clicked() | 
 
 
 
 
 | 358 | { | 
 
 
 
 
 | 359 | addFilesSource( ui->twSourcesMisc,QFileDialog::getOpenFileNames(this,"Choose the files...","./" , "All Files (*.*)")); | 
 
 
 
 
 | 360 | } | 
 
 
 
 
 | 361 |  | 
 
 
 
 
 | 362 | QString MainWindow::getFileOutputFolder(QString fromTo, QString myOutputFolder){ | 
 
 
 
 
 | 363 |  | 
 
 
 
 
 | 364 | if(myOutputFolder==""){ //We may want to change to a non standart location with context menu | 
 
 
 
 
 | 365 | myOutputFolder=this->outputFolder; | 
 
 
 
 
 | 366 | } | 
 
 
 
 
 | 367 |  | 
 
 
 
 
 | 368 | if(this->vagoSettings->value("SeparateInWorkspace").toBool() && myOutputFolder==this->workspaceLocation){ | 
 
 
 
 
 | 369 | myOutputFolder+="/"+ui->tabWidget->tabText(ui->tabWidget->currentIndex()); | 
 
 
 
 
 | 370 | myOutputFolder+="/"+QString(fromTo).replace(" / ","_").replace(" > "," - "); | 
 
 
 
 
 | 371 | } | 
 
 
 
 
 | 372 | return Util::insertQuotes(myOutputFolder+"/"); | 
 
 
 
 
 | 373 | } | 
 
 
 
 
 | 374 |  | 
 
 
 
 
 | 375 | void MainWindow::addFilesSource(DropTableWidget *myTable, QStringList files){ | 
 
 
 
 
 | 376 |  | 
 
 
 
 
 | 377 | //Get Conversion pretended | 
 
 
 
 
 | 378 | QString from,to; | 
 
 
 
 
 | 379 |  | 
 
 
 
 
 | 380 | QString fromTo = getTypeConversion(myTable); | 
 
 
 
 
 | 381 |  | 
 
 
 
 
 | 382 | 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 | 
 
 
 
 
 | 383 | to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> " | 
 
 
 
 
 | 384 |  | 
 
 
 
 
 | 385 | //Pre-processing (check if the files/folders received are valid), e.g. check for ONI->DAT if are only given folders and not files | 
 
 
 
 
 | 386 | if(from=="ONI FILES" && to=="DAT"){ | 
 
 
 
 
 | 387 | //check if it's a folder | 
 
 
 
 
 | 388 | foreach(QString myFile, files){ | 
 
 
 
 
 | 389 | if(!QDir(myFile).exists()){ | 
 
 
 
 
 | 390 | showErrStatusMessage("Only folders are allowed for this operation."); | 
 
 
 
 
 | 391 | return; | 
 
 
 
 
 | 392 | } | 
 
 
 
 
 | 393 | } | 
 
 
 
 
 | 394 |  | 
 
 
 
 
 | 395 | } | 
 
 
 
 
 | 396 | else{ | 
 
 
 
 
 | 397 | foreach(QString myFile, files){ | 
 
 
 
 
 | 398 | //check if it's a file | 
 
 
 
 
 | 399 | if(QDir(myFile).exists()){ | 
 
 
 
 
 | 400 | showErrStatusMessage("Only files are allowed for this operation."); | 
 
 
 
 
 | 401 | return; | 
 
 
 
 
 | 402 | } | 
 
 
 
 
 | 403 | } | 
 
 
 
 
 | 404 | } | 
 
 
 
 
 | 405 |  | 
 
 
 
 
 | 406 | //Build command | 
 
 
 
 
 | 407 | QString command, lastFileName; | 
 
 
 
 
 | 408 |  | 
 
 
 
 
 | 409 | QString myOutputFolder=getFileOutputFolder(fromTo); | 
 
 
 
 
 | 410 |  | 
 
 
 
 
 | 411 | //if folder doesn't exist onisplit will create it for us :) | 
 
 
 
 
 | 412 | foreach(QString currentFile, files){ | 
 
 
 
 
 | 413 |  | 
 
 
 
 
 | 414 | currentFile=Util::normalizeAndQuote(currentFile); //insert quotes ("") in file | 
 
 
 
 
 | 415 |  | 
 
 
 
 
 | 416 | if(lastFileName.isEmpty()){ //Optimization: all commands are the same for each file, just replace the filename | 
 
 
 
 
 | 417 |  | 
 
 
 
 
 | 418 | command=getCommand(myTable,myOutputFolder,from,to,currentFile); | 
 
 
 
 
 | 419 |  | 
 
 
 
 
 | 420 | if(command.isEmpty()){ //something wrong was happening (not inputted a texture name?) | 
 
 
 
 
 | 421 | return; //stop adding files | 
 
 
 
 
 | 422 | } | 
 
 
 
 
 | 423 | currentFile=Util::cutName(currentFile); | 
 
 
 
 
 | 424 | }else{ //one parsing was already made just replace the filename by the old one in the command | 
 
 
 
 
 | 425 |  | 
 
 
 
 
 | 426 | currentFile=Util::cutName(currentFile); | 
 
 
 
 
 | 427 |  | 
 
 
 
 
 | 428 | command.replace(lastFileName,currentFile,Qt::CaseSensitive); //case sentive is faster | 
 
 
 
 
 | 429 | } | 
 
 
 
 
 | 430 |  | 
 
 
 
 
 | 431 | lastFileName=currentFile; | 
 
 
 
 
 | 432 |  | 
 
 
 
 
 | 433 | addRowTable(myTable,lastFileName,fromTo,command); | 
 
 
 
 
 | 434 | } | 
 
 
 
 
 | 435 | updateItemsLoaded(myTable); | 
 
 
 
 
 | 436 | } | 
 
 
 
 
 | 437 |  | 
 
 
 
 
 | 438 | QString MainWindow::fileParsingXML(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 | 439 |  | 
 
 
 
 
 | 440 | QString command; | 
 
 
 
 
 | 441 |  | 
 
 
 
 
 | 442 | if(from=="ONI" && to=="XML"){ | 
 
 
 
 
 | 443 | return command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder+" "+file; | 
 
 
 
 
 | 444 | } | 
 
 
 
 
 | 445 | else if(from=="XML" && to=="ONI"){ | 
 
 
 
 
 | 446 | return command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder+" "+file; | 
 
 
 
 
 | 447 | } | 
 
 
 
 
 | 448 |  | 
 
 
 
 
 | 449 | return ""; | 
 
 
 
 
 | 450 |  | 
 
 
 
 
 | 451 | } | 
 
 
 
 
 | 452 |  | 
 
 
 
 
 | 453 | QString MainWindow::fileParsingTextures(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 | 454 |  | 
 
 
 
 
 | 455 | QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder; | 
 
 
 
 
 | 456 |  | 
 
 
 
 
 | 457 | if(ui->gbTextures->isEnabled()){ //faster than compare strings (if is DAT/ONI) | 
 
 
 
 
 | 458 |  | 
 
 
 
 
 | 459 | if(ui->cbMipMapsTextures->isChecked()){ | 
 
 
 
 
 | 460 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbMipMapsTextures->text()); | 
 
 
 
 
 | 461 | } | 
 
 
 
 
 | 462 |  | 
 
 
 
 
 | 463 | if(ui->cbNoUwrap->isChecked()){ | 
 
 
 
 
 | 464 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNoUwrap->text()); | 
 
 
 
 
 | 465 | } | 
 
 
 
 
 | 466 |  | 
 
 
 
 
 | 467 | if(ui->cbNoVwrap->isChecked()){ | 
 
 
 
 
 | 468 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNoVwrap->text()); | 
 
 
 
 
 | 469 | } | 
 
 
 
 
 | 470 |  | 
 
 
 
 
 | 471 | if(ui->cbLarge->isChecked()){ | 
 
 
 
 
 | 472 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbLarge->text()); | 
 
 
 
 
 | 473 | } | 
 
 
 
 
 | 474 |  | 
 
 
 
 
 | 475 | command+=" "+this->commandMap.value(tabTitle+"->"+getTextureRBCheckedTypeTexture()->text()); | 
 
 
 
 
 | 476 |  | 
 
 
 
 
 | 477 | if(ui->cbEnvMap->isChecked()){ | 
 
 
 
 
 | 478 | if(ui->leEnvMapTexture->text().isEmpty()){ | 
 
 
 
 
 | 479 | showErrStatusMessage("Checkbox '"+ui->cbEnvMap->text()+"' is selected. The name texture name cannot be empty."); | 
 
 
 
 
 | 480 | return ""; | 
 
 
 
 
 | 481 | } | 
 
 
 
 
 | 482 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbEnvMap->text()) + ui->leEnvMapTexture->text().remove(".oni",Qt::CaseInsensitive); | 
 
 
 
 
 | 483 | } | 
 
 
 
 
 | 484 | } | 
 
 
 
 
 | 485 |  | 
 
 
 
 
 | 486 | return command+=" "+file; //add source | 
 
 
 
 
 | 487 | } | 
 
 
 
 
 | 488 |  | 
 
 
 
 
 | 489 | QString MainWindow::fileParsingCharacters(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 | 490 |  | 
 
 
 
 
 | 491 | QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder + " " + file ; | 
 
 
 
 
 | 492 |  | 
 
 
 
 
 | 493 |  | 
 
 
 
 
 | 494 | if(ui->cbCellShading->isChecked()){ | 
 
 
 
 
 | 495 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbCellShading->text()); | 
 
 
 
 
 | 496 | } | 
 
 
 
 
 | 497 |  | 
 
 
 
 
 | 498 | if(ui->cbNormals->isChecked()){ | 
 
 
 
 
 | 499 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNormals->text()); | 
 
 
 
 
 | 500 | } | 
 
 
 
 
 | 501 |  | 
 
 
 
 
 | 502 | if(ui->cbWithTRBS_ONCC->isChecked()){ | 
 
 
 
 
 | 503 | if(ui->leTRBS_ONCC->text().isEmpty()){ | 
 
 
 
 
 | 504 | showErrStatusMessage("Checkbox '"+ui->cbWithTRBS_ONCC->text()+"' is selected. The name cannot be empty."); | 
 
 
 
 
 | 505 | return ""; | 
 
 
 
 
 | 506 | } | 
 
 
 
 
 | 507 |  | 
 
 
 
 
 | 508 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbWithTRBS_ONCC->text())+Util::normalizeAndQuote(ui->leTRBS_ONCC->text()); | 
 
 
 
 
 | 509 | } | 
 
 
 
 
 | 510 |  | 
 
 
 
 
 | 511 | return command; | 
 
 
 
 
 | 512 | } | 
 
 
 
 
 | 513 |  | 
 
 
 
 
 | 514 |  | 
 
 
 
 
 | 515 | QString MainWindow::fileParsingObjects(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 | 516 |  | 
 
 
 
 
 | 517 | QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder; | 
 
 
 
 
 | 518 |  | 
 
 
 
 
 | 519 | //TODO: This can be optimized. When some are not enable others are. | 
 
 
 
 
 | 520 | if(ui->cbTexture->isChecked()){ | 
 
 
 
 
 | 521 | if(ui->leTextureName->text().isEmpty()){ | 
 
 
 
 
 | 522 | showErrStatusMessage("Checkbox '"+ui->cbTexture->text()+"' is selected. The file source cannot be empty."); | 
 
 
 
 
 | 523 | return ""; | 
 
 
 
 
 | 524 | } | 
 
 
 
 
 | 525 | command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbTexture->text()) + ui->leTextureName->text(); | 
 
 
 
 
 | 526 | } | 
 
 
 
 
 | 527 | else if(ui->cbWithAnimation->isChecked()){ | 
 
 
 
 
 | 528 | if(ui->leAnimationName->text().isEmpty()){ | 
 
 
 
 
 | 529 | showErrStatusMessage("Checkbox '"+ui->cbWithAnimation->text()+"' is selected. The file source cannot be empty."); | 
 
 
 
 
 | 530 | return ""; | 
 
 
 
 
 | 531 | } | 
 
 
 
 
 | 532 | command+=" "+Util::normalizeAndQuote(ui->leAnimationName->text()) + " " + this->commandMap.value(tabTitle+"->"+ui->cbWithAnimation->text()) + file; | 
 
 
 
 
 | 533 | return command; | 
 
 
 
 
 | 534 | } | 
 
 
 
 
 | 535 |  | 
 
 
 
 
 | 536 | if(from=="OBAN ONI (cam)"){ | 
 
 
 
 
 | 537 | command+=" -geom:camera"; | 
 
 
 
 
 | 538 | } | 
 
 
 
 
 | 539 |  | 
 
 
 
 
 | 540 | return command+=" "+file; //add source | 
 
 
 
 
 | 541 | } | 
 
 
 
 
 | 542 |  | 
 
 
 
 
 | 543 | QString MainWindow::fileParsingLevels(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 | 544 |  | 
 
 
 
 
 | 545 | QString datName, command; | 
 
 
 
 
 | 546 |  | 
 
 
 
 
 | 547 | if(!(from=="ONI FILES" && to=="DAT")){ // to all except this one | 
 
 
 
 
 | 548 |  | 
 
 
 
 
 | 549 | command=this->commandMap.value(tabTitle+"->"+from+"->"+to); | 
 
 
 
 
 | 550 |  | 
 
 
 
 
 | 551 | if(ui->cbSpecificFilesLevels->isChecked()){ | 
 
 
 
 
 | 552 |  | 
 
 
 
 
 | 553 | if(ui->leSpecificFilesLevels->text().isEmpty()){ | 
 
 
 
 
 | 554 | showErrStatusMessage("Checkbox '"+ui->cbSpecificFilesLevels->text()+"' is selected. The files pattern cannot be empty."); | 
 
 
 
 
 | 555 | return ""; | 
 
 
 
 
 | 556 | } | 
 
 
 
 
 | 557 |  | 
 
 
 
 
 | 558 | command+=":"+ui->leSpecificFilesLevels->text(); | 
 
 
 
 
 | 559 | } | 
 
 
 
 
 | 560 |  | 
 
 
 
 
 | 561 | if(from=="DAT" && to=="ONI FILES"){ // extract files to a subdir with the files name ex: level0_Final | 
 
 
 
 
 | 562 | command += " " + myOutputFolder.insert(myOutputFolder.size()-2,QString(Util::cutName(file)).replace(".dat","")) + " " + file; | 
 
 
 
 
 | 563 | } | 
 
 
 
 
 | 564 | else{ | 
 
 
 
 
 | 565 | command+=" "+myOutputFolder+" "+file; | 
 
 
 
 
 | 566 | } | 
 
 
 
 
 | 567 |  | 
 
 
 
 
 | 568 | } | 
 
 
 
 
 | 569 |  | 
 
 
 
 
 | 570 | if((from=="ONI FILES" || from=="MASTER XML") && to=="DAT"){ // almost the same command for both | 
 
 
 
 
 | 571 | QString datName; | 
 
 
 
 
 | 572 |  | 
 
 
 
 
 | 573 | if(from=="MASTER XML"){ | 
 
 
 
 
 | 574 | command+=GlobalVars::OniSplitProcSeparator; //insert mark so we know this action will take 2 commands | 
 
 
 
 
 | 575 | } | 
 
 
 
 
 | 576 |  | 
 
 
 
 
 | 577 | if(ui->cbDatLevels->isChecked()){ | 
 
 
 
 
 | 578 | if(ui->leTargetDatLevels->text().isEmpty()){ | 
 
 
 
 
 | 579 | showErrStatusMessage("Checkbox '"+ui->cbDatLevels->text()+"' is selected. The name cannot be empty."); | 
 
 
 
 
 | 580 | return ""; | 
 
 
 
 
 | 581 | } | 
 
 
 
 
 | 582 | datName+=QString(myOutputFolder).insert(myOutputFolder.size()-1,ui->leTargetDatLevels->text()); //set name inputted by user | 
 
 
 
 
 | 583 | if(!ui->leTargetDatLevels->text().toUpper().endsWith(".DAT")){ | 
 
 
 
 
 | 584 | datName.insert(datName.size()-1,".dat"); //append extension if necessary (-1 to maintain final quote) | 
 
 
 
 
 | 585 | } | 
 
 
 
 
 | 586 | } | 
 
 
 
 
 | 587 | else{ | 
 
 
 
 
 | 588 | if(from=="ONI FILES"){ | 
 
 
 
 
 | 589 | datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::cutName(file).remove("/")+".dat"); //if none iputted set the same name of input file | 
 
 
 
 
 | 590 | } | 
 
 
 
 
 | 591 | else if(from=="MASTER XML"){ | 
 
 
 
 
 | 592 | 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 | 
 
 
 
 
 | 593 | } | 
 
 
 
 
 | 594 | } | 
 
 
 
 
 | 595 | if(from=="ONI FILES"){ | 
 
 
 
 
 | 596 | if(ui->actionWindows->isChecked()){ //is target plataform select windows? | 
 
 
 
 
 | 597 | return command=this->commandMap.value(tabTitle+"->"+from+"->"+to+"(PC)")+" "+ file + " "+datName; | 
 
 
 
 
 | 598 | } | 
 
 
 
 
 | 599 | else{ | 
 
 
 
 
 | 600 | return command=this->commandMap.value(tabTitle+"->"+from+"->"+to+"(demoPCMAC)")+" "+ file + " "+datName; | 
 
 
 
 
 | 601 | } | 
 
 
 
 
 | 602 | } | 
 
 
 
 
 | 603 | else if(from=="MASTER XML"){ | 
 
 
 
 
 | 604 | if(ui->actionWindows->isChecked()){ //is target plataform select windows? | 
 
 
 
 
 | 605 | command+=this->commandMap.value(tabTitle+"->ONI FILES->"+to+"(PC)")+" "+myOutputFolder+" "+datName; //add second command | 
 
 
 
 
 | 606 | } | 
 
 
 
 
 | 607 | else{ | 
 
 
 
 
 | 608 | command+=this->commandMap.value(tabTitle+"->ONI FILES->"+to+"(demoPCMAC)")+" "+myOutputFolder+" "+datName; //add second command | 
 
 
 
 
 | 609 | } | 
 
 
 
 
 | 610 | } | 
 
 
 
 
 | 611 | } | 
 
 
 
 
 | 612 |  | 
 
 
 
 
 | 613 | if(ui->cbBnvLevels->isChecked()){ | 
 
 
 
 
 | 614 |  | 
 
 
 
 
 | 615 | if(ui->leBnvLevels->text().isEmpty()){ | 
 
 
 
 
 | 616 | showErrStatusMessage("Checkbox '"+ui->cbBnvLevels->text()+"' is selected. The BNV file cannot be empty."); | 
 
 
 
 
 | 617 | return ""; | 
 
 
 
 
 | 618 | } | 
 
 
 
 
 | 619 | command+=" "+Util::normalizeAndQuote(ui->leBnvLevels->text()); | 
 
 
 
 
 | 620 | } | 
 
 
 
 
 | 621 |  | 
 
 
 
 
 | 622 | if(ui->cbAdditionalSourcesLevels->isChecked()){ | 
 
 
 
 
 | 623 |  | 
 
 
 
 
 | 624 | if(ui->leAdditSourcesLevels->text().isEmpty()){ | 
 
 
 
 
 | 625 | showErrStatusMessage("Checkbox '"+ui->cbAdditionalSourcesLevels->text()+"' is selected. The source files cannot be empty."); | 
 
 
 
 
 | 626 | return ""; | 
 
 
 
 
 | 627 | } | 
 
 
 
 
 | 628 |  | 
 
 
 
 
 | 629 | QString additionalFiles=ui->leAdditSourcesLevels->text(); | 
 
 
 
 
 | 630 |  | 
 
 
 
 
 | 631 | int currentIndex=0, nextIndex=0; | 
 
 
 
 
 | 632 |  | 
 
 
 
 
 | 633 | //parse all files (separated by spaces) | 
 
 
 
 
 | 634 | while(true){ | 
 
 
 
 
 | 635 | nextIndex=additionalFiles.indexOf(";",currentIndex+1); | 
 
 
 
 
 | 636 |  | 
 
 
 
 
 | 637 | command += " "+Util::normalizeAndQuote(additionalFiles.mid(currentIndex,(nextIndex-currentIndex))); | 
 
 
 
 
 | 638 |  | 
 
 
 
 
 | 639 | if(nextIndex==-1){ //we got to the end, stop parsing | 
 
 
 
 
 | 640 | break; | 
 
 
 
 
 | 641 | } | 
 
 
 
 
 | 642 | currentIndex=nextIndex+1; //update currentIndex +1 for start after the separator | 
 
 
 
 
 | 643 | } | 
 
 
 
 
 | 644 | } | 
 
 
 
 
 | 645 |  | 
 
 
 
 
 | 646 | if(ui->cbGridsLevels->isChecked()){ | 
 
 
 
 
 | 647 | command+=GlobalVars::OniSplitProcSeparator+this->commandMap.value(tabTitle+"->"+ui->cbGridsLevels->text())+" "+Util::normalizeAndQuote(ui->leBnvLevels->text())+" "+file+" -out:"+myOutputFolder; | 
 
 
 
 
 | 648 | } | 
 
 
 
 
 | 649 |  | 
 
 
 
 
 | 650 | return command; | 
 
 
 
 
 | 651 | } | 
 
 
 
 
 | 652 |  | 
 
 
 
 
 | 653 | QString MainWindow::fileParsingMisc(QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 | 654 | return this->commandMap.value("misc->"+from+"->"+to)+" "+myOutputFolder+" "+file; | 
 
 
 
 
 | 655 | } | 
 
 
 
 
 | 656 |  | 
 
 
 
 
 | 657 | void MainWindow::addRowTable(DropTableWidget *myTable, QString fileName, QString fromTo, QString command, bool isToDisabled){ | 
 
 
 
 
 | 658 | //Get actual number rows | 
 
 
 
 
 | 659 | int twSize=myTable->rowCount(); | 
 
 
 
 
 | 660 |  | 
 
 
 
 
 | 661 | //increase the rows for the new item | 
 
 
 
 
 | 662 | myTable->setRowCount(twSize+1); | 
 
 
 
 
 | 663 |  | 
 
 
 
 
 | 664 | //Add to table and list to | 
 
 
 
 
 | 665 | QTableWidgetItem *newFile = new QTableWidgetItem(fileName); | 
 
 
 
 
 | 666 | QTableWidgetItem *newConversion = new QTableWidgetItem(fromTo); | 
 
 
 
 
 | 667 | QTableWidgetItem *newCommand = new QTableWidgetItem(command); | 
 
 
 
 
 | 668 |  | 
 
 
 
 
 | 669 | if(isToDisabled){ | 
 
 
 
 
 | 670 | myTable->setDisableStyleWidgetItem(newFile); | 
 
 
 
 
 | 671 | myTable->setDisableStyleWidgetItem(newConversion); | 
 
 
 
 
 | 672 | myTable->setDisableStyleWidgetItem(newCommand); | 
 
 
 
 
 | 673 | } | 
 
 
 
 
 | 674 |  | 
 
 
 
 
 | 675 | myTable->setItem(twSize,0,newFile); | 
 
 
 
 
 | 676 | myTable->setItem(twSize,1,newConversion); | 
 
 
 
 
 | 677 | myTable->setItem(twSize,2,newCommand); | 
 
 
 
 
 | 678 |  | 
 
 
 
 
 | 679 | myTable->updateTableToolTips(twSize); //Update tool tips | 
 
 
 
 
 | 680 | } | 
 
 
 
 
 | 681 |  | 
 
 
 
 
 | 682 | void MainWindow::on_pbConvert_clicked() | 
 
 
 
 
 | 683 | { | 
 
 
 
 
 | 684 | startConversion(); | 
 
 
 
 
 | 685 | } | 
 
 
 
 
 | 686 |  | 
 
 
 
 
 | 687 | void MainWindow::startConversion(){ | 
 
 
 
 
 | 688 |  | 
 
 
 
 
 | 689 | DropTableWidget* currTable = getCurrentTableWidget(); | 
 
 
 
 
 | 690 |  | 
 
 
 
 
 | 691 | bool ready=false; | 
 
 
 
 
 | 692 | for(int i=0; i<currTable->rowCount(); i++){ //There are items to process? | 
 
 
 
 
 | 693 | if(currTable->item(i,2)->background()!=currTable->disabledBackStyle){ | 
 
 
 
 
 | 694 | ready=true; | 
 
 
 
 
 | 695 | break; | 
 
 
 
 
 | 696 | } | 
 
 
 
 
 | 697 | } | 
 
 
 
 
 | 698 |  | 
 
 
 
 
 | 699 | if(!ready){ | 
 
 
 
 
 | 700 | showErrStatusMessage("Please add sources to convert first."); | 
 
 
 
 
 | 701 | return; | 
 
 
 
 
 | 702 | } | 
 
 
 
 
 | 703 |  | 
 
 
 
 
 | 704 | if(this->myBar->isVisible()){ | 
 
 
 
 
 | 705 | Util::showErrorPopUp("Another conversion is progress. Please wait until it finishes."); | 
 
 
 
 
 | 706 | return; | 
 
 
 
 
 | 707 | } | 
 
 
 
 
 | 708 |  | 
 
 
 
 
 | 709 | for(int i=0; i<currTable->rowCount(); i++){ | 
 
 
 
 
 | 710 | //Only process enabled items | 
 
 
 
 
 | 711 | if(currTable->item(i,2)->background()!=currTable->disabledBackStyle){ | 
 
 
 
 
 | 712 | this->listToProccess->append(currTable->item(i,2)->text()); | 
 
 
 
 
 | 713 | } | 
 
 
 
 
 | 714 | } | 
 
 
 
 
 | 715 |  | 
 
 
 
 
 | 716 | this->myConverter->start(); | 
 
 
 
 
 | 717 | } | 
 
 
 
 
 | 718 |  | 
 
 
 
 
 | 719 | void MainWindow::TsetupProgressBar(int max){ | 
 
 
 
 
 | 720 | this->myBar->setValue(0); | 
 
 
 
 
 | 721 | this->myBar->show(); | 
 
 
 
 
 | 722 | this->myBar->setMaximum(max); | 
 
 
 
 
 | 723 | ui->tbAbortConversion->show(); | 
 
 
 
 
 | 724 | } | 
 
 
 
 
 | 725 |  | 
 
 
 
 
 | 726 | void  MainWindow::TupdateProgressBar(){ | 
 
 
 
 
 | 727 | this->myBar->setValue(this->myBar->value()+1); //more one task done | 
 
 
 
 
 | 728 | } | 
 
 
 
 
 | 729 |  | 
 
 
 
 
 | 730 | void MainWindow::TresultConversion(QString result, int numErrors){ | 
 
 
 
 
 | 731 | QApplication::alert(this); //Show a notification if window is not active | 
 
 
 
 
 | 732 | this->myBar->hide(); | 
 
 
 
 
 | 733 | ui->tbAbortConversion->hide(); | 
 
 
 
 
 | 734 |  | 
 
 
 
 
 | 735 | if(numErrors!=0){ | 
 
 
 
 
 | 736 | QString sNumErrors=QString::number(numErrors); | 
 
 
 
 
 | 737 | if(numErrors>1){ | 
 
 
 
 
 | 738 | UtilVago::showErrorPopUpLogButton(result+"\n This is the last of "+sNumErrors+" Errors."); | 
 
 
 
 
 | 739 | showErrStatusMessage("Something gone wrong. Check log file ("+sNumErrors+" Errors)."); | 
 
 
 
 
 | 740 | } | 
 
 
 
 
 | 741 | else{ | 
 
 
 
 
 | 742 | UtilVago::showErrorPopUpLogButton(result); | 
 
 
 
 
 | 743 | showErrStatusMessage("Something gone wrong. Check log file."); | 
 
 
 
 
 | 744 | } | 
 
 
 
 
 | 745 |  | 
 
 
 
 
 | 746 | } | 
 
 
 
 
 | 747 | else{ | 
 
 
 
 
 | 748 | showSuccessStatusMessage("Everything went well!"); | 
 
 
 
 
 | 749 | } | 
 
 
 
 
 | 750 | } | 
 
 
 
 
 | 751 |  | 
 
 
 
 
 | 752 | void MainWindow::TconversionAborted(){ | 
 
 
 
 
 | 753 | this->myBar->hide(); | 
 
 
 
 
 | 754 | ui->tbAbortConversion->hide(); | 
 
 
 
 
 | 755 |  | 
 
 
 
 
 | 756 | showErrStatusMessage("Conversion was aborted."); | 
 
 
 
 
 | 757 | } | 
 
 
 
 
 | 758 |  | 
 
 
 
 
 | 759 | void MainWindow::showErrStatusMessage(QString message){ | 
 
 
 
 
 | 760 |  | 
 
 
 
 
 | 761 | QPalette myPalete = QPalette(); | 
 
 
 
 
 | 762 | myPalete.setColor( QPalette::WindowText, QColor(255,0,0)); | 
 
 
 
 
 | 763 | statusBar()->setPalette( myPalete ); | 
 
 
 
 
 | 764 | ui->statusBar->showMessage(message,10000); //display by 10 seconds | 
 
 
 
 
 | 765 |  | 
 
 
 
 
 | 766 | } | 
 
 
 
 
 | 767 |  | 
 
 
 
 
 | 768 | void MainWindow::showSuccessStatusMessage(QString message){ | 
 
 
 
 
 | 769 |  | 
 
 
 
 
 | 770 | QPalette myPalete = QPalette(); | 
 
 
 
 
 | 771 | myPalete.setColor( QPalette::WindowText, QColor(0,150,0)); | 
 
 
 
 
 | 772 | statusBar()->setPalette( myPalete ); | 
 
 
 
 
 | 773 | ui->statusBar->showMessage(message,10000); //display by 10 seconds | 
 
 
 
 
 | 774 |  | 
 
 
 
 
 | 775 | } | 
 
 
 
 
 | 776 |  | 
 
 
 
 
 | 777 | void MainWindow::mapCommands(){ | 
 
 
 
 
 | 778 | ////////////////////////////////////////////////////////////////////////XML Commands | 
 
 
 
 
 | 779 | this->commandMap.insert("xml->ONI->XML","-extract:xml"); | 
 
 
 
 
 | 780 | this->commandMap.insert("xml->XML->ONI","-create"); | 
 
 
 
 
 | 781 | //######################General Options | 
 
 
 
 
 | 782 |  | 
 
 
 
 
 | 783 | //Possible Combinations | 
 
 
 
 
 | 784 | this->commandMap.insertMulti("xml->ONI","XML"); | 
 
 
 
 
 | 785 | this->commandMap.insertMulti("xml->XML","ONI"); | 
 
 
 
 
 | 786 |  | 
 
 
 
 
 | 787 | ////////////////////////////////////////////////////////////////////////Textures Commands | 
 
 
 
 
 | 788 | this->commandMap.insert("textures->DAT / TXMP ONI->DDS","-extract:dds"); | 
 
 
 
 
 | 789 | this->commandMap.insert("textures->DAT / TXMP ONI->TGA","-extract:tga"); | 
 
 
 
 
 | 790 | this->commandMap.insert("textures->DAT / TXMP ONI->PNG","-extract:png"); | 
 
 
 
 
 | 791 | this->commandMap.insert("textures->DAT / TXMP ONI->JPG","-extract:jpg"); | 
 
 
 
 
 | 792 | this->commandMap.insert("textures->TGA / DDS / PNG / JPG->TXMP ONI","-create:txmp"); | 
 
 
 
 
 | 793 | //######################Textures Options | 
 
 
 
 
 | 794 | this->commandMap.insert("textures->"+ui->rbBGR32->text(),"-format:bgr32"); | 
 
 
 
 
 | 795 | this->commandMap.insert("textures->"+ui->rbBGRA32->text(),"-format:bgra32"); | 
 
 
 
 
 | 796 | this->commandMap.insert("textures->"+ui->rbBGR555->text(),"-format:bgr555"); | 
 
 
 
 
 | 797 | this->commandMap.insert("textures->"+ui->rbBGRA5551->text(),"-format:bgra5551"); | 
 
 
 
 
 | 798 | this->commandMap.insert("textures->"+ui->rbBGRA444->text(),"-format:bgra4444"); | 
 
 
 
 
 | 799 | this->commandMap.insert("textures->"+ui->rbDxt1->text(),"-format:dxt1"); | 
 
 
 
 
 | 800 | this->commandMap.insert("textures->"+ui->cbMipMapsTextures->text(),"-genmipmaps"); | 
 
 
 
 
 | 801 | this->commandMap.insert("textures->"+ui->cbNoUwrap->text(),"-nouwrap"); | 
 
 
 
 
 | 802 | this->commandMap.insert("textures->"+ui->cbNoVwrap->text(),"-novwrap"); | 
 
 
 
 
 | 803 | this->commandMap.insert("textures->"+ui->cbLarge->text(),"-large"); | 
 
 
 
 
 | 804 | this->commandMap.insert("textures->"+ui->cbEnvMap->text(),"-envmap:"); | 
 
 
 
 
 | 805 | //Possible Combinations | 
 
 
 
 
 | 806 | this->commandMap.insertMulti("textures->DAT / TXMP ONI","TGA"); | 
 
 
 
 
 | 807 | this->commandMap.insertMulti("textures->DAT / TXMP ONI","DDS"); | 
 
 
 
 
 | 808 | this->commandMap.insertMulti("textures->DAT / TXMP ONI","PNG"); | 
 
 
 
 
 | 809 | this->commandMap.insertMulti("textures->DAT / TXMP ONI","JPG"); | 
 
 
 
 
 | 810 | this->commandMap.insertMulti("textures->TGA / DDS / PNG / JPG","TXMP ONI"); | 
 
 
 
 
 | 811 |  | 
 
 
 
 
 | 812 | ////////////////////////////////////////////////////////////////////////Characters Commands | 
 
 
 
 
 | 813 | this->commandMap.insert("characters->TRAM ONI->XML / XML & DAE","-extract:xml"); | 
 
 
 
 
 | 814 | this->commandMap.insert("characters->TRBS / ONCC ONI->DAE","-extract:dae"); | 
 
 
 
 
 | 815 | this->commandMap.insert("characters->TRBS XML->TRBS ONI","-create"); | 
 
 
 
 
 | 816 | this->commandMap.insert("characters->TRBS DAE->TRBS ONI","-create:trbs"); | 
 
 
 
 
 | 817 | this->commandMap.insert("characters->FILM DAT->XML","film2xml"); | 
 
 
 
 
 | 818 |  | 
 
 
 
 
 | 819 | //######################Characters Options | 
 
 
 
 
 | 820 | this->commandMap.insert("characters->"+ui->cbWithTRBS_ONCC->text(),"-anim-body:"); | 
 
 
 
 
 | 821 | this->commandMap.insert("characters->"+ui->cbCellShading->text(),"-cel"); | 
 
 
 
 
 | 822 | this->commandMap.insert("characters->"+ui->cbNormals->text(),"-normals"); | 
 
 
 
 
 | 823 | //Possible Combinations | 
 
 
 
 
 | 824 | this->commandMap.insertMulti("characters->TRAM ONI","XML / XML & DAE"); | 
 
 
 
 
 | 825 | this->commandMap.insertMulti("characters->TRBS / ONCC ONI","DAE"); | 
 
 
 
 
 | 826 | this->commandMap.insertMulti("characters->DAE","TRBS ONI"); | 
 
 
 
 
 | 827 | this->commandMap.insertMulti("characters->TRBS DAE","TRBS ONI"); | 
 
 
 
 
 | 828 | this->commandMap.insertMulti("characters->TRBS XML","TRBS ONI"); | 
 
 
 
 
 | 829 | this->commandMap.insertMulti("characters->FILM DAT","XML"); | 
 
 
 
 
 | 830 |  | 
 
 
 
 
 | 831 | ////////////////////////////////////////////////////////////////////////Objects Commands | 
 
 
 
 
 | 832 | this->commandMap.insert("objects->M3GM ONI->OBJ","-extract:obj"); | 
 
 
 
 
 | 833 | this->commandMap.insert("objects->M3GM ONI->DAE","-extract:dae"); | 
 
 
 
 
 | 834 | this->commandMap.insert("objects->ONWC ONI->OBJ","-extract:obj"); | 
 
 
 
 
 | 835 | this->commandMap.insert("objects->ONWC ONI->DAE","-extract:dae"); | 
 
 
 
 
 | 836 | this->commandMap.insert("objects->OBAN ONI (cam)->DAE","-extract:dae"); | 
 
 
 
 
 | 837 | this->commandMap.insert("objects->OBJ->M3GM ONI","-create:m3gm"); | 
 
 
 
 
 | 838 | //######################Characters Options | 
 
 
 
 
 | 839 | this->commandMap.insert("objects->"+ui->cbTexture->text(),"-tex:"); | 
 
 
 
 
 | 840 | this->commandMap.insert("objects->"+ui->cbWithAnimation->text(),"-geom:"); | 
 
 
 
 
 | 841 | //Possible Combinations | 
 
 
 
 
 | 842 | this->commandMap.insertMulti("objects->M3GM ONI","OBJ"); | 
 
 
 
 
 | 843 | this->commandMap.insertMulti("objects->M3GM ONI","DAE"); | 
 
 
 
 
 | 844 | this->commandMap.insertMulti("objects->ONWC ONI","OBJ"); | 
 
 
 
 
 | 845 | this->commandMap.insertMulti("objects->ONWC ONI","DAE"); | 
 
 
 
 
 | 846 | this->commandMap.insertMulti("objects->OBAN ONI (cam)","DAE"); | 
 
 
 
 
 | 847 | this->commandMap.insertMulti("objects->OBJ","M3GM ONI"); | 
 
 
 
 
 | 848 |  | 
 
 
 
 
 | 849 |  | 
 
 
 
 
 | 850 | ////////////////////////////////////////////////////////////////////////Levels Commands | 
 
 
 
 
 | 851 | this->commandMap.insert("levels->DAT->ONI FILES","-export"); | 
 
 
 
 
 | 852 | //this->commandMap.insert("levels->ONI FILES->DAT","-import"); //Not used. | 
 
 
 
 
 | 853 | this->commandMap.insert("levels->ONI FILES->DAT(PC)","-import:nosep"); | 
 
 
 
 
 | 854 | this->commandMap.insert("levels->ONI FILES->DAT(demoPCMAC)","-import:sep"); | 
 
 
 
 
 | 855 | this->commandMap.insert("levels->AKEV ONI->DAE","-extract:dae"); | 
 
 
 
 
 | 856 | this->commandMap.insert("levels->DAE->AKEV ONI","-create:akev"); | 
 
 
 
 
 | 857 | this->commandMap.insert("levels->MASTER XML->DAT","-create:level"); | 
 
 
 
 
 | 858 | this->commandMap.insert("levels->MASTER XML->ONI FILES","-create:level"); | 
 
 
 
 
 | 859 | //######################Levels Options | 
 
 
 
 
 | 860 | this->commandMap.insert("levels->"+ui->cbGridsLevels->text(),"-grid:create"); | 
 
 
 
 
 | 861 | //Possible Combinations | 
 
 
 
 
 | 862 | this->commandMap.insertMulti("levels->DAT","ONI FILES"); | 
 
 
 
 
 | 863 | this->commandMap.insertMulti("levels->ONI FILES","DAT"); | 
 
 
 
 
 | 864 | this->commandMap.insertMulti("levels->AKEV ONI","DAE"); | 
 
 
 
 
 | 865 | this->commandMap.insertMulti("levels->DAE","AKEV ONI"); | 
 
 
 
 
 | 866 | this->commandMap.insertMulti("levels->MASTER XML","DAT"); | 
 
 
 
 
 | 867 | this->commandMap.insertMulti("levels->MASTER XML","ONI FILES"); | 
 
 
 
 
 | 868 |  | 
 
 
 
 
 | 869 | ////////////////////////////////////////////////////////////////////////Misc Commands | 
 
 
 
 
 | 870 | this->commandMap.insert("misc->DAT / SNDD ONI->WAV","-extract:wav"); | 
 
 
 
 
 | 871 | this->commandMap.insert("misc->DAT / SNDD ONI->AIF","-extract:aif"); | 
 
 
 
 
 | 872 | this->commandMap.insert("misc->DAT / SUBT ONI->TXT","-extract:txt"); | 
 
 
 
 
 | 873 | this->commandMap.insert("misc->WAV / AIF->SNDD ONI","-create"); | 
 
 
 
 
 | 874 | this->commandMap.insert("misc->TXT->SUBT ONI","-create:subt"); | 
 
 
 
 
 | 875 | //Possible Combinations | 
 
 
 
 
 | 876 | this->commandMap.insertMulti("misc->DAT / SNDD ONI","WAV"); | 
 
 
 
 
 | 877 | this->commandMap.insertMulti("misc->DAT / SNDD ONI","AIF"); | 
 
 
 
 
 | 878 | this->commandMap.insertMulti("misc->DAT / SUBT ONI","TXT"); | 
 
 
 
 
 | 879 | this->commandMap.insertMulti("misc->WAV / AIF","SNDD ONI"); | 
 
 
 
 
 | 880 | this->commandMap.insertMulti("misc->TXT","SUBT ONI"); | 
 
 
 
 
 | 881 |  | 
 
 
 
 
 | 882 | } | 
 
 
 
 
 | 883 |  | 
 
 
 
 
 | 884 | void MainWindow::on_cbFromXML_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 | 885 | { | 
 
 
 
 
 | 886 | updateComboBox(arg1, ui->cbToXML); | 
 
 
 
 
 | 887 | } | 
 
 
 
 
 | 888 |  | 
 
 
 
 
 | 889 |  | 
 
 
 
 
 | 890 | void MainWindow::on_cbFromTextures_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 | 891 | { | 
 
 
 
 
 | 892 | updateComboBox(arg1, ui->cbToTextures); | 
 
 
 
 
 | 893 | } | 
 
 
 
 
 | 894 |  | 
 
 
 
 
 | 895 | void MainWindow::on_cbFromObjects_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 | 896 | { | 
 
 
 
 
 | 897 | updateComboBox(arg1, ui->cbToObjects); | 
 
 
 
 
 | 898 | } | 
 
 
 
 
 | 899 |  | 
 
 
 
 
 | 900 | void MainWindow::on_cbFromCharacters_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 | 901 | { | 
 
 
 
 
 | 902 | updateComboBox(arg1, ui->cbToCharacters); | 
 
 
 
 
 | 903 | } | 
 
 
 
 
 | 904 |  | 
 
 
 
 
 | 905 | void MainWindow::on_cbFromLevels_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 | 906 | { | 
 
 
 
 
 | 907 | updateComboBox(arg1, ui->cbToLevels); | 
 
 
 
 
 | 908 | } | 
 
 
 
 
 | 909 |  | 
 
 
 
 
 | 910 | void MainWindow::on_cbFromMisc_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 | 911 | { | 
 
 
 
 
 | 912 | updateComboBox(arg1, ui->cbToMisc); | 
 
 
 
 
 | 913 | } | 
 
 
 
 
 | 914 |  | 
 
 
 
 
 | 915 | void MainWindow::updateComboBox(const QString &arg1, QComboBox *comboBox){ | 
 
 
 
 
 | 916 |  | 
 
 
 
 
 | 917 | QString identifier; | 
 
 
 
 
 | 918 |  | 
 
 
 
 
 | 919 | if(comboBox == ui->cbToXML){ | 
 
 
 
 
 | 920 | identifier = ui->tabWidget->tabText(XMLTabIndex); | 
 
 
 
 
 | 921 | } | 
 
 
 
 
 | 922 | else if(comboBox == ui->cbToTextures){ | 
 
 
 
 
 | 923 | identifier = ui->tabWidget->tabText(TexturesTabIndex); | 
 
 
 
 
 | 924 |  | 
 
 
 
 
 | 925 | //Options are only used for DAT/ONI -> Image | 
 
 
 
 
 | 926 | if(QString::compare(arg1,"DAT / ONI",Qt::CaseSensitive)==0){ //case sensitive is faster | 
 
 
 
 
 | 927 | ui->gbTextures->setEnabled(false); | 
 
 
 
 
 | 928 | } | 
 
 
 
 
 | 929 | else{ | 
 
 
 
 
 | 930 | ui->gbTextures->setEnabled(true); | 
 
 
 
 
 | 931 | } | 
 
 
 
 
 | 932 | } | 
 
 
 
 
 | 933 | else if(comboBox == ui->cbToCharacters){ | 
 
 
 
 
 | 934 | identifier = ui->tabWidget->tabText(CharactersTabIndex); | 
 
 
 
 
 | 935 |  | 
 
 
 
 
 | 936 | ui->cbWithTRBS_ONCC->setEnabled(false); | 
 
 
 
 
 | 937 | ui->cbWithTRBS_ONCC->setChecked(false); | 
 
 
 
 
 | 938 | ui->cbCellShading->setEnabled(false); | 
 
 
 
 
 | 939 | ui->cbCellShading->setChecked(false); | 
 
 
 
 
 | 940 | ui->cbNormals->setEnabled(false); | 
 
 
 
 
 | 941 | ui->cbNormals->setChecked(false); | 
 
 
 
 
 | 942 |  | 
 
 
 
 
 | 943 | if(QString::compare(arg1,"TRAM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster | 
 
 
 
 
 | 944 | ui->cbWithTRBS_ONCC->setEnabled(true); | 
 
 
 
 
 | 945 | } | 
 
 
 
 
 | 946 | else if(QString::compare(arg1,"TRBS DAE",Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 947 | ui->cbNormals->setEnabled(true); | 
 
 
 
 
 | 948 | ui->cbCellShading->setEnabled(true); | 
 
 
 
 
 | 949 | } | 
 
 
 
 
 | 950 |  | 
 
 
 
 
 | 951 | } | 
 
 
 
 
 | 952 | else if(comboBox == ui->cbToObjects){ | 
 
 
 
 
 | 953 | identifier = ui->tabWidget->tabText(ObjectsTabIndex); | 
 
 
 
 
 | 954 |  | 
 
 
 
 
 | 955 | ui->cbTexture->setEnabled(false); | 
 
 
 
 
 | 956 | ui->cbTexture->setChecked(false); | 
 
 
 
 
 | 957 | ui->cbWithAnimation->setEnabled(false); | 
 
 
 
 
 | 958 | ui->cbWithAnimation->setChecked(false); | 
 
 
 
 
 | 959 |  | 
 
 
 
 
 | 960 | if(QString::compare(arg1,"M3GM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster | 
 
 
 
 
 | 961 | ui->cbWithAnimation->setEnabled(true); | 
 
 
 
 
 | 962 | } | 
 
 
 
 
 | 963 | else if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 964 | ui->cbTexture->setEnabled(true); | 
 
 
 
 
 | 965 | } | 
 
 
 
 
 | 966 | } | 
 
 
 
 
 | 967 | else if(comboBox == ui->cbToLevels){ | 
 
 
 
 
 | 968 | identifier = ui->tabWidget->tabText(LevelsTabIndex); | 
 
 
 
 
 | 969 |  | 
 
 
 
 
 | 970 | ui->cbSpecificFilesLevels->setEnabled(false); | 
 
 
 
 
 | 971 | ui->cbSpecificFilesLevels->setChecked(false); | 
 
 
 
 
 | 972 | ui->cbDatLevels->setEnabled(false); | 
 
 
 
 
 | 973 | ui->cbDatLevels->setChecked(false); | 
 
 
 
 
 | 974 | ui->cbBnvLevels->setEnabled(false); | 
 
 
 
 
 | 975 | ui->cbBnvLevels->setChecked(false); | 
 
 
 
 
 | 976 | ui->cbAdditionalSourcesLevels->setEnabled(false); | 
 
 
 
 
 | 977 | ui->cbAdditionalSourcesLevels->setChecked(false); | 
 
 
 
 
 | 978 | ui->cbGridsLevels->setEnabled(false); | 
 
 
 
 
 | 979 | ui->cbGridsLevels->setChecked(false); | 
 
 
 
 
 | 980 |  | 
 
 
 
 
 | 981 | if(arg1=="DAT"){ //case sensitive is faster | 
 
 
 
 
 | 982 | ui->cbSpecificFilesLevels->setEnabled(true); | 
 
 
 
 
 | 983 | } | 
 
 
 
 
 | 984 | else if(arg1=="ONI FILES"){ //case sensitive is faster | 
 
 
 
 
 | 985 | ui->cbDatLevels->setEnabled(true); | 
 
 
 
 
 | 986 | } | 
 
 
 
 
 | 987 | else if(arg1=="DAE"){ | 
 
 
 
 
 | 988 | ui->cbBnvLevels->setEnabled(true); | 
 
 
 
 
 | 989 | ui->cbAdditionalSourcesLevels->setEnabled(true); | 
 
 
 
 
 | 990 | } | 
 
 
 
 
 | 991 | } | 
 
 
 
 
 | 992 | else{ // Misc | 
 
 
 
 
 | 993 | identifier = ui->tabWidget->tabText(MiscTabIndex); | 
 
 
 
 
 | 994 | } | 
 
 
 
 
 | 995 |  | 
 
 
 
 
 | 996 | identifier = identifier.toLower(); // get current tab title text (lower case) | 
 
 
 
 
 | 997 |  | 
 
 
 
 
 | 998 | comboBox->clear(); | 
 
 
 
 
 | 999 |  | 
 
 
 
 
 | 1000 | QStringList toUpdate=QStringList(); | 
 
 
 
 
 | 1001 |  | 
 
 
 
 
 | 1002 | QStringList values=commandMap.values(identifier+"->"+arg1); | 
 
 
 
 
 | 1003 |  | 
 
 
 
 
 | 1004 | 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) | 
 
 
 
 
 | 1005 | toUpdate << values.at(i); | 
 
 
 
 
 | 1006 | } | 
 
 
 
 
 | 1007 |  | 
 
 
 
 
 | 1008 | comboBox->addItems(toUpdate); | 
 
 
 
 
 | 1009 | } | 
 
 
 
 
 | 1010 |  | 
 
 
 
 
 | 1011 |  | 
 
 
 
 
 | 1012 | void MainWindow::on_actionWindows_triggered() | 
 
 
 
 
 | 1013 | { | 
 
 
 
 
 | 1014 | ui->actionWindows->setChecked(true); | 
 
 
 
 
 | 1015 | ui->actionMac_Windows_demo->setChecked(false); | 
 
 
 
 
 | 1016 | } | 
 
 
 
 
 | 1017 |  | 
 
 
 
 
 | 1018 | void MainWindow::on_actionMac_Windows_demo_triggered() | 
 
 
 
 
 | 1019 | { | 
 
 
 
 
 | 1020 | ui->actionMac_Windows_demo->setChecked(true); | 
 
 
 
 
 | 1021 | ui->actionWindows->setChecked(false); | 
 
 
 
 
 | 1022 | } | 
 
 
 
 
 | 1023 |  | 
 
 
 
 
 | 1024 | void MainWindow::on_pbRemoveSourceXML_clicked() | 
 
 
 
 
 | 1025 | { | 
 
 
 
 
 | 1026 | removeTableContents( ui->twSourcesXML); | 
 
 
 
 
 | 1027 | } | 
 
 
 
 
 | 1028 |  | 
 
 
 
 
 | 1029 | void MainWindow::on_pbRemoveSourceTextures_clicked() | 
 
 
 
 
 | 1030 | { | 
 
 
 
 
 | 1031 | removeTableContents(ui->twSourcesTextures); | 
 
 
 
 
 | 1032 | } | 
 
 
 
 
 | 1033 |  | 
 
 
 
 
 | 1034 | void MainWindow::on_pbRemoveSourceObjects_clicked() | 
 
 
 
 
 | 1035 | { | 
 
 
 
 
 | 1036 | removeTableContents(ui->twSourcesObjects); | 
 
 
 
 
 | 1037 | } | 
 
 
 
 
 | 1038 |  | 
 
 
 
 
 | 1039 | void MainWindow::on_pbRemoveSourceCharacters_clicked() | 
 
 
 
 
 | 1040 | { | 
 
 
 
 
 | 1041 | removeTableContents(ui->twSourcesCharacters); | 
 
 
 
 
 | 1042 | } | 
 
 
 
 
 | 1043 |  | 
 
 
 
 
 | 1044 | void MainWindow::on_pbRemoveSourceLevels_clicked() | 
 
 
 
 
 | 1045 | { | 
 
 
 
 
 | 1046 | removeTableContents(ui->twSourcesLevels); | 
 
 
 
 
 | 1047 | } | 
 
 
 
 
 | 1048 |  | 
 
 
 
 
 | 1049 | void MainWindow::on_pbRemoveSourceMisc_clicked() | 
 
 
 
 
 | 1050 | { | 
 
 
 
 
 | 1051 | removeTableContents(ui->twSourcesMisc); | 
 
 
 
 
 | 1052 | } | 
 
 
 
 
 | 1053 |  | 
 
 
 
 
 | 1054 | void MainWindow::on_pbClearSourcesXML_clicked() | 
 
 
 
 
 | 1055 | { | 
 
 
 
 
 | 1056 | clearTableContents(ui->twSourcesXML); | 
 
 
 
 
 | 1057 | } | 
 
 
 
 
 | 1058 |  | 
 
 
 
 
 | 1059 | void MainWindow::on_pbClearSourcesTextures_clicked() | 
 
 
 
 
 | 1060 | { | 
 
 
 
 
 | 1061 | clearTableContents(ui->twSourcesTextures); | 
 
 
 
 
 | 1062 | } | 
 
 
 
 
 | 1063 |  | 
 
 
 
 
 | 1064 | void MainWindow::on_pbClearSourcesObjects_clicked() | 
 
 
 
 
 | 1065 | { | 
 
 
 
 
 | 1066 | clearTableContents(ui->twSourcesObjects); | 
 
 
 
 
 | 1067 | } | 
 
 
 
 
 | 1068 |  | 
 
 
 
 
 | 1069 | void MainWindow::on_pbClearSourcesCharacters_clicked() | 
 
 
 
 
 | 1070 | { | 
 
 
 
 
 | 1071 | clearTableContents(ui->twSourcesCharacters); | 
 
 
 
 
 | 1072 | } | 
 
 
 
 
 | 1073 |  | 
 
 
 
 
 | 1074 | void MainWindow::on_pbClearSourcesLevels_clicked() | 
 
 
 
 
 | 1075 | { | 
 
 
 
 
 | 1076 | clearTableContents(ui->twSourcesLevels); | 
 
 
 
 
 | 1077 | } | 
 
 
 
 
 | 1078 |  | 
 
 
 
 
 | 1079 | void MainWindow::on_pbClearSourcesMisc_clicked() | 
 
 
 
 
 | 1080 | { | 
 
 
 
 
 | 1081 | clearTableContents(ui->twSourcesMisc); | 
 
 
 
 
 | 1082 | } | 
 
 
 
 
 | 1083 |  | 
 
 
 
 
 | 1084 | void MainWindow::removeTableContents(DropTableWidget *myTable){ | 
 
 
 
 
 | 1085 | int size = myTable->selectionModel()->selectedRows().size(); | 
 
 
 
 
 | 1086 |  | 
 
 
 
 
 | 1087 | QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os | 
 
 
 
 
 | 1088 |  | 
 
 
 
 
 | 1089 | if(size==0){ | 
 
 
 
 
 | 1090 | Util::showPopUp("Select a row first."); | 
 
 
 
 
 | 1091 | return; | 
 
 
 
 
 | 1092 | } | 
 
 
 
 
 | 1093 |  | 
 
 
 
 
 | 1094 | #ifdef Q_OS_MAC | 
 
 
 
 
 | 1095 | if(this->useYesAsDefaultWhenRemovingItems){ | 
 
 
 
 
 | 1096 | defaultButton = QMessageBox::Yes; | 
 
 
 
 
 | 1097 | } | 
 
 
 
 
 | 1098 | else{ | 
 
 
 
 
 | 1099 | defaultButton = QMessageBox::No; | 
 
 
 
 
 | 1100 | } | 
 
 
 
 
 | 1101 | #endif | 
 
 
 
 
 | 1102 |  | 
 
 
 
 
 | 1103 |  | 
 
 
 
 
 | 1104 | if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?",defaultButton)){ | 
 
 
 
 
 | 1105 | for(int i=0; i<size; i++){ | 
 
 
 
 
 | 1106 | //myTable->removeRow(myTable->selectedItems().at(size-i-1)->row()); | 
 
 
 
 
 | 1107 | myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row()); | 
 
 
 
 
 | 1108 | } | 
 
 
 
 
 | 1109 | updateItemsLoaded(myTable); | 
 
 
 
 
 | 1110 | } | 
 
 
 
 
 | 1111 | } | 
 
 
 
 
 | 1112 |  | 
 
 
 
 
 | 1113 | void MainWindow::clearTableContents(DropTableWidget *myTable){ | 
 
 
 
 
 | 1114 |  | 
 
 
 
 
 | 1115 | QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os | 
 
 
 
 
 | 1116 |  | 
 
 
 
 
 | 1117 | if(myTable->rowCount()==0){ | 
 
 
 
 
 | 1118 | Util::showPopUp("Nothing to clear."); | 
 
 
 
 
 | 1119 | return; | 
 
 
 
 
 | 1120 | } | 
 
 
 
 
 | 1121 |  | 
 
 
 
 
 | 1122 | #ifdef Q_OS_MAC | 
 
 
 
 
 | 1123 | if(this->useYesAsDefaultWhenRemovingItems){ | 
 
 
 
 
 | 1124 | defaultButton = QMessageBox::Yes; | 
 
 
 
 
 | 1125 | } | 
 
 
 
 
 | 1126 | else{ | 
 
 
 
 
 | 1127 | defaultButton = QMessageBox::No; | 
 
 
 
 
 | 1128 | } | 
 
 
 
 
 | 1129 | #endif | 
 
 
 
 
 | 1130 |  | 
 
 
 
 
 | 1131 | if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){ | 
 
 
 
 
 | 1132 | clearTableNoPrompt(myTable); | 
 
 
 
 
 | 1133 | } | 
 
 
 
 
 | 1134 | updateItemsLoaded(myTable); | 
 
 
 
 
 | 1135 | } | 
 
 
 
 
 | 1136 |  | 
 
 
 
 
 | 1137 | void MainWindow::clearTableNoPrompt(DropTableWidget *myTable){ | 
 
 
 
 
 | 1138 | myTable->clearContents(); | 
 
 
 
 
 | 1139 | myTable->setRowCount(0); | 
 
 
 
 
 | 1140 | } | 
 
 
 
 
 | 1141 |  | 
 
 
 
 
 | 1142 | void MainWindow::on_actionPreferences_triggered() | 
 
 
 
 
 | 1143 | { | 
 
 
 
 
 | 1144 | //Show preferences | 
 
 
 
 
 | 1145 | Preferences *preferencesWindow = new Preferences(this,this->vagoSettings); | 
 
 
 
 
 | 1146 | preferencesWindow->exec(); //it destroys itself when finished. | 
 
 
 
 
 | 1147 | } | 
 
 
 
 
 | 1148 |  | 
 
 
 
 
 | 1149 |  | 
 
 
 
 
 | 1150 | void MainWindow::closeEvent(QCloseEvent *event){ | 
 
 
 
 
 | 1151 | if(this->vagoSettings->value("ConfirmExit").toBool()){ | 
 
 
 
 
 | 1152 | if(!Util::showQuestionPopUp(this,"Exit Vago?")){ | 
 
 
 
 
 | 1153 | event->ignore(); | 
 
 
 
 
 | 1154 | } | 
 
 
 
 
 | 1155 | } | 
 
 
 
 
 | 1156 | } | 
 
 
 
 
 | 1157 |  | 
 
 
 
 
 | 1158 | void MainWindow::on_cbToLevels_currentIndexChanged(const QString &arg1) | 
 
 
 
 
 | 1159 | { | 
 
 
 
 
 | 1160 |  | 
 
 
 
 
 | 1161 | if(ui->cbFromLevels->currentText()=="MASTER XML" && arg1=="DAT"){ | 
 
 
 
 
 | 1162 | ui->cbDatLevels->setEnabled(true); | 
 
 
 
 
 | 1163 | } | 
 
 
 
 
 | 1164 | else if(ui->cbFromLevels->currentText()=="MASTER XML" && arg1=="ONI FILES"){ | 
 
 
 
 
 | 1165 | ui->cbDatLevels->setEnabled(false); | 
 
 
 
 
 | 1166 | ui->cbDatLevels->setChecked(false); | 
 
 
 
 
 | 1167 | } | 
 
 
 
 
 | 1168 |  | 
 
 
 
 
 | 1169 | } | 
 
 
 
 
 | 1170 |  | 
 
 
 
 
 | 1171 | void MainWindow::on_cbDatLevels_toggled(bool checked) | 
 
 
 
 
 | 1172 | { | 
 
 
 
 
 | 1173 | ui->leTargetDatLevels->setEnabled(checked); | 
 
 
 
 
 | 1174 | } | 
 
 
 
 
 | 1175 |  | 
 
 
 
 
 | 1176 | void MainWindow::on_cbBnvLevels_toggled(bool checked) | 
 
 
 
 
 | 1177 | { | 
 
 
 
 
 | 1178 | ui->leBnvLevels->setEnabled(checked); | 
 
 
 
 
 | 1179 | ui->cbGridsLevels->setEnabled(checked); | 
 
 
 
 
 | 1180 | ui->cbGridsLevels->setChecked(checked); | 
 
 
 
 
 | 1181 | if(checked){ | 
 
 
 
 
 | 1182 | QString file=QFileDialog::getOpenFileName(this,"Choose the BNV.dae file...","./" , "All Files (*.*)"); | 
 
 
 
 
 | 1183 | if(!file.isEmpty()){ | 
 
 
 
 
 | 1184 | ui->leBnvLevels->setText(file); | 
 
 
 
 
 | 1185 | } | 
 
 
 
 
 | 1186 | } | 
 
 
 
 
 | 1187 | } | 
 
 
 
 
 | 1188 |  | 
 
 
 
 
 | 1189 | void MainWindow::on_cbAdditionalSourcesLevels_toggled(bool checked) | 
 
 
 
 
 | 1190 | { | 
 
 
 
 
 | 1191 | ui->leAdditSourcesLevels->setEnabled(checked); | 
 
 
 
 
 | 1192 |  | 
 
 
 
 
 | 1193 | if(checked){ | 
 
 
 
 
 | 1194 | QStringList filesSelected=QFileDialog::getOpenFileNames(this,"Choose the additional .dae files...","./" , "All Files (*.*)"); | 
 
 
 
 
 | 1195 | QString filesJoined; | 
 
 
 
 
 | 1196 | int size=filesSelected.size(); | 
 
 
 
 
 | 1197 |  | 
 
 
 
 
 | 1198 | if(!filesSelected.isEmpty()){ | 
 
 
 
 
 | 1199 | for(int i=0; i<size-1; i++){ | 
 
 
 
 
 | 1200 | filesJoined+=filesSelected.at(i)+" "; | 
 
 
 
 
 | 1201 | } | 
 
 
 
 
 | 1202 | filesJoined+=filesSelected.at(size-1); //last doesn't have space after | 
 
 
 
 
 | 1203 | ui->leAdditSourcesLevels->setText(filesJoined); | 
 
 
 
 
 | 1204 | } | 
 
 
 
 
 | 1205 |  | 
 
 
 
 
 | 1206 | } | 
 
 
 
 
 | 1207 | } | 
 
 
 
 
 | 1208 |  | 
 
 
 
 
 | 1209 | void MainWindow::on_cbWithTRBS_ONCC_toggled(bool checked) | 
 
 
 
 
 | 1210 | { | 
 
 
 
 
 | 1211 | ui->leTRBS_ONCC->setEnabled(checked); | 
 
 
 
 
 | 1212 | } | 
 
 
 
 
 | 1213 |  | 
 
 
 
 
 | 1214 | void MainWindow::on_actionCheck_OniSplit_version_triggered() | 
 
 
 
 
 | 1215 | { | 
 
 
 
 
 | 1216 | QProcess myProcess; | 
 
 
 
 
 | 1217 | myProcess.setWorkingDirectory(UtilVago::getAppPath()); | 
 
 
 
 
 | 1218 | myProcess.start(UtilVago::getOniSplitExeAbsolutePath()+" -version"); | 
 
 
 
 
 | 1219 | myProcess.waitForFinished(); | 
 
 
 
 
 | 1220 |  | 
 
 
 
 
 | 1221 | QString result=myProcess.readAllStandardOutput(); | 
 
 
 
 
 | 1222 |  | 
 
 
 
 
 | 1223 | Util::showPopUp("This Vago version was built with base in OniSplit version "+GlobalVars::BuiltOniSplitVersion+"\n\nCurrent version is:\n"+result.trimmed()); | 
 
 
 
 
 | 1224 | } | 
 
 
 
 
 | 1225 |  | 
 
 
 
 
 | 1226 | void MainWindow::on_actionCheck_xmlTools_version_triggered() | 
 
 
 
 
 | 1227 | { | 
 
 
 
 
 | 1228 | QProcess myProcess; | 
 
 
 
 
 | 1229 | myProcess.setWorkingDirectory(UtilVago::getAppPath()); | 
 
 
 
 
 | 1230 | myProcess.start(UtilVago::getXmlToolsExeAbsolutePath()+" --version"); | 
 
 
 
 
 | 1231 | myProcess.waitForFinished(); | 
 
 
 
 
 | 1232 | QString result=myProcess.readLine(); | 
 
 
 
 
 | 1233 |  | 
 
 
 
 
 | 1234 | Util::showPopUp("This Vago version was built with base in XmlTools version "+GlobalVars::BuiltXmlToolsVersion+"\n\nCurrent version is:\n"+result.trimmed()); | 
 
 
 
 
 | 1235 | } | 
 
 
 
 
 | 1236 |  | 
 
 
 
 
 | 1237 | /** | 
 
 
 
 
 | 1238 | Update items loaded | 
 
 
 
 
 | 1239 | **/ | 
 
 
 
 
 | 1240 | void MainWindow::on_tabWidget_currentChanged(int) | 
 
 
 
 
 | 1241 | { | 
 
 
 
 
 | 1242 | updateItemsLoaded(getCurrentTableWidget()); | 
 
 
 
 
 | 1243 | } | 
 
 
 
 
 | 1244 |  | 
 
 
 
 
 | 1245 | void MainWindow::updateItemsLoaded(DropTableWidget *currentTable){ | 
 
 
 
 
 | 1246 |  | 
 
 
 
 
 | 1247 | int numItems=currentTable->rowCount(); | 
 
 
 
 
 | 1248 |  | 
 
 
 
 
 | 1249 | this->itemsLoaded->setText(QString().setNum(numItems)+ (numItems==1?" item ":" items ") +"loaded"); | 
 
 
 
 
 | 1250 | } | 
 
 
 
 
 | 1251 |  | 
 
 
 
 
 | 1252 | void MainWindow::on_tbCommand_clicked() | 
 
 
 
 
 | 1253 | { | 
 
 
 
 
 | 1254 | //Show preferences | 
 
 
 
 
 | 1255 | ManualCommands *commandsWindow = new ManualCommands(this); | 
 
 
 
 
 | 1256 | commandsWindow->show(); //it destroys itself when finished. | 
 
 
 
 
 | 1257 | } | 
 
 
 
 
 | 1258 |  | 
 
 
 
 
 | 1259 | void MainWindow::on_actionWorkspace_triggered() | 
 
 
 
 
 | 1260 | { | 
 
 
 
 
 | 1261 | ui->actionWorkspace->setChecked(true); | 
 
 
 
 
 | 1262 | ui->actionOther->setChecked(false); | 
 
 
 
 
 | 1263 | this->outputFolder=this->workspaceLocation; | 
 
 
 
 
 | 1264 | ui->tbOpenFolder->setToolTip("Open Vago workspace"); | 
 
 
 
 
 | 1265 | showSuccessStatusMessage("Vago is now outputting the NEW items for Vago workspace."); | 
 
 
 
 
 | 1266 | } | 
 
 
 
 
 | 1267 |  | 
 
 
 
 
 | 1268 | void MainWindow::on_actionOther_triggered() | 
 
 
 
 
 | 1269 | { | 
 
 
 
 
 | 1270 | QString newDir=QFileDialog::getExistingDirectory(this,"Choose the folder for output NEW files directly...",this->AeLocation+"/GameDataFolder"); | 
 
 
 
 
 | 1271 | newDir=Util::normalizePath(newDir); | 
 
 
 
 
 | 1272 |  | 
 
 
 
 
 | 1273 | if(newDir.isEmpty()){ | 
 
 
 
 
 | 1274 | ui->actionOther->setChecked(false); | 
 
 
 
 
 | 1275 | return; //do nothing | 
 
 
 
 
 | 1276 | } | 
 
 
 
 
 | 1277 |  | 
 
 
 
 
 | 1278 | if(newDir==this->workspaceLocation){ | 
 
 
 
 
 | 1279 | on_actionWorkspace_triggered(); //set it to vago workspace | 
 
 
 
 
 | 1280 | return; | 
 
 
 
 
 | 1281 | } | 
 
 
 
 
 | 1282 |  | 
 
 
 
 
 | 1283 | ui->actionOther->setChecked(true); | 
 
 
 
 
 | 1284 | ui->actionWorkspace->setChecked(false); | 
 
 
 
 
 | 1285 |  | 
 
 
 
 
 | 1286 | this->outputFolder=newDir; | 
 
 
 
 
 | 1287 |  | 
 
 
 
 
 | 1288 | QString newDirName=Util::cutName(newDir); | 
 
 
 
 
 | 1289 | ui->tbOpenFolder->setToolTip("Open "+newDirName+" output folder"); | 
 
 
 
 
 | 1290 | showSuccessStatusMessage("Vago is now outputting the NEW items for "+newDirName+"."); | 
 
 
 
 
 | 1291 | } | 
 
 
 
 
 | 1292 |  | 
 
 
 
 
 | 1293 | void MainWindow::on_actionView_log_triggered() | 
 
 
 
 
 | 1294 | { | 
 
 
 
 
 | 1295 | UtilVago::openLogFile(); | 
 
 
 
 
 | 1296 | } | 
 
 
 
 
 | 1297 |  | 
 
 
 
 
 | 1298 | void MainWindow::on_actionOpen_AE_folder_triggered() | 
 
 
 
 
 | 1299 | { | 
 
 
 
 
 | 1300 | QDesktopServices::openUrl(QUrl("file:///"+this->AeLocation)); | 
 
 
 
 
 | 1301 | } | 
 
 
 
 
 | 1302 |  | 
 
 
 
 
 | 1303 | void MainWindow::on_actionSave_Project_triggered() | 
 
 
 
 
 | 1304 | { | 
 
 
 
 
 | 1305 |  | 
 
 
 
 
 | 1306 | QString filePath = QFileDialog::getSaveFileName(this, tr("Save File"), | 
 
 
 
 
 | 1307 | this->vagoSettings->value("LastProjectPath").toString(), | 
 
 
 
 
 | 1308 | tr("Vago project files (*.vgp)")); | 
 
 
 
 
 | 1309 |  | 
 
 
 
 
 | 1310 | if(!filePath.isEmpty()){ | 
 
 
 
 
 | 1311 | saveProjectState(filePath); | 
 
 
 
 
 | 1312 | } | 
 
 
 
 
 | 1313 |  | 
 
 
 
 
 | 1314 | } | 
 
 
 
 
 | 1315 |  | 
 
 
 
 
 | 1316 | void MainWindow::on_actionSave_triggered() | 
 
 
 
 
 | 1317 | { | 
 
 
 
 
 | 1318 | if(this->lastProjectFilePath.isEmpty()){ | 
 
 
 
 
 | 1319 | on_actionSave_Project_triggered(); | 
 
 
 
 
 | 1320 | return; | 
 
 
 
 
 | 1321 | } | 
 
 
 
 
 | 1322 |  | 
 
 
 
 
 | 1323 | saveProjectState(this->lastProjectFilePath); | 
 
 
 
 
 | 1324 | } | 
 
 
 
 
 | 1325 |  | 
 
 
 
 
 | 1326 | void MainWindow::on_actionLoad_Project_triggered() | 
 
 
 
 
 | 1327 | { | 
 
 
 
 
 | 1328 |  | 
 
 
 
 
 | 1329 | QString filePath = QFileDialog::getOpenFileName(this, tr("Load File"), | 
 
 
 
 
 | 1330 | this->vagoSettings->value("LastProjectPath").toString(), | 
 
 
 
 
 | 1331 | tr("Vago project files (*.vgp)")); | 
 
 
 
 
 | 1332 | if(!filePath.isEmpty()){ | 
 
 
 
 
 | 1333 | loadProjectState(filePath); | 
 
 
 
 
 | 1334 | } | 
 
 
 
 
 | 1335 | } | 
 
 
 
 
 | 1336 |  | 
 
 
 
 
 | 1337 | void MainWindow::on_actionProject1_triggered() | 
 
 
 
 
 | 1338 | { | 
 
 
 
 
 | 1339 | loadProjectState(this->ui->actionProject1->text()); | 
 
 
 
 
 | 1340 | } | 
 
 
 
 
 | 1341 |  | 
 
 
 
 
 | 1342 | void MainWindow::on_actionProject2_triggered() | 
 
 
 
 
 | 1343 | { | 
 
 
 
 
 | 1344 | loadProjectState(this->ui->actionProject2->text()); | 
 
 
 
 
 | 1345 | } | 
 
 
 
 
 | 1346 |  | 
 
 
 
 
 | 1347 | void MainWindow::on_actionProject3_triggered() | 
 
 
 
 
 | 1348 | { | 
 
 
 
 
 | 1349 | loadProjectState(this->ui->actionProject3->text()); | 
 
 
 
 
 | 1350 | } | 
 
 
 
 
 | 1351 |  | 
 
 
 
 
 | 1352 | void MainWindow::on_actionProject4_triggered() | 
 
 
 
 
 | 1353 | { | 
 
 
 
 
 | 1354 | loadProjectState(this->ui->actionProject4->text()); | 
 
 
 
 
 | 1355 | } | 
 
 
 
 
 | 1356 |  | 
 
 
 
 
 | 1357 | void MainWindow::on_actionProject5_triggered() | 
 
 
 
 
 | 1358 | { | 
 
 
 
 
 | 1359 | loadProjectState(this->ui->actionProject5->text()); | 
 
 
 
 
 | 1360 | } | 
 
 
 
 
 | 1361 |  | 
 
 
 
 
 | 1362 | QString MainWindow::getTypeConversion(DropTableWidget *myTable){ | 
 
 
 
 
 | 1363 | QString from,to; | 
 
 
 
 
 | 1364 |  | 
 
 
 
 
 | 1365 | if(myTable==ui->twSourcesXML){ | 
 
 
 
 
 | 1366 | from=ui->cbFromXML->currentText(); | 
 
 
 
 
 | 1367 | to=ui->cbToXML->currentText(); | 
 
 
 
 
 | 1368 | } | 
 
 
 
 
 | 1369 | else if(myTable==ui->twSourcesTextures){ | 
 
 
 
 
 | 1370 | from=ui->cbFromTextures->currentText(); | 
 
 
 
 
 | 1371 | to=ui->cbToTextures->currentText(); | 
 
 
 
 
 | 1372 | } | 
 
 
 
 
 | 1373 | else if(myTable==ui->twSourcesObjects){ | 
 
 
 
 
 | 1374 | from=ui->cbFromObjects->currentText(); | 
 
 
 
 
 | 1375 | to=ui->cbToObjects->currentText(); | 
 
 
 
 
 | 1376 | } | 
 
 
 
 
 | 1377 | else if(myTable==ui->twSourcesCharacters){ | 
 
 
 
 
 | 1378 | from=ui->cbFromCharacters->currentText(); | 
 
 
 
 
 | 1379 | to=ui->cbToCharacters->currentText(); | 
 
 
 
 
 | 1380 | } | 
 
 
 
 
 | 1381 | else if(myTable==ui->twSourcesLevels){ | 
 
 
 
 
 | 1382 | from=ui->cbFromLevels->currentText(); | 
 
 
 
 
 | 1383 | to=ui->cbToLevels->currentText(); | 
 
 
 
 
 | 1384 | } | 
 
 
 
 
 | 1385 | else{ | 
 
 
 
 
 | 1386 | from=ui->cbFromMisc->currentText(); | 
 
 
 
 
 | 1387 | to=ui->cbToMisc->currentText(); | 
 
 
 
 
 | 1388 | } | 
 
 
 
 
 | 1389 |  | 
 
 
 
 
 | 1390 | return from + " > " + to; | 
 
 
 
 
 | 1391 | } | 
 
 
 
 
 | 1392 |  | 
 
 
 
 
 | 1393 | //Drop table widget context menu | 
 
 
 
 
 | 1394 | void MainWindow::dtContextMenu(DropTableWidget* myTable, QContextMenuEvent *event){ | 
 
 
 
 
 | 1395 | QModelIndex index = myTable->indexAt(event->pos()); | 
 
 
 
 
 | 1396 |  | 
 
 
 
 
 | 1397 | //item exists? | 
 
 
 
 
 | 1398 | if(!index.isValid()) | 
 
 
 
 
 | 1399 | return; | 
 
 
 
 
 | 1400 |  | 
 
 
 
 
 | 1401 | if(myTable->selectionModel()->selectedRows().size()==0){ //No multiple rows selected | 
 
 
 
 
 | 1402 | myTable->selectRow(myTable->itemAt(event->pos())->row()); //select all the row of the item clicked | 
 
 
 
 
 | 1403 | } | 
 
 
 
 
 | 1404 |  | 
 
 
 
 
 | 1405 | QList<int> selectedRows = QList<int>(); | 
 
 
 
 
 | 1406 |  | 
 
 
 
 
 | 1407 | foreach(QModelIndex rowItem, myTable->selectionModel()->selectedRows()){ | 
 
 
 
 
 | 1408 | selectedRows << rowItem.row(); | 
 
 
 
 
 | 1409 | } | 
 
 
 
 
 | 1410 |  | 
 
 
 
 
 | 1411 | std::unique_ptr<QMenu> menu = std::make_unique<QMenu>(); | 
 
 
 
 
 | 1412 | std::unique_ptr<QAction> copy =  std::make_unique<QAction>("Copy",myTable); | 
 
 
 
 
 | 1413 | std::unique_ptr<QAction> moveUp = std::make_unique<QAction>("Move Up",myTable); | 
 
 
 
 
 | 1414 | std::unique_ptr<QAction> moveDown = std::make_unique<QAction>("Move Down",myTable); | 
 
 
 
 
 | 1415 | std::unique_ptr<QAction> changeOptions = std::make_unique<QAction>("Change To Current Options",myTable); | 
 
 
 
 
 | 1416 | std::unique_ptr<QMenu> changeOutput = std::make_unique<QMenu>("Change Output for:"); | 
 
 
 
 
 | 1417 | std::unique_ptr<QAction> outWorkspace = std::make_unique<QAction>("Workspace",myTable); | 
 
 
 
 
 | 1418 | std::unique_ptr<QAction> outCurrOutput = std::make_unique<QAction>("Current Output Folder",myTable); | 
 
 
 
 
 | 1419 | std::unique_ptr<QAction> outOther = std::make_unique<QAction>("Other...",myTable); | 
 
 
 
 
 | 1420 | std::unique_ptr<QAction> edisable = std::make_unique<QAction>("Enable/Disable",myTable); | 
 
 
 
 
 | 1421 |  | 
 
 
 
 
 | 1422 | menu->addAction(copy.get()); | 
 
 
 
 
 | 1423 | menu->addSeparator(); | 
 
 
 
 
 | 1424 | menu->addAction(moveUp.get()); | 
 
 
 
 
 | 1425 | menu->addAction(moveDown.get()); | 
 
 
 
 
 | 1426 | menu->addSeparator(); | 
 
 
 
 
 | 1427 | menu->addAction(changeOptions.get()); | 
 
 
 
 
 | 1428 | menu->addMenu(changeOutput.get()); | 
 
 
 
 
 | 1429 | changeOutput->addActions(QList<QAction*>() << outWorkspace.get() << outCurrOutput.get() << outOther.get()); | 
 
 
 
 
 | 1430 | menu->addAction(edisable.get()); | 
 
 
 
 
 | 1431 |  | 
 
 
 
 
 | 1432 |  | 
 
 
 
 
 | 1433 | //if it's in the first row it can't be setted up | 
 
 
 
 
 | 1434 | if(selectedRows.at(0)==0){ | 
 
 
 
 
 | 1435 | moveUp->setEnabled(false); | 
 
 
 
 
 | 1436 | } | 
 
 
 
 
 | 1437 |  | 
 
 
 
 
 | 1438 | //if we are at bottom we can't go down | 
 
 
 
 
 | 1439 | if(selectedRows.at(selectedRows.size()-1)==myTable->rowCount()-1){ | 
 
 
 
 
 | 1440 | moveDown->setEnabled(false); | 
 
 
 
 
 | 1441 | } | 
 
 
 
 
 | 1442 |  | 
 
 
 
 
 | 1443 | //Can we change the settings? (the conversion must be the same) | 
 
 
 
 
 | 1444 | QString currentSettings = (getTypeConversion(myTable)); //call function at the mainWindow with a signal (different threads?) | 
 
 
 
 
 | 1445 | foreach(int row, selectedRows){ | 
 
 
 
 
 | 1446 | if( myTable->item(row,1)->text() != currentSettings){ //If we find out any of the selected items can't be convert disable operation | 
 
 
 
 
 | 1447 | changeOptions->setEnabled(false); | 
 
 
 
 
 | 1448 | break; | 
 
 
 
 
 | 1449 | } | 
 
 
 
 
 | 1450 | } | 
 
 
 
 
 | 1451 |  | 
 
 
 
 
 | 1452 | QAction* selectedOption = menu->exec(event->globalPos()); | 
 
 
 
 
 | 1453 |  | 
 
 
 
 
 | 1454 | if(selectedOption==copy.get()){ | 
 
 
 
 
 | 1455 | //Let's copy the contents to the clipboard | 
 
 
 
 
 | 1456 |  | 
 
 
 
 
 | 1457 | QString toCopy; | 
 
 
 
 
 | 1458 |  | 
 
 
 
 
 | 1459 | int size=selectedRows.size(); | 
 
 
 
 
 | 1460 |  | 
 
 
 
 
 | 1461 | //Let's format it a bit... | 
 
 
 
 
 | 1462 | for(int i=0; i<size; i++){ | 
 
 
 
 
 | 1463 | for(int j=0; j<myTable->columnCount(); j++){ | 
 
 
 
 
 | 1464 | toCopy+=myTable->item(selectedRows.at(i),j)->text(); | 
 
 
 
 
 | 1465 | if(j!=myTable->columnCount()-1){ | 
 
 
 
 
 | 1466 | toCopy+="\t"; | 
 
 
 
 
 | 1467 | } | 
 
 
 
 
 | 1468 | } | 
 
 
 
 
 | 1469 | if(i!=size-1){ | 
 
 
 
 
 | 1470 | toCopy+="\n"; | 
 
 
 
 
 | 1471 | } | 
 
 
 
 
 | 1472 | } | 
 
 
 
 
 | 1473 |  | 
 
 
 
 
 | 1474 | QApplication::clipboard()->setText(toCopy); | 
 
 
 
 
 | 1475 | showSuccessStatusMessage(QString::number(size) + (size==1?" item ":" items ")+ "copied to the clipboard"); | 
 
 
 
 
 | 1476 | } | 
 
 
 
 
 | 1477 | else if(selectedOption==moveUp.get()){ | 
 
 
 
 
 | 1478 | qSort(selectedRows); //let's order the selections by the row number, so we know exactly how to swap it | 
 
 
 
 
 | 1479 | myTable->swapPositions(selectedRows,-1); | 
 
 
 
 
 | 1480 | } | 
 
 
 
 
 | 1481 | else if(selectedOption==moveDown.get()){ | 
 
 
 
 
 | 1482 | qSort(selectedRows); | 
 
 
 
 
 | 1483 | myTable->swapPositions(selectedRows,+1); | 
 
 
 
 
 | 1484 | } | 
 
 
 
 
 | 1485 | else if(selectedOption==changeOptions.get()){ | 
 
 
 
 
 | 1486 | changeToCurrentSettings(selectedRows,myTable); | 
 
 
 
 
 | 1487 | } | 
 
 
 
 
 | 1488 | else if(selectedOption==outWorkspace.get()){ | 
 
 
 
 
 | 1489 | changeItemsOutput(myTable,selectedRows,this->workspaceLocation); | 
 
 
 
 
 | 1490 | } | 
 
 
 
 
 | 1491 | else if(selectedOption==outCurrOutput.get()){ | 
 
 
 
 
 | 1492 | changeItemsOutput(myTable,selectedRows,this->outputFolder); | 
 
 
 
 
 | 1493 | } | 
 
 
 
 
 | 1494 | else if(selectedOption==outOther.get()){ | 
 
 
 
 
 | 1495 |  | 
 
 
 
 
 | 1496 | QString newDir=QFileDialog::getExistingDirectory(this,"Choose the folder for the output of the files selected...",this->AeLocation+"/GameDataFolder"); | 
 
 
 
 
 | 1497 | newDir=Util::normalizePath(newDir); | 
 
 
 
 
 | 1498 |  | 
 
 
 
 
 | 1499 | if(newDir.isEmpty()){ | 
 
 
 
 
 | 1500 | return; //do nothing | 
 
 
 
 
 | 1501 | } | 
 
 
 
 
 | 1502 |  | 
 
 
 
 
 | 1503 | changeItemsOutput(myTable,selectedRows,newDir); | 
 
 
 
 
 | 1504 |  | 
 
 
 
 
 | 1505 | } | 
 
 
 
 
 | 1506 | else if(selectedOption==edisable.get()){ | 
 
 
 
 
 | 1507 |  | 
 
 
 
 
 | 1508 | int enabledCount=0, disabledCount=0; | 
 
 
 
 
 | 1509 |  | 
 
 
 
 
 | 1510 | for(int i=0; i<selectedRows.size(); i++){ | 
 
 
 
 
 | 1511 |  | 
 
 
 
 
 | 1512 | for(int j=0; j<myTable->columnCount(); j++){ | 
 
 
 
 
 | 1513 | QTableWidgetItem *currentItem=myTable->item(selectedRows.at(i),j); | 
 
 
 
 
 | 1514 |  | 
 
 
 
 
 | 1515 | if(currentItem->background()!=myTable->disabledBackStyle){ | 
 
 
 
 
 | 1516 | myTable->setDisableStyleWidgetItem(currentItem); | 
 
 
 
 
 | 1517 | if(j==0){ //Only count the row, not the columns | 
 
 
 
 
 | 1518 | disabledCount++; | 
 
 
 
 
 | 1519 | } | 
 
 
 
 
 | 1520 | } | 
 
 
 
 
 | 1521 | else{ //reset to initial state (enable) | 
 
 
 
 
 | 1522 | myTable->resetStyleWidgetItem(currentItem); | 
 
 
 
 
 | 1523 | if(j==0){ | 
 
 
 
 
 | 1524 | enabledCount++; | 
 
 
 
 
 | 1525 | } | 
 
 
 
 
 | 1526 | } | 
 
 
 
 
 | 1527 | } | 
 
 
 
 
 | 1528 | } | 
 
 
 
 
 | 1529 |  | 
 
 
 
 
 | 1530 | QString result; | 
 
 
 
 
 | 1531 |  | 
 
 
 
 
 | 1532 | if(enabledCount!=0){ | 
 
 
 
 
 | 1533 | result+=QString::number(enabledCount) + (enabledCount==1?" item ":" items ") + "Enabled"; | 
 
 
 
 
 | 1534 | } | 
 
 
 
 
 | 1535 | if(enabledCount!=0 && disabledCount!=0){ | 
 
 
 
 
 | 1536 | result+=" and "; | 
 
 
 
 
 | 1537 | } | 
 
 
 
 
 | 1538 | if(disabledCount!=0){ | 
 
 
 
 
 | 1539 | result+=QString::number(disabledCount) + (disabledCount==1?" item ":" items ") + "Disabled"; | 
 
 
 
 
 | 1540 | } | 
 
 
 
 
 | 1541 |  | 
 
 
 
 
 | 1542 | showSuccessStatusMessage(result); | 
 
 
 
 
 | 1543 | } | 
 
 
 
 
 | 1544 | } | 
 
 
 
 
 | 1545 |  | 
 
 
 
 
 | 1546 | void MainWindow::changeToCurrentSettings(QList<int> rows, DropTableWidget* myTable){ | 
 
 
 
 
 | 1547 | //construct a command for each one | 
 
 
 
 
 | 1548 | //Output a status message saying the number of changed files | 
 
 
 
 
 | 1549 | QString fromTo=getTypeConversion(myTable); | 
 
 
 
 
 | 1550 | 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 | 
 
 
 
 
 | 1551 | QString to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> " | 
 
 
 
 
 | 1552 |  | 
 
 
 
 
 | 1553 | QString command; | 
 
 
 
 
 | 1554 |  | 
 
 
 
 
 | 1555 | foreach(int row, rows){ | 
 
 
 
 
 | 1556 |  | 
 
 
 
 
 | 1557 | command=getCommand(myTable,getFileOutputFolder(fromTo,myTable->getOutputAbsolute(row)),from,to,myTable->getFileAbsolute(row)); | 
 
 
 
 
 | 1558 |  | 
 
 
 
 
 | 1559 | if(command.isEmpty()){ //something wrong was happening (not inputted a texture name?) | 
 
 
 
 
 | 1560 | return; //stop changing settings | 
 
 
 
 
 | 1561 | } | 
 
 
 
 
 | 1562 |  | 
 
 
 
 
 | 1563 | myTable->item(row,2)->setText(command); //update settings to the current row | 
 
 
 
 
 | 1564 | myTable->updateTableToolTips(row); | 
 
 
 
 
 | 1565 | } | 
 
 
 
 
 | 1566 |  | 
 
 
 
 
 | 1567 | showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed to the current settings"); | 
 
 
 
 
 | 1568 | } | 
 
 
 
 
 | 1569 |  | 
 
 
 
 
 | 1570 | void MainWindow::changeItemsOutput(DropTableWidget* myTable, QList<int> rows, QString newOutput){ | 
 
 
 
 
 | 1571 |  | 
 
 
 
 
 | 1572 | QString command, currentAbsoluteFile, fromTo, from, to; | 
 
 
 
 
 | 1573 |  | 
 
 
 
 
 | 1574 | foreach(int row, rows){ //No optimization possible here, commands may be different | 
 
 
 
 
 | 1575 | fromTo=myTable->item(row,1)->text(); | 
 
 
 
 
 | 1576 | from = QString(fromTo).remove(fromTo.indexOf(" >"),fromTo.size()-1); //parse the string to get the from | 
 
 
 
 
 | 1577 | to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> " | 
 
 
 
 
 | 1578 |  | 
 
 
 
 
 | 1579 | currentAbsoluteFile=myTable->getFileAbsolute(row); | 
 
 
 
 
 | 1580 | command=getCommand(myTable,getFileOutputFolder(fromTo,newOutput),from,to,currentAbsoluteFile); | 
 
 
 
 
 | 1581 |  | 
 
 
 
 
 | 1582 | if(command.isEmpty()){ //something wrong was happening (not inputted a texture name?) | 
 
 
 
 
 | 1583 | return; //stop changing output | 
 
 
 
 
 | 1584 | } | 
 
 
 
 
 | 1585 |  | 
 
 
 
 
 | 1586 | myTable->item(row,2)->setText(command); //update command to the current row | 
 
 
 
 
 | 1587 | myTable->updateTableToolTips(row); | 
 
 
 
 
 | 1588 | } | 
 
 
 
 
 | 1589 |  | 
 
 
 
 
 | 1590 | showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed the output to "+(newOutput!=this->workspaceLocation?Util::cutName(newOutput):"Vago workspace")); | 
 
 
 
 
 | 1591 | } | 
 
 
 
 
 | 1592 |  | 
 
 
 
 
 | 1593 | QString MainWindow::getCommand(DropTableWidget* myTable, QString myOutputFolder, QString from, QString to , QString file){ | 
 
 
 
 
 | 1594 |  | 
 
 
 
 
 | 1595 | QString tabTitle=ui->tabWidget->tabText(ui->tabWidget->currentIndex()).toLower(); // get current tab title | 
 
 
 
 
 | 1596 |  | 
 
 
 
 
 | 1597 | if(myTable==ui->twSourcesXML){ //So we only need to parse one command. | 
 
 
 
 
 | 1598 | return fileParsingXML(tabTitle, myOutputFolder,from,to,file); | 
 
 
 
 
 | 1599 | } | 
 
 
 
 
 | 1600 | else if(myTable==ui->twSourcesTextures){ | 
 
 
 
 
 | 1601 | return fileParsingTextures(tabTitle, myOutputFolder,from,to,file); | 
 
 
 
 
 | 1602 | } | 
 
 
 
 
 | 1603 | else if(myTable==ui->twSourcesObjects){ | 
 
 
 
 
 | 1604 | return fileParsingObjects(tabTitle, myOutputFolder,from,to,file); | 
 
 
 
 
 | 1605 | } | 
 
 
 
 
 | 1606 | else if(myTable==ui->twSourcesCharacters){ | 
 
 
 
 
 | 1607 | return fileParsingCharacters(tabTitle, myOutputFolder,from,to,file); | 
 
 
 
 
 | 1608 | } | 
 
 
 
 
 | 1609 | else if(myTable==ui->twSourcesLevels){ | 
 
 
 
 
 | 1610 | return fileParsingLevels(tabTitle, myOutputFolder,from,to,file); | 
 
 
 
 
 | 1611 | } | 
 
 
 
 
 | 1612 | else{ | 
 
 
 
 
 | 1613 | return fileParsingMisc(myOutputFolder,from,to,file); | 
 
 
 
 
 | 1614 | } | 
 
 
 
 
 | 1615 |  | 
 
 
 
 
 | 1616 | } | 
 
 
 
 
 | 1617 |  | 
 
 
 
 
 | 1618 | void MainWindow::connectSlots(){ | 
 
 
 
 
 | 1619 |  | 
 
 
 
 
 | 1620 | //This signal is for thread that is working setup the progress bar (make it visible and set it's min-max) | 
 
 
 
 
 | 1621 | connect(myConverter, SIGNAL(setupPB(int)), this, SLOT(TsetupProgressBar(int)), Qt::BlockingQueuedConnection); | 
 
 
 
 
 | 1622 |  | 
 
 
 
 
 | 1623 | //This signal is for thread that is working can update the progress bar of the gui | 
 
 
 
 
 | 1624 | connect(myConverter, SIGNAL(taskDone()), this, SLOT(TupdateProgressBar()),Qt::BlockingQueuedConnection); | 
 
 
 
 
 | 1625 |  | 
 
 
 
 
 | 1626 | //This signal is for thread that is working can show the result of a conversion | 
 
 
 
 
 | 1627 | connect(myConverter, SIGNAL(resultConversion(QString,int)), this, SLOT(TresultConversion(QString,int))); | 
 
 
 
 
 | 1628 |  | 
 
 
 
 
 | 1629 | //This signal is for thread that is working notify the gui thread that the conversion was aborted with sucess | 
 
 
 
 
 | 1630 | connect(myConverter, SIGNAL(conversionAborted()), this, SLOT(TconversionAborted())); | 
 
 
 
 
 | 1631 |  | 
 
 
 
 
 | 1632 | // This signal is to the user be able to terminate a conversion (OniSplit process in class myConverter will be terminated) | 
 
 
 
 
 | 1633 | connect(this, SIGNAL(terminateCurrProcess()), myConverter, SLOT(terminateCurrProcess())); | 
 
 
 
 
 | 1634 |  | 
 
 
 
 
 | 1635 | //Drop signal for General table | 
 
 
 
 
 | 1636 | connect(ui->twSourcesXML, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 | 1637 |  | 
 
 
 
 
 | 1638 | //Drop signal for Textures table | 
 
 
 
 
 | 1639 | connect(ui->twSourcesTextures, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 | 1640 |  | 
 
 
 
 
 | 1641 | //Drop signal for Objects table | 
 
 
 
 
 | 1642 | connect(ui->twSourcesObjects, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 | 1643 |  | 
 
 
 
 
 | 1644 | //Drop signal for Characters table | 
 
 
 
 
 | 1645 | connect(ui->twSourcesCharacters, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 | 1646 |  | 
 
 
 
 
 | 1647 | //Drop signal for Levels table | 
 
 
 
 
 | 1648 | connect(ui->twSourcesLevels, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 | 1649 |  | 
 
 
 
 
 | 1650 | //Drop signal for Misc table | 
 
 
 
 
 | 1651 | connect(ui->twSourcesMisc, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addFilesSource(DropTableWidget*,QStringList))); | 
 
 
 
 
 | 1652 |  | 
 
 
 
 
 | 1653 | //Context menu for General table | 
 
 
 
 
 | 1654 | connect(ui->twSourcesXML, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 | 1655 |  | 
 
 
 
 
 | 1656 | //Context menu for Textures table | 
 
 
 
 
 | 1657 | connect(ui->twSourcesTextures, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 | 1658 |  | 
 
 
 
 
 | 1659 | //Context menu for Objects table | 
 
 
 
 
 | 1660 | connect(ui->twSourcesObjects, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 | 1661 |  | 
 
 
 
 
 | 1662 | //Context menu for Characters table | 
 
 
 
 
 | 1663 | connect(ui->twSourcesCharacters, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 | 1664 |  | 
 
 
 
 
 | 1665 | //Context menu for Levels table | 
 
 
 
 
 | 1666 | connect(ui->twSourcesLevels, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 | 1667 |  | 
 
 
 
 
 | 1668 | //Context menu for Misc table | 
 
 
 
 
 | 1669 | connect(ui->twSourcesMisc, SIGNAL(dtContextMenu(DropTableWidget*,QContextMenuEvent*)), this, SLOT(dtContextMenu(DropTableWidget*,QContextMenuEvent*))); | 
 
 
 
 
 | 1670 | } | 
 
 
 
 
 | 1671 |  | 
 
 
 
 
 | 1672 | void MainWindow::saveProjectState(const QString &filePath) | 
 
 
 
 
 | 1673 | { | 
 
 
 
 
 | 1674 |  | 
 
 
 
 
 | 1675 | QList<DropTableWidget*> tableWidgets = getAllTableWidgets(); | 
 
 
 
 
 | 1676 |  | 
 
 
 
 
 | 1677 | pugi::xml_document doc; | 
 
 
 
 
 | 1678 |  | 
 
 
 
 
 | 1679 | pugi::xml_node rootNode = doc.append_child("VagoProject"); | 
 
 
 
 
 | 1680 | rootNode.append_attribute("vagoVersion").set_value(GlobalVars::AppVersion.toUtf8().constData()); | 
 
 
 
 
 | 1681 |  | 
 
 
 
 
 | 1682 | foreach(DropTableWidget* const &myTable, tableWidgets){ | 
 
 
 
 
 | 1683 | saveProjectWidget(rootNode, myTable); | 
 
 
 
 
 | 1684 | } | 
 
 
 
 
 | 1685 |  | 
 
 
 
 
 | 1686 | if(!doc.save_file(filePath.toUtf8().constData(), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ | 
 
 
 
 
 | 1687 | UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while trying to save the project file. Please try another path."); | 
 
 
 
 
 | 1688 | return; | 
 
 
 
 
 | 1689 | } | 
 
 
 
 
 | 1690 |  | 
 
 
 
 
 | 1691 | this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path()); | 
 
 
 
 
 | 1692 |  | 
 
 
 
 
 | 1693 | this->lastProjectFilePath = filePath; | 
 
 
 
 
 | 1694 |  | 
 
 
 
 
 | 1695 | addNewRecentProject(filePath); | 
 
 
 
 
 | 1696 |  | 
 
 
 
 
 | 1697 | setVagoWindowTitle(); | 
 
 
 
 
 | 1698 | } | 
 
 
 
 
 | 1699 |  | 
 
 
 
 
 | 1700 | void MainWindow::saveProjectWidget(pugi::xml_node &rootNode, DropTableWidget* table) | 
 
 
 
 
 | 1701 | { | 
 
 
 
 
 | 1702 | QString from; | 
 
 
 
 
 | 1703 | QString to; | 
 
 
 
 
 | 1704 | QString tabName = getTabNameByTableWidget(table); | 
 
 
 
 
 | 1705 |  | 
 
 
 
 
 | 1706 | pugi::xml_node currentNodeTable = rootNode.append_child("tempName"); | 
 
 
 
 
 | 1707 | pugi::xml_node options; | 
 
 
 
 
 | 1708 |  | 
 
 
 
 
 | 1709 | if(table==ui->twSourcesXML){ //So we only need to parse one command. | 
 
 
 
 
 | 1710 | from = ui->cbFromXML->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1711 | to = ui->cbToXML->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1712 | } | 
 
 
 
 
 | 1713 | else if(table==ui->twSourcesTextures){ | 
 
 
 
 
 | 1714 | from = ui->cbFromTextures->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1715 | to = ui->cbToTextures->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1716 | options = currentNodeTable.append_child("Options"); | 
 
 
 
 
 | 1717 | options.append_attribute("type").set_value(Util::qStrToCstr(getTextureRBCheckedTypeTexture()->text())); | 
 
 
 
 
 | 1718 | options.append_attribute("genMipMaps").set_value(Util::boolToCstr(ui->cbMipMapsTextures->isChecked())); | 
 
 
 
 
 | 1719 | options.append_attribute("noUwrap").set_value(Util::boolToCstr(ui->cbNoUwrap->isChecked())); | 
 
 
 
 
 | 1720 | options.append_attribute("noVwrap").set_value(Util::boolToCstr(ui->cbNoVwrap->isChecked())); | 
 
 
 
 
 | 1721 | options.append_attribute("large").set_value(Util::boolToCstr(ui->cbLarge->isChecked())); | 
 
 
 
 
 | 1722 | options.append_attribute("envMap").set_value(Util::boolToCstr(ui->cbEnvMap->isChecked())); | 
 
 
 
 
 | 1723 | options.append_attribute("envMapValue").set_value(Util::qStrToCstr(ui->leEnvMapTexture->text())); | 
 
 
 
 
 | 1724 | } | 
 
 
 
 
 | 1725 | else if(table==ui->twSourcesCharacters){ | 
 
 
 
 
 | 1726 | from = ui->cbFromCharacters->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1727 | to = ui->cbToCharacters->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1728 | options = currentNodeTable.append_child("Options"); | 
 
 
 
 
 | 1729 | options.append_attribute("cellShading").set_value(Util::boolToCstr(ui->cbCellShading->isChecked())); | 
 
 
 
 
 | 1730 | options.append_attribute("normals").set_value(Util::boolToCstr(ui->cbNormals->isChecked())); | 
 
 
 
 
 | 1731 | options.append_attribute("extractTRBSONCC").set_value(Util::boolToCstr(ui->cbWithTRBS_ONCC->isChecked())); | 
 
 
 
 
 | 1732 | options.append_attribute("extractTRBSONCCValue").set_value(Util::qStrToCstr(ui->leTRBS_ONCC->text())); | 
 
 
 
 
 | 1733 | } | 
 
 
 
 
 | 1734 | else if(table==ui->twSourcesObjects){ | 
 
 
 
 
 | 1735 | from = ui->cbFromObjects->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1736 | to = ui->cbToObjects->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1737 | options = currentNodeTable.append_child("Options"); | 
 
 
 
 
 | 1738 | options.append_attribute("texture").set_value(Util::boolToCstr(ui->cbTexture->isChecked())); | 
 
 
 
 
 | 1739 | options.append_attribute("textureValue").set_value(Util::qStrToCstr(ui->leTextureName->text())); | 
 
 
 
 
 | 1740 | options.append_attribute("withAnimation").set_value(Util::boolToCstr(ui->cbWithAnimation->isChecked())); | 
 
 
 
 
 | 1741 | options.append_attribute("withAnimationValue").set_value(Util::qStrToCstr(ui->leAnimationName->text())); | 
 
 
 
 
 | 1742 | } | 
 
 
 
 
 | 1743 | else if(table==ui->twSourcesLevels){ | 
 
 
 
 
 | 1744 | from = ui->cbFromLevels->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1745 | to = ui->cbToLevels->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1746 | options = currentNodeTable.append_child("Options"); | 
 
 
 
 
 | 1747 | options.append_attribute("extractWithFiles").set_value(Util::boolToCstr(ui->cbSpecificFilesLevels->isChecked())); | 
 
 
 
 
 | 1748 | options.append_attribute("extractWithFilesValue").set_value(Util::qStrToCstr(ui->leSpecificFilesLevels->text())); | 
 
 
 
 
 | 1749 | options.append_attribute("datFilename").set_value(Util::boolToCstr(ui->cbDatLevels->isChecked())); | 
 
 
 
 
 | 1750 | options.append_attribute("datFilenameValue").set_value(Util::qStrToCstr(ui->leTargetDatLevels->text())); | 
 
 
 
 
 | 1751 | options.append_attribute("bnvSource").set_value(Util::boolToCstr(ui->cbBnvLevels->isChecked())); | 
 
 
 
 
 | 1752 | options.append_attribute("bnvSourceValue").set_value(Util::qStrToCstr(ui->leBnvLevels->text())); | 
 
 
 
 
 | 1753 | options.append_attribute("generateGrids").set_value(Util::boolToCstr(ui->cbGridsLevels->isChecked())); | 
 
 
 
 
 | 1754 | options.append_attribute("additionalSources").set_value(Util::boolToCstr(ui->cbAdditionalSourcesLevels->isChecked())); | 
 
 
 
 
 | 1755 | options.append_attribute("additionalSourcesValue").set_value(Util::qStrToCstr(ui->leAdditSourcesLevels->text())); | 
 
 
 
 
 | 1756 | } | 
 
 
 
 
 | 1757 | else{ | 
 
 
 
 
 | 1758 | from = ui->cbFromMisc->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1759 | to = ui->cbToMisc->currentText().toUtf8().constData(); | 
 
 
 
 
 | 1760 | } | 
 
 
 
 
 | 1761 |  | 
 
 
 
 
 | 1762 | currentNodeTable.set_name(tabName.toUtf8().constData()); | 
 
 
 
 
 | 1763 |  | 
 
 
 
 
 | 1764 | currentNodeTable.append_attribute("from").set_value(from.toUtf8().constData()); | 
 
 
 
 
 | 1765 | currentNodeTable.append_attribute("to").set_value(to.toUtf8().constData()); | 
 
 
 
 
 | 1766 |  | 
 
 
 
 
 | 1767 |  | 
 
 
 
 
 | 1768 | for(int i=0; i<table->rowCount(); i++){ | 
 
 
 
 
 | 1769 |  | 
 
 
 
 
 | 1770 | QString currFileFolder = table->item(i,0)->text(); | 
 
 
 
 
 | 1771 | QString currFromTo = table->item(i,1)->text(); | 
 
 
 
 
 | 1772 | QString currCommand = table->item(i,2)->text(); | 
 
 
 
 
 | 1773 |  | 
 
 
 
 
 | 1774 | pugi::xml_node currentRow = currentNodeTable.append_child("Row"); | 
 
 
 
 
 | 1775 |  | 
 
 
 
 
 | 1776 |  | 
 
 
 
 
 | 1777 | currentRow.append_attribute("fileFolder").set_value(Util::qStrToCstr(currFileFolder)); | 
 
 
 
 
 | 1778 | currentRow.append_attribute("fromTo").set_value(Util::qStrToCstr(currFromTo)); | 
 
 
 
 
 | 1779 | currentRow.append_attribute("command").set_value(Util::qStrToCstr(currCommand)); | 
 
 
 
 
 | 1780 |  | 
 
 
 
 
 | 1781 | if(table->item(i,2)->background()==table->disabledBackStyle){ | 
 
 
 
 
 | 1782 | currentRow.append_attribute("disabled").set_value(true); | 
 
 
 
 
 | 1783 | } | 
 
 
 
 
 | 1784 |  | 
 
 
 
 
 | 1785 | } | 
 
 
 
 
 | 1786 | } | 
 
 
 
 
 | 1787 |  | 
 
 
 
 
 | 1788 | QRadioButton* MainWindow::getTextureRBCheckedTypeTexture() | 
 
 
 
 
 | 1789 | { | 
 
 
 
 
 | 1790 | if(ui->rbBGR32->isChecked()){ | 
 
 
 
 
 | 1791 | return ui->rbBGR32; | 
 
 
 
 
 | 1792 | } | 
 
 
 
 
 | 1793 | else if(ui->rbBGRA32->isChecked()){ | 
 
 
 
 
 | 1794 | return ui->rbBGRA32; | 
 
 
 
 
 | 1795 | } | 
 
 
 
 
 | 1796 | else if(ui->rbBGR555->isChecked()){ | 
 
 
 
 
 | 1797 | return ui->rbBGR555; | 
 
 
 
 
 | 1798 | } | 
 
 
 
 
 | 1799 | else if(ui->rbBGRA5551->isChecked()){ | 
 
 
 
 
 | 1800 | return ui->rbBGRA5551; | 
 
 
 
 
 | 1801 | } | 
 
 
 
 
 | 1802 | else if(ui->rbBGRA444->isChecked()){ | 
 
 
 
 
 | 1803 | return ui->rbBGRA444; | 
 
 
 
 
 | 1804 | } | 
 
 
 
 
 | 1805 | else{ //dxt1 checked | 
 
 
 
 
 | 1806 | return ui->rbDxt1; | 
 
 
 
 
 | 1807 | } | 
 
 
 
 
 | 1808 | } | 
 
 
 
 
 | 1809 |  | 
 
 
 
 
 | 1810 | QRadioButton* MainWindow::getTextureRBTypeTextureByName(const QString &texType) | 
 
 
 
 
 | 1811 | { | 
 
 
 
 
 | 1812 | if(QString::compare(texType,ui->rbBGR32->text(),Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1813 | return ui->rbBGR32; | 
 
 
 
 
 | 1814 | } | 
 
 
 
 
 | 1815 | else if(QString::compare(texType,ui->rbBGRA32->text(),Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1816 | return ui->rbBGRA32; | 
 
 
 
 
 | 1817 | } | 
 
 
 
 
 | 1818 | else if(QString::compare(texType, ui->rbBGR555->text(),Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1819 | return ui->rbBGR555; | 
 
 
 
 
 | 1820 | } | 
 
 
 
 
 | 1821 | else if(QString::compare(texType,ui->rbBGRA5551->text(),Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1822 | return ui->rbBGRA5551; | 
 
 
 
 
 | 1823 | } | 
 
 
 
 
 | 1824 | else if(QString::compare(texType,ui->rbBGRA444->text(),Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1825 | return ui->rbBGRA444; | 
 
 
 
 
 | 1826 | } | 
 
 
 
 
 | 1827 | else{ //dxt1 | 
 
 
 
 
 | 1828 | return ui->rbDxt1; | 
 
 
 
 
 | 1829 | } | 
 
 
 
 
 | 1830 |  | 
 
 
 
 
 | 1831 | } | 
 
 
 
 
 | 1832 |  | 
 
 
 
 
 | 1833 | void MainWindow::setVagoWindowTitle(){ | 
 
 
 
 
 | 1834 |  | 
 
 
 
 
 | 1835 | QString vagoTitle = "Vago v"+GlobalVars::AppVersion + " - "; | 
 
 
 
 
 | 1836 |  | 
 
 
 
 
 | 1837 | if(this->lastProjectFilePath.isEmpty()){ | 
 
 
 
 
 | 1838 | vagoTitle += "Untitled"; | 
 
 
 
 
 | 1839 | } | 
 
 
 
 
 | 1840 | else{ | 
 
 
 
 
 | 1841 | vagoTitle += Util::cutNameWithoutBackSlash(this->lastProjectFilePath); | 
 
 
 
 
 | 1842 | } | 
 
 
 
 
 | 1843 |  | 
 
 
 
 
 | 1844 | setWindowTitle(vagoTitle); | 
 
 
 
 
 | 1845 | } | 
 
 
 
 
 | 1846 |  | 
 
 
 
 
 | 1847 | DropTableWidget* MainWindow::getCurrentTableWidget(){ | 
 
 
 
 
 | 1848 |  | 
 
 
 
 
 | 1849 | return getTableWidgetByTabName(ui->tabWidget->tabText(ui->tabWidget->currentIndex())); | 
 
 
 
 
 | 1850 |  | 
 
 
 
 
 | 1851 | } | 
 
 
 
 
 | 1852 |  | 
 
 
 
 
 | 1853 | DropTableWidget* MainWindow::getTableWidgetByTabName(const QString &tabName){ | 
 
 
 
 
 | 1854 |  | 
 
 
 
 
 | 1855 | if(tabName.compare("XML",Qt::CaseSensitive)==0){ //case sentive is faster | 
 
 
 
 
 | 1856 | return ui->twSourcesXML; | 
 
 
 
 
 | 1857 | } | 
 
 
 
 
 | 1858 | else if(tabName.compare("Textures",Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1859 | return ui->twSourcesTextures; | 
 
 
 
 
 | 1860 | } | 
 
 
 
 
 | 1861 | else if(tabName.compare("Characters",Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1862 | return ui->twSourcesCharacters; | 
 
 
 
 
 | 1863 | } | 
 
 
 
 
 | 1864 | else if(tabName.compare("Objects",Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1865 | return ui->twSourcesObjects; | 
 
 
 
 
 | 1866 | } | 
 
 
 
 
 | 1867 | else if(tabName.compare("Levels",Qt::CaseSensitive)==0){ | 
 
 
 
 
 | 1868 | return ui->twSourcesLevels; | 
 
 
 
 
 | 1869 | } | 
 
 
 
 
 | 1870 | else{ | 
 
 
 
 
 | 1871 | return ui->twSourcesMisc; | 
 
 
 
 
 | 1872 | } | 
 
 
 
 
 | 1873 |  | 
 
 
 
 
 | 1874 | } | 
 
 
 
 
 | 1875 |  | 
 
 
 
 
 | 1876 | QString MainWindow::getCurrentTabName(){ | 
 
 
 
 
 | 1877 | return ui->tabWidget->tabText(ui->tabWidget->currentIndex()); | 
 
 
 
 
 | 1878 | } | 
 
 
 
 
 | 1879 |  | 
 
 
 
 
 | 1880 | QString MainWindow::getTabNameByTableWidget(DropTableWidget* table){ | 
 
 
 
 
 | 1881 |  | 
 
 
 
 
 | 1882 | if(table == ui->twSourcesXML){ | 
 
 
 
 
 | 1883 | return ui->tabWidget->tabText(XMLTabIndex); | 
 
 
 
 
 | 1884 | } | 
 
 
 
 
 | 1885 | else if(table == ui->twSourcesTextures){ | 
 
 
 
 
 | 1886 | return ui->tabWidget->tabText(TexturesTabIndex); | 
 
 
 
 
 | 1887 | } | 
 
 
 
 
 | 1888 | else if(table == ui->twSourcesCharacters){ | 
 
 
 
 
 | 1889 | return ui->tabWidget->tabText(CharactersTabIndex); | 
 
 
 
 
 | 1890 | } | 
 
 
 
 
 | 1891 | else if(table == ui->twSourcesObjects){ | 
 
 
 
 
 | 1892 | return ui->tabWidget->tabText(ObjectsTabIndex); | 
 
 
 
 
 | 1893 | } | 
 
 
 
 
 | 1894 | else if(table == ui->twSourcesLevels){ | 
 
 
 
 
 | 1895 | return ui->tabWidget->tabText(LevelsTabIndex); | 
 
 
 
 
 | 1896 | } | 
 
 
 
 
 | 1897 | else{ | 
 
 
 
 
 | 1898 | return ui->tabWidget->tabText(MiscTabIndex); | 
 
 
 
 
 | 1899 | } | 
 
 
 
 
 | 1900 |  | 
 
 
 
 
 | 1901 | } | 
 
 
 
 
 | 1902 |  | 
 
 
 
 
 | 1903 | QList<DropTableWidget*> MainWindow::getAllTableWidgets() | 
 
 
 
 
 | 1904 | { | 
 
 
 
 
 | 1905 | QList<DropTableWidget*> tableWidgets; | 
 
 
 
 
 | 1906 |  | 
 
 
 
 
 | 1907 | tableWidgets << ui->twSourcesXML << ui->twSourcesTextures << ui->twSourcesCharacters | 
 
 
 
 
 | 1908 | << ui->twSourcesObjects << ui->twSourcesLevels << ui->twSourcesMisc; | 
 
 
 
 
 | 1909 |  | 
 
 
 
 
 | 1910 | return tableWidgets; | 
 
 
 
 
 | 1911 | } | 
 
 
 
 
 | 1912 |  | 
 
 
 
 
 | 1913 | void MainWindow::loadProjectState(const QString &filePath) | 
 
 
 
 
 | 1914 | { | 
 
 
 
 
 | 1915 |  | 
 
 
 
 
 | 1916 | QString statusError = "Couldn't load project."; | 
 
 
 
 
 | 1917 |  | 
 
 
 
 
 | 1918 | pugi::xml_document doc; | 
 
 
 
 
 | 1919 |  | 
 
 
 
 
 | 1920 | pugi::xml_parse_result result = doc.load_file(Util::qStrToCstr(filePath)); | 
 
 
 
 
 | 1921 |  | 
 
 
 
 
 | 1922 | if(result.status!=pugi::status_ok){ | 
 
 
 
 
 | 1923 | UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while loading project file.\n" + QString(result.description())); | 
 
 
 
 
 | 1924 | showErrStatusMessage(statusError); | 
 
 
 
 
 | 1925 | return; | 
 
 
 
 
 | 1926 | } | 
 
 
 
 
 | 1927 |  | 
 
 
 
 
 | 1928 |  | 
 
 
 
 
 | 1929 | if(QString(doc.root().first_child().name()) != "VagoProject"){ | 
 
 
 
 
 | 1930 | UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, QString(doc.root().name()) + "The file opened is not a valid VagoProject file. Load aborted."); | 
 
 
 
 
 | 1931 | showErrStatusMessage(statusError); | 
 
 
 
 
 | 1932 | return; | 
 
 
 
 
 | 1933 | } | 
 
 
 
 
 | 1934 |  | 
 
 
 
 
 | 1935 | QString projVagoVersion; | 
 
 
 
 
 | 1936 |  | 
 
 
 
 
 | 1937 | try{ | 
 
 
 
 
 | 1938 | projVagoVersion = QString(doc.select_node("/VagoProject/@vagoVersion").attribute().value()); | 
 
 
 
 
 | 1939 | } | 
 
 
 
 
 | 1940 | catch (const pugi::xpath_exception& e) | 
 
 
 
 
 | 1941 | { | 
 
 
 
 
 | 1942 | UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't find the vagoVersion of the current project. Load aborted.\n" + QString(e.what())); | 
 
 
 
 
 | 1943 | showErrStatusMessage(statusError); | 
 
 
 
 
 | 1944 | return; | 
 
 
 
 
 | 1945 | } | 
 
 
 
 
 | 1946 |  | 
 
 
 
 
 | 1947 | if(!projVagoVersion.startsWith(GlobalVars::LastCompatibleVersion)){ | 
 
 
 
 
 | 1948 | UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "The project that you are trying to load seems it is not compatible with your Vago Version. Please update Vago and try again."); | 
 
 
 
 
 | 1949 | showErrStatusMessage(statusError); | 
 
 
 
 
 | 1950 | return; | 
 
 
 
 
 | 1951 | } | 
 
 
 
 
 | 1952 |  | 
 
 
 
 
 | 1953 | // After the initial validations begin loading the project data | 
 
 
 
 
 | 1954 |  | 
 
 
 
 
 | 1955 | QList<DropTableWidget*> tableWidgets = getAllTableWidgets(); | 
 
 
 
 
 | 1956 |  | 
 
 
 
 
 | 1957 | try{ | 
 
 
 
 
 | 1958 | foreach(DropTableWidget* const &myTable, tableWidgets){ | 
 
 
 
 
 | 1959 | loadProjectWidget(doc, myTable); | 
 
 
 
 
 | 1960 | } | 
 
 
 
 
 | 1961 | } | 
 
 
 
 
 | 1962 | catch(const std::exception& e){ | 
 
 
 
 
 | 1963 | UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't load the vago project. Error: " + QString(e.what())); | 
 
 
 
 
 | 1964 | showErrStatusMessage(statusError); | 
 
 
 
 
 | 1965 | return; | 
 
 
 
 
 | 1966 | } | 
 
 
 
 
 | 1967 |  | 
 
 
 
 
 | 1968 | this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path()); | 
 
 
 
 
 | 1969 |  | 
 
 
 
 
 | 1970 | this->lastProjectFilePath = filePath; | 
 
 
 
 
 | 1971 |  | 
 
 
 
 
 | 1972 | addNewRecentProject(filePath); | 
 
 
 
 
 | 1973 |  | 
 
 
 
 
 | 1974 | setVagoWindowTitle(); | 
 
 
 
 
 | 1975 |  | 
 
 
 
 
 | 1976 | showSuccessStatusMessage("Project loaded sucessfully."); | 
 
 
 
 
 | 1977 | } | 
 
 
 
 
 | 1978 |  | 
 
 
 
 
 | 1979 |  | 
 
 
 
 
 | 1980 | void MainWindow::loadProjectWidget(pugi::xml_document &doc, DropTableWidget* table) | 
 
 
 
 
 | 1981 | { | 
 
 
 
 
 | 1982 | QString tabName = getTabNameByTableWidget(table); | 
 
 
 
 
 | 1983 | QString from (doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/@from")).attribute().value()); | 
 
 
 
 
 | 1984 | QString to (doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/@to")).attribute().value()); | 
 
 
 
 
 | 1985 |  | 
 
 
 
 
 | 1986 | if(table==ui->twSourcesXML){ | 
 
 
 
 
 | 1987 | ui->cbFromXML->setCurrentText(from); | 
 
 
 
 
 | 1988 | on_cbFromXML_currentIndexChanged(from); | 
 
 
 
 
 | 1989 | ui->cbToXML->setCurrentText(to); | 
 
 
 
 
 | 1990 | } | 
 
 
 
 
 | 1991 | else if(table==ui->twSourcesTextures){ | 
 
 
 
 
 | 1992 | //ui->cbFromTextures->setCurrentText(from); | 
 
 
 
 
 | 1993 | on_cbFromTextures_currentIndexChanged(from); | 
 
 
 
 
 | 1994 | ui->cbToTextures->setCurrentText(to); | 
 
 
 
 
 | 1995 |  | 
 
 
 
 
 | 1996 | getTextureRBTypeTextureByName((doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@type")).attribute().value()))->setChecked(true); | 
 
 
 
 
 | 1997 | ui->cbMipMapsTextures->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@genMipMaps")).attribute().as_bool()); | 
 
 
 
 
 | 1998 | ui->cbNoUwrap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@noUwrap")).attribute().as_bool()); | 
 
 
 
 
 | 1999 | ui->cbNoVwrap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@noVwrap")).attribute().as_bool()); | 
 
 
 
 
 | 2000 | ui->cbLarge->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@large")).attribute().as_bool()); | 
 
 
 
 
 | 2001 | ui->cbEnvMap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@envMap")).attribute().as_bool()); | 
 
 
 
 
 | 2002 | ui->leEnvMapTexture->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@envMapValue")).attribute().value())); | 
 
 
 
 
 | 2003 | } | 
 
 
 
 
 | 2004 | else if(table==ui->twSourcesCharacters){ | 
 
 
 
 
 | 2005 | ui->cbFromCharacters->setCurrentText(from); | 
 
 
 
 
 | 2006 | on_cbFromCharacters_currentIndexChanged(from); | 
 
 
 
 
 | 2007 | ui->cbToCharacters->setCurrentText(to); | 
 
 
 
 
 | 2008 |  | 
 
 
 
 
 | 2009 |  | 
 
 
 
 
 | 2010 | ui->cbCellShading->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@cellShading")).attribute().as_bool()); | 
 
 
 
 
 | 2011 | ui->cbNormals->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@normals")).attribute().as_bool()); | 
 
 
 
 
 | 2012 | ui->cbWithTRBS_ONCC->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractTRBSONCC")).attribute().as_bool()); | 
 
 
 
 
 | 2013 | ui->leTRBS_ONCC->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractTRBSONCCValue")).attribute().value())); | 
 
 
 
 
 | 2014 | } | 
 
 
 
 
 | 2015 | else if(table==ui->twSourcesObjects){ | 
 
 
 
 
 | 2016 | ui->cbFromObjects->setCurrentText(from); | 
 
 
 
 
 | 2017 | on_cbFromObjects_currentIndexChanged(from); | 
 
 
 
 
 | 2018 | ui->cbToObjects->setCurrentText(to); | 
 
 
 
 
 | 2019 |  | 
 
 
 
 
 | 2020 | ui->cbTexture->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@texture")).attribute().as_bool()); | 
 
 
 
 
 | 2021 | ui->leTextureName->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@textureValue")).attribute().value())); | 
 
 
 
 
 | 2022 | ui->cbWithAnimation->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@withAnimation")).attribute().as_bool()); | 
 
 
 
 
 | 2023 | ui->leAnimationName->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@withAnimationValue")).attribute().value())); | 
 
 
 
 
 | 2024 | } | 
 
 
 
 
 | 2025 | else if(table==ui->twSourcesLevels){ | 
 
 
 
 
 | 2026 | ui->cbFromLevels->setCurrentText(from); | 
 
 
 
 
 | 2027 | on_cbFromLevels_currentIndexChanged(from); | 
 
 
 
 
 | 2028 | ui->cbToLevels->setCurrentText(to); | 
 
 
 
 
 | 2029 |  | 
 
 
 
 
 | 2030 | ui->cbSpecificFilesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractWithFiles")).attribute().as_bool()); | 
 
 
 
 
 | 2031 | ui->leSpecificFilesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractWithFilesValue")).attribute().value())); | 
 
 
 
 
 | 2032 | ui->cbDatLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@datFilename")).attribute().as_bool()); | 
 
 
 
 
 | 2033 | ui->leTargetDatLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@datFilenameValue")).attribute().value())); | 
 
 
 
 
 | 2034 | ui->cbBnvLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSource")).attribute().as_bool()); | 
 
 
 
 
 | 2035 | ui->leBnvLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSourceValue")).attribute().value())); | 
 
 
 
 
 | 2036 | ui->cbGridsLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@generateGrids")).attribute().as_bool()); | 
 
 
 
 
 | 2037 | ui->cbAdditionalSourcesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSources")).attribute().as_bool()); | 
 
 
 
 
 | 2038 | ui->leAdditSourcesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSource")).attribute().value())); | 
 
 
 
 
 | 2039 | } | 
 
 
 
 
 | 2040 | else{ | 
 
 
 
 
 | 2041 | ui->cbFromMisc->setCurrentText(from); | 
 
 
 
 
 | 2042 | on_cbFromMisc_currentIndexChanged(from); | 
 
 
 
 
 | 2043 | ui->cbToMisc->setCurrentText(to); | 
 
 
 
 
 | 2044 | } | 
 
 
 
 
 | 2045 |  | 
 
 
 
 
 | 2046 | // Clean previous rows | 
 
 
 
 
 | 2047 | clearTableNoPrompt(table); | 
 
 
 
 
 | 2048 |  | 
 
 
 
 
 | 2049 | for(const pugi::xpath_node &xPathNode : doc.select_nodes(Util::qStrToCstr("/VagoProject/"+tabName+"/Row"))){ | 
 
 
 
 
 | 2050 | pugi::xml_node currNode = xPathNode.node(); | 
 
 
 
 
 | 2051 |  | 
 
 
 
 
 | 2052 | QString currFileFolder = currNode.attribute("fileFolder").value(); | 
 
 
 
 
 | 2053 | QString currFromTo = currNode.attribute("fromTo").value(); | 
 
 
 
 
 | 2054 | QString currCommand = currNode.attribute("command").value(); | 
 
 
 
 
 | 2055 |  | 
 
 
 
 
 | 2056 | bool isToDisable = false; | 
 
 
 
 
 | 2057 | pugi::xml_attribute disabledAttr = currNode.attribute("disabled"); | 
 
 
 
 
 | 2058 | isToDisable = disabledAttr.empty() ? false : disabledAttr.as_bool(); | 
 
 
 
 
 | 2059 |  | 
 
 
 
 
 | 2060 | addRowTable(table,currFileFolder,currFromTo,currCommand, isToDisable); | 
 
 
 
 
 | 2061 | } | 
 
 
 
 
 | 2062 | } | 
 
 
 
 
 | 2063 |  | 
 
 
 
 
 | 2064 | void MainWindow::saveRecentProjects(){ | 
 
 
 
 
 | 2065 | for(int i=0; i<this->recentProjectsList.size(); i++){ | 
 
 
 
 
 | 2066 | this->vagoSettings->setValue("RecentProject" + QString::number(i+1), recentProjectsList[i]); | 
 
 
 
 
 | 2067 | } | 
 
 
 
 
 | 2068 | } | 
 
 
 
 
 | 2069 |  | 
 
 
 
 
 | 2070 | void MainWindow::loadRecentProjects(){ | 
 
 
 
 
 | 2071 | for(int i=0; i<this->recentProjectsMaxSize; i++){ | 
 
 
 
 
 | 2072 |  | 
 
 
 
 
 | 2073 | QString currProj = this->vagoSettings->value("RecentProject" + QString::number(i+1)).toString(); | 
 
 
 
 
 | 2074 |  | 
 
 
 
 
 | 2075 | if(!currProj.isEmpty()){ | 
 
 
 
 
 | 2076 | recentProjectsList.append(currProj); | 
 
 
 
 
 | 2077 | } | 
 
 
 
 
 | 2078 | else{ | 
 
 
 
 
 | 2079 | break; | 
 
 
 
 
 | 2080 | } | 
 
 
 
 
 | 2081 | } | 
 
 
 
 
 | 2082 |  | 
 
 
 
 
 | 2083 | reloadRecentProjectsMenu(); | 
 
 
 
 
 | 2084 |  | 
 
 
 
 
 | 2085 | } | 
 
 
 
 
 | 2086 |  | 
 
 
 
 
 | 2087 | void MainWindow::addNewRecentProject(const QString &filePath){ | 
 
 
 
 
 | 2088 |  | 
 
 
 
 
 | 2089 | // If the new project is equal to the last one simply ignore | 
 
 
 
 
 | 2090 | if(filePath == this->vagoSettings->value("RecentProject1").toString()){ | 
 
 
 
 
 | 2091 | return; | 
 
 
 
 
 | 2092 | } | 
 
 
 
 
 | 2093 |  | 
 
 
 
 
 | 2094 | // If the item already exists in our list remove it, so it can go to the top again | 
 
 
 
 
 | 2095 | for(auto it = this->recentProjectsList.begin(); it != this->recentProjectsList.end();){ | 
 
 
 
 
 | 2096 | if(*it == filePath){ | 
 
 
 
 
 | 2097 | it = this->recentProjectsList.erase(it); | 
 
 
 
 
 | 2098 | } | 
 
 
 
 
 | 2099 | else{ | 
 
 
 
 
 | 2100 | it++; | 
 
 
 
 
 | 2101 | } | 
 
 
 
 
 | 2102 | } | 
 
 
 
 
 | 2103 |  | 
 
 
 
 
 | 2104 | // if we gonna overflow our list, remove the older item to reserve space to the new one | 
 
 
 
 
 | 2105 | if(this->recentProjectsList.size()==this->recentProjectsMaxSize){ | 
 
 
 
 
 | 2106 | this->recentProjectsList.removeLast(); | 
 
 
 
 
 | 2107 | } | 
 
 
 
 
 | 2108 |  | 
 
 
 
 
 | 2109 | this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path()); | 
 
 
 
 
 | 2110 |  | 
 
 
 
 
 | 2111 | // add new recent file | 
 
 
 
 
 | 2112 | this->recentProjectsList.prepend(filePath); | 
 
 
 
 
 | 2113 |  | 
 
 
 
 
 | 2114 | reloadRecentProjectsMenu(); | 
 
 
 
 
 | 2115 |  | 
 
 
 
 
 | 2116 | saveRecentProjects(); | 
 
 
 
 
 | 2117 | } | 
 
 
 
 
 | 2118 |  | 
 
 
 
 
 | 2119 | void MainWindow::reloadRecentProjectsMenu(){ | 
 
 
 
 
 | 2120 |  | 
 
 
 
 
 | 2121 | ui->menuRecent_Projects->setEnabled(false); | 
 
 
 
 
 | 2122 | ui->actionProject1->setVisible(false); | 
 
 
 
 
 | 2123 | ui->actionProject2->setVisible(false); | 
 
 
 
 
 | 2124 | ui->actionProject3->setVisible(false); | 
 
 
 
 
 | 2125 | ui->actionProject4->setVisible(false); | 
 
 
 
 
 | 2126 | ui->actionProject5->setVisible(false); | 
 
 
 
 
 | 2127 |  | 
 
 
 
 
 | 2128 | { | 
 
 
 
 
 | 2129 | QList<QString>::const_iterator it; | 
 
 
 
 
 | 2130 | int i; | 
 
 
 
 
 | 2131 | for(it = recentProjectsList.cbegin(), i=0; it != recentProjectsList.cend(); it++, i++){ | 
 
 
 
 
 | 2132 |  | 
 
 
 
 
 | 2133 | QAction* currAction = nullptr; | 
 
 
 
 
 | 2134 |  | 
 
 
 
 
 | 2135 | switch (i){ | 
 
 
 
 
 | 2136 | case 0: | 
 
 
 
 
 | 2137 | currAction = ui->actionProject1; | 
 
 
 
 
 | 2138 | break; | 
 
 
 
 
 | 2139 | case 1: | 
 
 
 
 
 | 2140 | currAction = ui->actionProject2; | 
 
 
 
 
 | 2141 | break; | 
 
 
 
 
 | 2142 | case 2: | 
 
 
 
 
 | 2143 | currAction = ui->actionProject3; | 
 
 
 
 
 | 2144 | break; | 
 
 
 
 
 | 2145 | case 3: | 
 
 
 
 
 | 2146 | currAction = ui->actionProject4; | 
 
 
 
 
 | 2147 | break; | 
 
 
 
 
 | 2148 | case 4: | 
 
 
 
 
 | 2149 | currAction = ui->actionProject5; | 
 
 
 
 
 | 2150 | break; | 
 
 
 
 
 | 2151 | } | 
 
 
 
 
 | 2152 |  | 
 
 
 
 
 | 2153 | if(currAction){ | 
 
 
 
 
 | 2154 | ui->menuRecent_Projects->setEnabled(true); | 
 
 
 
 
 | 2155 | currAction->setText(*it); | 
 
 
 
 
 | 2156 | currAction->setVisible(true); | 
 
 
 
 
 | 2157 | } | 
 
 
 
 
 | 2158 | } | 
 
 
 
 
 | 2159 | } | 
 
 
 
 
 | 2160 |  | 
 
 
 
 
 | 2161 | } |