ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/mainwindow.cpp
(Generate patch)

Comparing:
Vago/trunk/Vago/mainwindow.cpp (file contents), Revision 1054 by s10k, Wed Oct 12 21:35:13 2016 UTC vs.
s10k/Vago/mainwindow.cpp (file contents), Revision 1092 by s10k, Sat Dec 30 13:43:28 2017 UTC

# Line 128 | Line 128 | MainWindow::MainWindow(QWidget *parent)
128      ui->statusBar->addPermanentWidget(this->myBar); //this adds automatically in right
129      ui->statusBar->addPermanentWidget(ui->tbAbortConversion);
130  
131    //Initialize list pointers
132    this->listToProccess = new QStringList;
133
131      // User interface
132      ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button
133      ui->mainToolBar->addWidget(ui->emptySpacerLabel); //trick, we can't add directly a space so we add an empty
# Line 138 | Line 135 | MainWindow::MainWindow(QWidget *parent)
135      ui->mainToolBar->addWidget(ui->emptySpacerLabel2); //same as before
136      ui->mainToolBar->addWidget(ui->tbCommand); //add option to manual onisplit commands
137      ui->mainToolBar->addWidget(ui->emptySpacerLabel3); //same as before
138 +    ui->mainToolBar->addWidget(ui->tbXmlToolsInterface); //add option to manual onisplit commands
139 +    ui->mainToolBar->addWidget(ui->emptySpacerLabel4); //same as before
140      ui->mainToolBar->addWidget(ui->tbOpenFolder); //add option to open folder with files converted etc
141  
142      ui->mainToolBar->setLayoutDirection(Qt::RightToLeft);
# Line 207 | Line 206 | void MainWindow::applicationWasLoaded(){
206      this->win7TaskBarProgress = this->win7TaskBarButton->progress();
207  
208      //Create a thread for do the conversion in background
209 <    this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, this->listToProccess, this->win7TaskBarProgress);
209 >    this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, &this->listToProccess, this->win7TaskBarProgress);
210   #else
211 <    this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, this->listToProccess);
211 >    this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger, &this->listToProccess);
212   #endif
213  
214      connectSlots();
# Line 242 | Line 241 | void MainWindow::on_actionAbout_triggere
241  
242   void MainWindow::on_actionAE_Package_Creator_triggered()
243   {
244 <    PackageWizard myWizard = PackageWizard(this->workspaceWizardsLocation, this->vagoSettings, this->myLogger);
245 <    myWizard.exec();
244 >    // it deletes itself once closed
245 >    WizardFactory<PackageWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, this->myLogger);
246   }
247  
248   void MainWindow::on_actionSound_Wizard_triggered()
249   {
250 <    SoundWizard myWizard (UtilVago::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
251 <    myWizard.exec();
250 >    // it deletes itself once closed
251 >    WizardFactory<SoundWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, this->myLogger, &this->commandMap);
252   }
253  
254   void MainWindow::on_actionBackground_Image_Wizard_triggered()
255   {
256 <    BGImageWizard myWizard (UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, this->myLogger);
257 <    myWizard.exec();
256 >    // it deletes itself once closed
257 >    WizardFactory<BGImageWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, this->myLogger);
258 > }
259 >
260 > void MainWindow::on_actionWindow_Messages_Wizard_triggered()
261 > {
262 >    // it deletes itself once closed
263 >    WizardFactory<WmWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, this->myLogger);
264   }
265  
266   void MainWindow::on_tbOni_clicked()
# Line 292 | Line 297 | void MainWindow::on_tbOpenFolder_clicked
297      QDesktopServices::openUrl(QUrl("file:///"+this->outputFolder));
298   }
299  
300 +
301 + void MainWindow::on_tbXmlToolsInterface_clicked()
302 + {
303 +    //We pass no parent because we want to have an independent window for XmlToolsInterface,
304 +    //so we can minimize it or maximize indepently from the MainWindow
305 +    XmlToolsInterface *xmlToolsWindow = new XmlToolsInterface(this->myLogger);
306 +    xmlToolsWindow->show(); //it destroys itself when finished.
307 + }
308 +
309   void MainWindow::on_tbAbortConversion_clicked()
310   {
311      if(Util::showQuestionPopUp(this,"Are you sure you want to abort the current conversion?")){
# Line 548 | Line 562 | QString MainWindow::fileParsingObjects(Q
562  
563      QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder;
564  
551    //TODO: This can be optimized. When some are not enable others are.
565      if(ui->cbTexture->isChecked()){
566          if(ui->leTextureName->text().isEmpty()){
567              showErrStatusMessage("Checkbox '"+ui->cbTexture->text()+"' is selected. The file source cannot be empty.");
# Line 741 | Line 754 | void MainWindow::startConversion(){
754      for(int i=0; i<currTable->rowCount(); i++){
755          //Only process enabled items
756          if(currTable->item(i,2)->background()!=currTable->disabledBackStyle){
757 <            this->listToProccess->append(currTable->item(i,2)->text());
757 >            this->listToProccess.append(currTable->item(i,2)->text());
758          }
759      }
760  
# Line 970 | Line 983 | void MainWindow::updateComboBox(const QS
983          ui->cbCellShading->setChecked(false);
984          ui->cbNormals->setEnabled(false);
985          ui->cbNormals->setChecked(false);
986 <
986 > //#error add drag and drop to Extract TRAM with TRBS/ONCC
987          if(QString::compare(arg1,"TRAM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster
988              ui->cbWithTRBS_ONCC->setEnabled(true);
989          }
# Line 1186 | Line 1199 | void MainWindow::closeEvent(QCloseEvent
1199          QMessageBox::StandardButton result = askToSaveCurrentProject();
1200          if(result == QMessageBox::StandardButton::Cancel){
1201              event->ignore();
1202 +            return;
1203          }
1204      }
1205 +
1206 +    // Exit application (this will also close all other windows which don't have parent, for instance ManualCommands)
1207 +    QApplication::quit();
1208   }
1209  
1210   QMessageBox::StandardButton MainWindow::askToSaveCurrentProject(){
# Line 1224 | Line 1241 | void MainWindow::on_cbBnvLevels_toggled(
1241      ui->leBnvLevels->setEnabled(checked);
1242      ui->cbGridsLevels->setEnabled(checked);
1243      ui->cbGridsLevels->setChecked(checked);
1244 <    if(checked){
1244 >    if(checked && !projectIsLoading){
1245          QString file=QFileDialog::getOpenFileName(this,"Choose the BNV.dae file...","./" , "All Files (*.*)");
1246          if(!file.isEmpty()){
1247              ui->leBnvLevels->setText(file);
# Line 1236 | Line 1253 | void MainWindow::on_cbAdditionalSourcesL
1253   {
1254      ui->leAdditSourcesLevels->setEnabled(checked);
1255  
1256 <    if(checked){
1256 >    if(checked && !projectIsLoading){
1257          QStringList filesSelected=QFileDialog::getOpenFileNames(this,"Choose the additional .dae files...","./" , "All Files (*.*)");
1258          QString filesJoined;
1259          int size=filesSelected.size();
# Line 1305 | Line 1322 | void MainWindow::rowsWereChangedInDropTa
1322  
1323   void MainWindow::on_tbCommand_clicked()
1324   {
1325 <    //Show preferences
1326 <    ManualCommands *commandsWindow = new ManualCommands(this);
1325 >    //We pass no parent because we want to have an independent window for ManualCommands,
1326 >    //so we can minimize it or maximize indepently from the MainWindow
1327 >    ManualCommands *commandsWindow = new ManualCommands();
1328      commandsWindow->show(); //it destroys itself when finished.
1329   }
1330  
# Line 2001 | Line 2019 | QList<DropTableWidget*> MainWindow::getA
2019   void MainWindow::loadProjectState(const QString &filePath)
2020   {
2021  
2022 +    this->projectIsLoading = true;
2023 +
2024      if(this->vagoSettings->value("AskSaveProject").toBool() && this->unsavedChangesExist){
2025          QMessageBox::StandardButton result = askToSaveCurrentProject();
2026          if(result == QMessageBox::StandardButton::Cancel){
2027 +            this->projectIsLoading = false;
2028              return;
2029          }
2030      }
# Line 2017 | Line 2038 | void MainWindow::loadProjectState(const
2038      if(result.status!=pugi::status_ok){
2039          UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while loading project file.\n" + QString(result.description()));
2040          showErrStatusMessage(statusError);
2041 +        this->projectIsLoading = false;
2042          return;
2043      }
2044  
# Line 2024 | Line 2046 | void MainWindow::loadProjectState(const
2046      if(QString(doc.root().first_child().name()) != "VagoProject"){
2047          UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, QString(doc.root().name()) + "The file opened is not a valid VagoProject file. Load aborted.");
2048          showErrStatusMessage(statusError);
2049 +        this->projectIsLoading = false;
2050          return;
2051      }
2052  
# Line 2036 | Line 2059 | void MainWindow::loadProjectState(const
2059      {
2060          UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't find the vagoVersion of the current project. Load aborted.\n" + QString(e.what()));
2061          showErrStatusMessage(statusError);
2062 +        this->projectIsLoading = false;
2063          return;
2064      }
2065  
2066      if(!projVagoVersion.startsWith(GlobalVars::LastCompatibleVersion)){
2067          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.");
2068          showErrStatusMessage(statusError);
2069 +        this->projectIsLoading = false;
2070          return;
2071      }
2072  
# Line 2057 | Line 2082 | void MainWindow::loadProjectState(const
2082      catch(const std::exception& e){
2083          UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't load the vago project. Error: " + QString(e.what()));
2084          showErrStatusMessage(statusError);
2085 +        this->projectIsLoading = false;
2086          return;
2087      }
2088  
# Line 2069 | Line 2095 | void MainWindow::loadProjectState(const
2095  
2096      setVagoWindowTitle();
2097  
2098 +    this->projectIsLoading = false;
2099 +
2100      showSuccessStatusMessage("Project loaded sucessfully.");
2101   }
2102  
# Line 2131 | Line 2159 | void MainWindow::loadProjectWidget(pugi:
2159          ui->leBnvLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSourceValue")).attribute().value()));
2160          ui->cbGridsLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@generateGrids")).attribute().as_bool());
2161          ui->cbAdditionalSourcesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSources")).attribute().as_bool());
2162 <        ui->leAdditSourcesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSource")).attribute().value()));
2162 >        ui->leAdditSourcesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSourcesValue")).attribute().value()));
2163      }
2164      else{
2165          ui->cbFromMisc->setCurrentText(from);

Diff Legend

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