| 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 |
| 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); |
| 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(); |
| 291 |
|
QDesktopServices::openUrl(QUrl("file:///"+this->outputFolder)); |
| 292 |
|
} |
| 293 |
|
|
| 294 |
+ |
|
| 295 |
+ |
void MainWindow::on_tbXmlToolsInterface_clicked() |
| 296 |
+ |
{ |
| 297 |
+ |
//We pass no parent because we want to have an independent window for XmlToolsInterface, |
| 298 |
+ |
//so we can minimize it or maximize indepently from the MainWindow |
| 299 |
+ |
XmlToolsInterface *xmlToolsWindow = new XmlToolsInterface(this->myLogger); |
| 300 |
+ |
xmlToolsWindow->show(); //it destroys itself when finished. |
| 301 |
+ |
} |
| 302 |
+ |
|
| 303 |
|
void MainWindow::on_tbAbortConversion_clicked() |
| 304 |
|
{ |
| 305 |
|
if(Util::showQuestionPopUp(this,"Are you sure you want to abort the current conversion?")){ |
| 749 |
|
for(int i=0; i<currTable->rowCount(); i++){ |
| 750 |
|
//Only process enabled items |
| 751 |
|
if(currTable->item(i,2)->background()!=currTable->disabledBackStyle){ |
| 752 |
< |
this->listToProccess->append(currTable->item(i,2)->text()); |
| 752 |
> |
this->listToProccess.append(currTable->item(i,2)->text()); |
| 753 |
|
} |
| 754 |
|
} |
| 755 |
|
|
| 1194 |
|
QMessageBox::StandardButton result = askToSaveCurrentProject(); |
| 1195 |
|
if(result == QMessageBox::StandardButton::Cancel){ |
| 1196 |
|
event->ignore(); |
| 1197 |
+ |
return; |
| 1198 |
|
} |
| 1199 |
|
} |
| 1200 |
+ |
|
| 1201 |
+ |
// Exit application (this will also close all other windows which don't have parent, for instance ManualCommands) |
| 1202 |
+ |
QApplication::quit(); |
| 1203 |
|
} |
| 1204 |
|
|
| 1205 |
|
QMessageBox::StandardButton MainWindow::askToSaveCurrentProject(){ |
| 1236 |
|
ui->leBnvLevels->setEnabled(checked); |
| 1237 |
|
ui->cbGridsLevels->setEnabled(checked); |
| 1238 |
|
ui->cbGridsLevels->setChecked(checked); |
| 1239 |
< |
if(checked){ |
| 1239 |
> |
if(checked && !projectIsLoading){ |
| 1240 |
|
QString file=QFileDialog::getOpenFileName(this,"Choose the BNV.dae file...","./" , "All Files (*.*)"); |
| 1241 |
|
if(!file.isEmpty()){ |
| 1242 |
|
ui->leBnvLevels->setText(file); |
| 1248 |
|
{ |
| 1249 |
|
ui->leAdditSourcesLevels->setEnabled(checked); |
| 1250 |
|
|
| 1251 |
< |
if(checked){ |
| 1251 |
> |
if(checked && !projectIsLoading){ |
| 1252 |
|
QStringList filesSelected=QFileDialog::getOpenFileNames(this,"Choose the additional .dae files...","./" , "All Files (*.*)"); |
| 1253 |
|
QString filesJoined; |
| 1254 |
|
int size=filesSelected.size(); |
| 1317 |
|
|
| 1318 |
|
void MainWindow::on_tbCommand_clicked() |
| 1319 |
|
{ |
| 1320 |
< |
//Show preferences |
| 1321 |
< |
ManualCommands *commandsWindow = new ManualCommands(this); |
| 1320 |
> |
//We pass no parent because we want to have an independent window for ManualCommands, |
| 1321 |
> |
//so we can minimize it or maximize indepently from the MainWindow |
| 1322 |
> |
ManualCommands *commandsWindow = new ManualCommands(); |
| 1323 |
|
commandsWindow->show(); //it destroys itself when finished. |
| 1324 |
|
} |
| 1325 |
|
|
| 2014 |
|
void MainWindow::loadProjectState(const QString &filePath) |
| 2015 |
|
{ |
| 2016 |
|
|
| 2017 |
+ |
this->projectIsLoading = true; |
| 2018 |
+ |
|
| 2019 |
|
if(this->vagoSettings->value("AskSaveProject").toBool() && this->unsavedChangesExist){ |
| 2020 |
|
QMessageBox::StandardButton result = askToSaveCurrentProject(); |
| 2021 |
|
if(result == QMessageBox::StandardButton::Cancel){ |
| 2022 |
+ |
this->projectIsLoading = false; |
| 2023 |
|
return; |
| 2024 |
|
} |
| 2025 |
|
} |
| 2033 |
|
if(result.status!=pugi::status_ok){ |
| 2034 |
|
UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while loading project file.\n" + QString(result.description())); |
| 2035 |
|
showErrStatusMessage(statusError); |
| 2036 |
+ |
this->projectIsLoading = false; |
| 2037 |
|
return; |
| 2038 |
|
} |
| 2039 |
|
|
| 2041 |
|
if(QString(doc.root().first_child().name()) != "VagoProject"){ |
| 2042 |
|
UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, QString(doc.root().name()) + "The file opened is not a valid VagoProject file. Load aborted."); |
| 2043 |
|
showErrStatusMessage(statusError); |
| 2044 |
+ |
this->projectIsLoading = false; |
| 2045 |
|
return; |
| 2046 |
|
} |
| 2047 |
|
|
| 2054 |
|
{ |
| 2055 |
|
UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't find the vagoVersion of the current project. Load aborted.\n" + QString(e.what())); |
| 2056 |
|
showErrStatusMessage(statusError); |
| 2057 |
+ |
this->projectIsLoading = false; |
| 2058 |
|
return; |
| 2059 |
|
} |
| 2060 |
|
|
| 2061 |
|
if(!projVagoVersion.startsWith(GlobalVars::LastCompatibleVersion)){ |
| 2062 |
|
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."); |
| 2063 |
|
showErrStatusMessage(statusError); |
| 2064 |
+ |
this->projectIsLoading = false; |
| 2065 |
|
return; |
| 2066 |
|
} |
| 2067 |
|
|
| 2077 |
|
catch(const std::exception& e){ |
| 2078 |
|
UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't load the vago project. Error: " + QString(e.what())); |
| 2079 |
|
showErrStatusMessage(statusError); |
| 2080 |
+ |
this->projectIsLoading = false; |
| 2081 |
|
return; |
| 2082 |
|
} |
| 2083 |
|
|
| 2090 |
|
|
| 2091 |
|
setVagoWindowTitle(); |
| 2092 |
|
|
| 2093 |
+ |
this->projectIsLoading = false; |
| 2094 |
+ |
|
| 2095 |
|
showSuccessStatusMessage("Project loaded sucessfully."); |
| 2096 |
|
} |
| 2097 |
|
|
| 2154 |
|
ui->leBnvLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSourceValue")).attribute().value())); |
| 2155 |
|
ui->cbGridsLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@generateGrids")).attribute().as_bool()); |
| 2156 |
|
ui->cbAdditionalSourcesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSources")).attribute().as_bool()); |
| 2157 |
< |
ui->leAdditSourcesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSource")).attribute().value())); |
| 2157 |
> |
ui->leAdditSourcesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSourcesValue")).attribute().value())); |
| 2158 |
|
} |
| 2159 |
|
else{ |
| 2160 |
|
ui->cbFromMisc->setCurrentText(from); |