9 |
|
{ |
10 |
|
ui->setupUi(this); |
11 |
|
|
12 |
< |
this->myLogger = new Logger(Util::getAppPath()); //start logger |
12 |
> |
this->myLogger = new Logger(UtilVago::getAppPath(), GlobalVars::AppLogName); //start logger |
13 |
|
|
14 |
< |
this->myLogger->writeString("Detected AppDir: "+Util::getAppPath()); |
14 |
> |
this->myLogger->writeString("Detected AppDir: "+UtilVago::getAppPath()); |
15 |
|
this->myLogger->writeString("True app dir: "+QDir::currentPath()); |
16 |
|
|
17 |
< |
this->setWindowTitle("Vago v"+GlobalVars::AppVersion); |
17 |
> |
setVagoWindowTitle(); |
18 |
|
|
19 |
< |
if(!QFile::exists(Util::getAppPath()+"/"+GlobalVars::OniSplitString)){ |
20 |
< |
Util::showErrorPopUp("OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit."); |
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(Util::getAppPath()+"/"+GlobalVars::XmlToolsString)){ |
25 |
< |
Util::showErrorPopUp("xmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit."); |
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(Util::getAppPath() + "/" + this->VagoSettingsName, QSettings::IniFormat); |
29 |
> |
this->vagoSettings = new QSettings(UtilVago::getAppPath() + "/" + this->VagoSettingsName, QSettings::IniFormat); |
30 |
|
|
31 |
|
//First Execution? Old configuration? Settings missed? |
32 |
|
bool iniChanged=false; |
35 |
|
iniChanged=true; |
36 |
|
} |
37 |
|
if(!this->vagoSettings->contains("Workspace")){ |
38 |
< |
this->vagoSettings->setValue("Workspace", Util::getAppPath()+"/VagoWorkspace"); |
38 |
> |
this->vagoSettings->setValue("Workspace", UtilVago::getAppPath()+"/VagoWorkspace"); |
39 |
|
iniChanged=true; |
40 |
|
} |
41 |
|
if(!this->vagoSettings->contains("AeFolder")){ |
44 |
|
QString aefolder=Util::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder...")); |
45 |
|
|
46 |
|
if(aefolder.isEmpty()){ |
47 |
< |
Util::showErrorPopUp("AE folder is mandatory. Application will now exit."); |
47 |
> |
UtilVago::showAndLogErrorPopUp(this->myLogger, "AE folder is mandatory. Application will now exit."); |
48 |
|
exit(1); |
49 |
|
} |
50 |
|
|
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); |
127 |
|
//Initialize list pointers |
128 |
|
this->listToProccess = new QStringList; |
129 |
|
|
120 |
– |
//Create a thread for do the conversion in background |
121 |
– |
this->myConverter = new Converter(Util::getAppPath(),this->myLogger,this->listToProccess); |
122 |
– |
|
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 |
138 |
|
|
139 |
|
ui->mainToolBar->setLayoutDirection(Qt::RightToLeft); |
140 |
|
|
141 |
< |
setConverterButtonsSize(); |
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 |
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 |
146 |
– |
#else |
147 |
– |
//resize(640,480); // windows stuff |
154 |
|
#endif |
155 |
|
|
156 |
|
resize(this->startedWindowWidth,this->startedWindowHeight); |
157 |
|
|
158 |
< |
connectSlots(); |
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>(); |
167 |
|
|
168 |
|
updateItemsLoaded(ui->twSourcesXML); |
169 |
|
|
170 |
< |
this->myLogger->writeString("Application started."); |
170 |
> |
loadRecentProjects(); |
171 |
|
} |
172 |
|
|
173 |
|
MainWindow::~MainWindow() |
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(); |
223 |
|
|
224 |
|
void MainWindow::on_actionSound_Wizard_triggered() |
225 |
|
{ |
226 |
< |
SoundWizard myWizard (Util::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap); |
226 |
> |
SoundWizard myWizard (UtilVago::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap); |
227 |
|
myWizard.exec(); |
228 |
|
} |
229 |
|
|
319 |
|
} |
320 |
|
} |
321 |
|
else{ |
322 |
< |
Util::showErrorPopUp("An error occurred checking last version:\n\n"+result->errorString()); |
322 |
> |
UtilVago::showAndLogErrorPopUp(this->myLogger, "An error occurred checking last version:\n\n"+result->errorString()); |
323 |
|
} |
324 |
|
result->deleteLater(); |
325 |
|
} |
472 |
|
command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbLarge->text()); |
473 |
|
} |
474 |
|
|
475 |
< |
if(ui->rbBGR32->isChecked()){ |
439 |
< |
command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGR32->text()); |
440 |
< |
} |
441 |
< |
else if(ui->rbBGRA32->isChecked()){ |
442 |
< |
command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA32->text()); |
443 |
< |
} |
444 |
< |
else if(ui->rbBGR555->isChecked()){ |
445 |
< |
command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGR555->text()); |
446 |
< |
} |
447 |
< |
else if(ui->rbBGRA5551->isChecked()){ |
448 |
< |
command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA5551->text()); |
449 |
< |
} |
450 |
< |
else if(ui->rbBGRA444->isChecked()){ |
451 |
< |
command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbBGRA444->text()); |
452 |
< |
} |
453 |
< |
else{ //dxt1 checked |
454 |
< |
command+=" "+this->commandMap.value(tabTitle+"->"+ui->rbDxt1->text()); |
455 |
< |
} |
475 |
> |
command+=" "+this->commandMap.value(tabTitle+"->"+getTextureRBCheckedTypeTexture()->text()); |
476 |
|
|
477 |
|
if(ui->cbEnvMap->isChecked()){ |
478 |
|
if(ui->leEnvMapTexture->text().isEmpty()){ |
654 |
|
return this->commandMap.value("misc->"+from+"->"+to)+" "+myOutputFolder+" "+file; |
655 |
|
} |
656 |
|
|
657 |
< |
void MainWindow::addRowTable(DropTableWidget *myTable, QString fileName, QString fromTo, QString command){ |
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 |
|
|
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); |
679 |
|
myTable->updateTableToolTips(twSize); //Update tool tips |
680 |
|
} |
681 |
|
|
682 |
< |
void MainWindow::on_pbConvertXML_clicked() |
657 |
< |
{ |
658 |
< |
startConversion(ui->twSourcesXML); |
659 |
< |
} |
660 |
< |
|
661 |
< |
void MainWindow::on_pbConvertTextures_clicked() |
682 |
> |
void MainWindow::on_pbConvert_clicked() |
683 |
|
{ |
684 |
< |
startConversion(ui->twSourcesTextures); |
684 |
> |
startConversion(); |
685 |
|
} |
686 |
|
|
687 |
< |
void MainWindow::on_pbConvertObjects_clicked() |
667 |
< |
{ |
668 |
< |
startConversion(ui->twSourcesObjects); |
669 |
< |
} |
687 |
> |
void MainWindow::startConversion(){ |
688 |
|
|
689 |
< |
void MainWindow::on_pbConvertCharacters_clicked() |
672 |
< |
{ |
673 |
< |
startConversion(ui->twSourcesCharacters); |
674 |
< |
} |
675 |
< |
|
676 |
< |
void MainWindow::on_pbConvertLevels_clicked() |
677 |
< |
{ |
678 |
< |
startConversion(ui->twSourcesLevels); |
679 |
< |
} |
680 |
< |
|
681 |
< |
void MainWindow::on_pbConvertMisc_clicked() |
682 |
< |
{ |
683 |
< |
startConversion(ui->twSourcesMisc); |
684 |
< |
} |
685 |
< |
|
686 |
< |
void MainWindow::startConversion(DropTableWidget *myTable){ |
689 |
> |
DropTableWidget* currTable = getCurrentTableWidget(); |
690 |
|
|
691 |
|
bool ready=false; |
692 |
< |
for(int i=0; i<myTable->rowCount(); i++){ //There are items to process? |
693 |
< |
if(myTable->item(i,2)->background()!=myTable->disabledBackStyle){ |
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 |
|
} |
706 |
|
return; |
707 |
|
} |
708 |
|
|
709 |
< |
for(int i=0; i<myTable->rowCount(); i++){ |
709 |
> |
for(int i=0; i<currTable->rowCount(); i++){ |
710 |
|
//Only process enabled items |
711 |
< |
if(myTable->item(i,2)->background()!=myTable->disabledBackStyle){ |
712 |
< |
this->listToProccess->append(myTable->item(i,2)->text()); |
711 |
> |
if(currTable->item(i,2)->background()!=currTable->disabledBackStyle){ |
712 |
> |
this->listToProccess->append(currTable->item(i,2)->text()); |
713 |
|
} |
714 |
|
} |
715 |
|
|
735 |
|
if(numErrors!=0){ |
736 |
|
QString sNumErrors=QString::number(numErrors); |
737 |
|
if(numErrors>1){ |
738 |
< |
Util::showErrorLogPopUp(result+"\n This is the last of "+sNumErrors+" Errors."); |
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 |
< |
Util::showErrorLogPopUp(result); |
742 |
> |
UtilVago::showErrorPopUpLogButton(result); |
743 |
|
showErrStatusMessage("Something gone wrong. Check log file."); |
744 |
|
} |
745 |
|
|
889 |
|
|
890 |
|
void MainWindow::on_cbFromTextures_currentIndexChanged(const QString &arg1) |
891 |
|
{ |
889 |
– |
//Options are only used for DAT/ONI -> Image |
890 |
– |
if(QString::compare(arg1,"DAT / ONI",Qt::CaseSensitive)==0){ //case sensitive is faster |
891 |
– |
ui->gbTextures->setEnabled(false); |
892 |
– |
} |
893 |
– |
else{ |
894 |
– |
ui->gbTextures->setEnabled(true); |
895 |
– |
} |
896 |
– |
|
892 |
|
updateComboBox(arg1, ui->cbToTextures); |
893 |
|
} |
894 |
|
|
895 |
|
void MainWindow::on_cbFromObjects_currentIndexChanged(const QString &arg1) |
896 |
|
{ |
902 |
– |
ui->cbTexture->setEnabled(false); |
903 |
– |
ui->cbTexture->setChecked(false); |
904 |
– |
ui->cbWithAnimation->setEnabled(false); |
905 |
– |
ui->cbWithAnimation->setChecked(false); |
906 |
– |
|
907 |
– |
if(QString::compare(arg1,"M3GM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster |
908 |
– |
ui->cbWithAnimation->setEnabled(true); |
909 |
– |
} |
910 |
– |
else if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){ |
911 |
– |
ui->cbTexture->setEnabled(true); |
912 |
– |
} |
913 |
– |
|
897 |
|
updateComboBox(arg1, ui->cbToObjects); |
898 |
|
} |
899 |
|
|
900 |
|
void MainWindow::on_cbFromCharacters_currentIndexChanged(const QString &arg1) |
901 |
|
{ |
919 |
– |
ui->cbWithTRBS_ONCC->setEnabled(false); |
920 |
– |
ui->cbWithTRBS_ONCC->setChecked(false); |
921 |
– |
ui->cbCellShading->setEnabled(false); |
922 |
– |
ui->cbCellShading->setChecked(false); |
923 |
– |
ui->cbNormals->setEnabled(false); |
924 |
– |
ui->cbNormals->setChecked(false); |
925 |
– |
|
926 |
– |
if(QString::compare(arg1,"TRAM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster |
927 |
– |
ui->cbWithTRBS_ONCC->setEnabled(true); |
928 |
– |
} |
929 |
– |
else if(QString::compare(arg1,"TRBS DAE",Qt::CaseSensitive)==0){ |
930 |
– |
ui->cbNormals->setEnabled(true); |
931 |
– |
ui->cbCellShading->setEnabled(true); |
932 |
– |
} |
933 |
– |
|
902 |
|
updateComboBox(arg1, ui->cbToCharacters); |
903 |
|
} |
904 |
|
|
905 |
|
void MainWindow::on_cbFromLevels_currentIndexChanged(const QString &arg1) |
906 |
|
{ |
939 |
– |
|
940 |
– |
ui->cbSpecificFilesLevels->setEnabled(false); |
941 |
– |
ui->cbSpecificFilesLevels->setChecked(false); |
942 |
– |
ui->cbDatLevels->setEnabled(false); |
943 |
– |
ui->cbDatLevels->setChecked(false); |
944 |
– |
ui->cbBnvLevels->setEnabled(false); |
945 |
– |
ui->cbBnvLevels->setChecked(false); |
946 |
– |
ui->cbAdditionalSourcesLevels->setEnabled(false); |
947 |
– |
ui->cbAdditionalSourcesLevels->setChecked(false); |
948 |
– |
ui->cbGridsLevels->setEnabled(false); |
949 |
– |
ui->cbGridsLevels->setChecked(false); |
950 |
– |
|
951 |
– |
if(arg1=="DAT"){ //case sensitive is faster |
952 |
– |
ui->cbSpecificFilesLevels->setEnabled(true); |
953 |
– |
} |
954 |
– |
else if(arg1=="ONI FILES"){ //case sensitive is faster |
955 |
– |
ui->cbDatLevels->setEnabled(true); |
956 |
– |
} |
957 |
– |
else if(arg1=="DAE"){ |
958 |
– |
ui->cbBnvLevels->setEnabled(true); |
959 |
– |
ui->cbAdditionalSourcesLevels->setEnabled(true); |
960 |
– |
} |
961 |
– |
|
907 |
|
updateComboBox(arg1, ui->cbToLevels); |
908 |
|
} |
909 |
|
|
913 |
|
} |
914 |
|
|
915 |
|
void MainWindow::updateComboBox(const QString &arg1, QComboBox *comboBox){ |
916 |
< |
QString identifier=ui->tabWidget->tabText(ui->tabWidget->currentIndex()).toLower(); // get current tab title text (lower case) |
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 |
|
|
1129 |
|
#endif |
1130 |
|
|
1131 |
|
if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){ |
1132 |
< |
myTable->clearContents(); |
1108 |
< |
myTable->setRowCount(0); |
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 |
|
{ |
1213 |
|
|
1214 |
|
void MainWindow::on_actionCheck_OniSplit_version_triggered() |
1215 |
|
{ |
1216 |
< |
QProcess *myProcess = new QProcess(); |
1217 |
< |
myProcess->setWorkingDirectory(Util::getAppPath()); |
1218 |
< |
myProcess->start(Util::getOniSplitExeName()+" -version"); |
1219 |
< |
myProcess->waitForFinished(-1); |
1220 |
< |
QString result=myProcess->readAllStandardOutput(); |
1221 |
< |
delete myProcess; |
1222 |
< |
Util::showPopUp("This Vago version was built with base in OniSplit version "+GlobalVars::BuiltOniSplitVersion+"\n\nActual version is:\n"+result); |
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 = new QProcess(); |
1229 |
< |
myProcess->setWorkingDirectory(Util::getAppPath()); |
1230 |
< |
myProcess->start(Util::getXmlToolsExeName()+" version"); |
1231 |
< |
myProcess->waitForFinished(-1); |
1232 |
< |
QString result=myProcess->readLine(); |
1233 |
< |
delete myProcess; |
1234 |
< |
Util::showPopUp("This Vago version was built with base in xmlTools version "+GlobalVars::BuiltXmlToolsVersion+"\n\nActual version is:\n"+result); |
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 index) |
1240 |
> |
void MainWindow::on_tabWidget_currentChanged(int) |
1241 |
|
{ |
1242 |
< |
QString tabtext = ui->tabWidget->tabText(index); |
1214 |
< |
|
1215 |
< |
if(tabtext.compare("XML",Qt::CaseSensitive)==0){ //case sentive is faster |
1216 |
< |
updateItemsLoaded(ui->twSourcesXML); |
1217 |
< |
} |
1218 |
< |
else if(tabtext.compare("Textures",Qt::CaseSensitive)==0){ |
1219 |
< |
updateItemsLoaded(ui->twSourcesTextures); |
1220 |
< |
} |
1221 |
< |
else if(tabtext.compare("Characters",Qt::CaseSensitive)==0){ |
1222 |
< |
updateItemsLoaded(ui->twSourcesCharacters); |
1223 |
< |
} |
1224 |
< |
else if(tabtext.compare("Objects",Qt::CaseSensitive)==0){ |
1225 |
< |
updateItemsLoaded(ui->twSourcesObjects); |
1226 |
< |
} |
1227 |
< |
else if(tabtext.compare("Levels",Qt::CaseSensitive)==0){ |
1228 |
< |
updateItemsLoaded(ui->twSourcesLevels); |
1229 |
< |
} |
1230 |
< |
else{ |
1231 |
< |
updateItemsLoaded(ui->twSourcesMisc); |
1232 |
< |
} |
1242 |
> |
updateItemsLoaded(getCurrentTableWidget()); |
1243 |
|
} |
1244 |
|
|
1245 |
|
void MainWindow::updateItemsLoaded(DropTableWidget *currentTable){ |
1292 |
|
|
1293 |
|
void MainWindow::on_actionView_log_triggered() |
1294 |
|
{ |
1295 |
< |
Util::openLogFile(); |
1295 |
> |
UtilVago::openLogFile(); |
1296 |
|
} |
1297 |
|
|
1298 |
|
void MainWindow::on_actionOpen_AE_folder_triggered() |
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 |
|
|
1408 |
|
selectedRows << rowItem.row(); |
1409 |
|
} |
1410 |
|
|
1411 |
< |
QMenu *menu = new QMenu(); |
1412 |
< |
QAction *copy = new QAction("Copy",myTable); |
1413 |
< |
QAction *moveUp = new QAction("Move Up",myTable); |
1414 |
< |
QAction *moveDown = new QAction("Move Down",myTable); |
1415 |
< |
QAction *changeOptions = new QAction("Change To Current Options",myTable); |
1416 |
< |
QMenu *changeOutput = new QMenu("Change Output for:"); |
1417 |
< |
QAction *outWorkspace = new QAction("Workspace",myTable); |
1418 |
< |
QAction *outCurrOutput = new QAction("Current Output Folder",myTable); |
1419 |
< |
QAction *outOther = new QAction("Other...",myTable); |
1420 |
< |
QAction *edisable = new QAction("Enable/Disable",myTable); |
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); |
1422 |
> |
menu->addAction(copy.get()); |
1423 |
|
menu->addSeparator(); |
1424 |
< |
menu->addAction(moveUp); |
1425 |
< |
menu->addAction(moveDown); |
1424 |
> |
menu->addAction(moveUp.get()); |
1425 |
> |
menu->addAction(moveDown.get()); |
1426 |
|
menu->addSeparator(); |
1427 |
< |
menu->addAction(changeOptions); |
1428 |
< |
menu->addMenu(changeOutput); |
1429 |
< |
changeOutput->addActions(QList<QAction*>() << outWorkspace << outCurrOutput << outOther); |
1430 |
< |
menu->addAction(edisable); |
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 |
1451 |
|
|
1452 |
|
QAction* selectedOption = menu->exec(event->globalPos()); |
1453 |
|
|
1454 |
< |
if(selectedOption==copy){ |
1454 |
> |
if(selectedOption==copy.get()){ |
1455 |
|
//Let's copy the contents to the clipboard |
1456 |
|
|
1457 |
|
QString toCopy; |
1474 |
|
QApplication::clipboard()->setText(toCopy); |
1475 |
|
showSuccessStatusMessage(QString::number(size) + (size==1?" item ":" items ")+ "copied to the clipboard"); |
1476 |
|
} |
1477 |
< |
else if(selectedOption==moveUp){ |
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){ |
1481 |
> |
else if(selectedOption==moveDown.get()){ |
1482 |
|
qSort(selectedRows); |
1483 |
|
myTable->swapPositions(selectedRows,+1); |
1484 |
|
} |
1485 |
< |
else if(selectedOption==changeOptions){ |
1485 |
> |
else if(selectedOption==changeOptions.get()){ |
1486 |
|
changeToCurrentSettings(selectedRows,myTable); |
1487 |
|
} |
1488 |
< |
else if(selectedOption==outWorkspace){ |
1488 |
> |
else if(selectedOption==outWorkspace.get()){ |
1489 |
|
changeItemsOutput(myTable,selectedRows,this->workspaceLocation); |
1490 |
|
} |
1491 |
< |
else if(selectedOption==outCurrOutput){ |
1491 |
> |
else if(selectedOption==outCurrOutput.get()){ |
1492 |
|
changeItemsOutput(myTable,selectedRows,this->outputFolder); |
1493 |
|
} |
1494 |
< |
else if(selectedOption==outOther){ |
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); |
1503 |
|
changeItemsOutput(myTable,selectedRows,newDir); |
1504 |
|
|
1505 |
|
} |
1506 |
< |
else if(selectedOption==edisable){ |
1506 |
> |
else if(selectedOption==edisable.get()){ |
1507 |
|
|
1508 |
|
int enabledCount=0, disabledCount=0; |
1509 |
|
|
1541 |
|
|
1542 |
|
showSuccessStatusMessage(result); |
1543 |
|
} |
1475 |
– |
|
1476 |
– |
delete copy; |
1477 |
– |
delete moveUp; |
1478 |
– |
delete moveDown; |
1479 |
– |
delete changeOptions; |
1480 |
– |
delete outWorkspace; |
1481 |
– |
delete outCurrOutput; |
1482 |
– |
delete outOther; |
1483 |
– |
delete changeOutput; |
1484 |
– |
delete edisable; |
1485 |
– |
delete menu; |
1544 |
|
} |
1545 |
|
|
1546 |
|
void MainWindow::changeToCurrentSettings(QList<int> rows, DropTableWidget* myTable){ |
1615 |
|
|
1616 |
|
} |
1617 |
|
|
1560 |
– |
/** |
1561 |
– |
This is OS indepented. It maintain size ratio over the Windows and Mac. |
1562 |
– |
**/ |
1563 |
– |
void MainWindow::setConverterButtonsSize(){ |
1564 |
– |
int height=ui->pbConvertXML->sizeHint().height()*1.3; |
1565 |
– |
ui->pbConvertXML->setMinimumHeight(height); |
1566 |
– |
ui->pbConvertTextures->setMinimumHeight(height); |
1567 |
– |
ui->pbConvertObjects->setMinimumHeight(height); |
1568 |
– |
ui->pbConvertCharacters->setMinimumHeight(height); |
1569 |
– |
ui->pbConvertLevels->setMinimumHeight(height); |
1570 |
– |
ui->pbConvertMisc->setMinimumHeight(height); |
1571 |
– |
} |
1572 |
– |
|
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) |
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 |
+ |
} |