| 9 |
|
{ |
| 10 |
|
ui->setupUi(this); |
| 11 |
|
|
| 12 |
< |
this->AppDir=getOSIndependentAppPath(); |
| 12 |
> |
this->myLogger = new Logger(Util::getAppPath()); //start logger |
| 13 |
|
|
| 14 |
< |
this->myLogger = new Logger(this->AppDir); //start logger |
| 15 |
< |
|
| 16 |
< |
this->myLogger->writeString("Detected AppDir: "+this->AppDir); |
| 14 |
> |
this->myLogger->writeString("Detected AppDir: "+Util::getAppPath()); |
| 15 |
|
this->myLogger->writeString("True app dir: "+QDir::currentPath()); |
| 16 |
|
|
| 17 |
|
this->setWindowTitle("Vago v"+GlobalVars::AppVersion); |
| 18 |
|
|
| 19 |
< |
if(!QFile::exists(this->AppDir+"/"+GlobalVars::OniSplitString)){ |
| 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."); |
| 21 |
|
exit(1); |
| 22 |
|
} |
| 23 |
|
|
| 24 |
< |
if(!QFile::exists(this->AppDir+"/"+GlobalVars::XmlToolsString)){ |
| 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."); |
| 26 |
|
exit(1); |
| 27 |
|
} |
| 28 |
|
|
| 29 |
< |
this->vagoSettings = new QSettings(this->AppDir + "/" + this->VagoSettingsName, QSettings::IniFormat); |
| 29 |
> |
this->vagoSettings = new QSettings(Util::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", this->AppDir+"/VagoWorkspace"); |
| 38 |
> |
this->vagoSettings->setValue("Workspace", Util::getAppPath()+"/VagoWorkspace"); |
| 39 |
|
iniChanged=true; |
| 40 |
|
} |
| 41 |
|
if(!this->vagoSettings->contains("AeFolder")){ |
| 76 |
|
iniChanged=true; |
| 77 |
|
} |
| 78 |
|
#ifdef Q_OS_MAC |
| 79 |
< |
if(!this->vagoSettings->contains("UseYesButtonClear")){ |
| 80 |
< |
this->vagoSettings->setValue("UseYesButtonClear", false); |
| 79 |
> |
if(!this->vagoSettings->contains("useYesAsDefaultWhenRemovingItems")){ |
| 80 |
> |
this->vagoSettings->setValue("useYesAsDefaultWhenRemovingItems", false); |
| 81 |
|
iniChanged=true; |
| 82 |
|
} |
| 83 |
|
#endif |
| 94 |
|
this->startedWindowWidth=this->vagoSettings->value("WindowWidth").toInt(); |
| 95 |
|
this->startedWindowHeight=this->vagoSettings->value("WindowHeight").toInt(); |
| 96 |
|
#ifdef Q_OS_MAC |
| 97 |
< |
this->useYesAsDefaultInClearButton=this->vagoSettings->value("UseYesButtonClear").toBool(); |
| 97 |
> |
this->useYesAsDefaultWhenRemovingItems=this->vagoSettings->value("useYesAsDefaultWhenRemovingItems").toBool(); |
| 98 |
|
#endif |
| 99 |
|
|
| 100 |
|
//Create our workspace if it doesn't exists yet |
| 118 |
|
this->listToProccess = new QStringList; |
| 119 |
|
|
| 120 |
|
//Create a thread for do the conversion in background |
| 121 |
< |
this->myConverter = new Converter(this->AppDir,this->myLogger,this->listToProccess); |
| 121 |
> |
this->myConverter = new Converter(Util::getAppPath(),this->myLogger,this->listToProccess); |
| 122 |
|
|
| 123 |
|
// User interface |
| 124 |
|
ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button |
| 186 |
|
|
| 187 |
|
void MainWindow::on_actionSound_Wizard_triggered() |
| 188 |
|
{ |
| 189 |
< |
SoundWizard myWizard (this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap); |
| 189 |
> |
SoundWizard myWizard (Util::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap); |
| 190 |
|
myWizard.exec(); |
| 191 |
|
} |
| 192 |
|
|
| 309 |
|
|
| 310 |
|
void MainWindow::on_pbAddSourceLevels_clicked() |
| 311 |
|
{ |
| 312 |
< |
if(QString::compare(ui->cbFromXML->currentText(),"ONI FILES",Qt::CaseSensitive)==0 && QString::compare(ui->cbToXML->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster) |
| 312 |
> |
if(QString::compare(ui->cbFromLevels->currentText(),"ONI FILES",Qt::CaseSensitive)==0 && QString::compare(ui->cbToLevels->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster) |
| 313 |
|
addFilesSource(ui->twSourcesLevels,Util::multipleDirDialog("Choose folders with ONIs...")); |
| 314 |
|
} |
| 315 |
|
else{ |
| 1067 |
|
} |
| 1068 |
|
|
| 1069 |
|
#ifdef Q_OS_MAC |
| 1070 |
< |
if(this->useYesAsDefaultInClearButton){ |
| 1070 |
> |
if(this->useYesAsDefaultWhenRemovingItems){ |
| 1071 |
|
defaultButton = QMessageBox::Yes; |
| 1072 |
|
} |
| 1073 |
|
else{ |
| 1086 |
|
} |
| 1087 |
|
|
| 1088 |
|
void MainWindow::clearTableContents(DropTableWidget *myTable){ |
| 1089 |
+ |
|
| 1090 |
+ |
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os |
| 1091 |
+ |
|
| 1092 |
|
if(myTable->rowCount()==0){ |
| 1093 |
|
Util::showPopUp("Nothing to clear."); |
| 1094 |
|
return; |
| 1095 |
|
} |
| 1096 |
|
|
| 1097 |
< |
if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?")){ |
| 1097 |
> |
#ifdef Q_OS_MAC |
| 1098 |
> |
if(this->useYesAsDefaultWhenRemovingItems){ |
| 1099 |
> |
defaultButton = QMessageBox::Yes; |
| 1100 |
> |
} |
| 1101 |
> |
else{ |
| 1102 |
> |
defaultButton = QMessageBox::No; |
| 1103 |
> |
} |
| 1104 |
> |
#endif |
| 1105 |
> |
|
| 1106 |
> |
if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){ |
| 1107 |
|
myTable->clearContents(); |
| 1108 |
|
myTable->setRowCount(0); |
| 1109 |
|
} |
| 1186 |
|
void MainWindow::on_actionCheck_OniSplit_version_triggered() |
| 1187 |
|
{ |
| 1188 |
|
QProcess *myProcess = new QProcess(); |
| 1189 |
< |
myProcess->setWorkingDirectory(this->AppDir); |
| 1190 |
< |
myProcess->start(GlobalVars::OniSplitExeName+" -version"); |
| 1189 |
> |
myProcess->setWorkingDirectory(Util::getAppPath()); |
| 1190 |
> |
myProcess->start(Util::getOniSplitExeName()+" -version"); |
| 1191 |
|
myProcess->waitForFinished(-1); |
| 1192 |
|
QString result=myProcess->readAllStandardOutput(); |
| 1193 |
|
delete myProcess; |
| 1197 |
|
void MainWindow::on_actionCheck_xmlTools_version_triggered() |
| 1198 |
|
{ |
| 1199 |
|
QProcess *myProcess = new QProcess(); |
| 1200 |
< |
myProcess->setWorkingDirectory(this->AppDir); |
| 1201 |
< |
myProcess->start(GlobalVars::XmlToolsExeName+" version"); |
| 1200 |
> |
myProcess->setWorkingDirectory(Util::getAppPath()); |
| 1201 |
> |
myProcess->start(Util::getXmlToolsExeName()+" version"); |
| 1202 |
|
myProcess->waitForFinished(-1); |
| 1203 |
|
QString result=myProcess->readLine(); |
| 1204 |
|
delete myProcess; |
| 1570 |
|
ui->pbConvertMisc->setMinimumHeight(height); |
| 1571 |
|
} |
| 1572 |
|
|
| 1563 |
– |
/** |
| 1564 |
– |
Gets application directory. In mac os gets the .app directory |
| 1565 |
– |
**/ |
| 1566 |
– |
QString MainWindow::getOSIndependentAppPath(){ |
| 1567 |
– |
#ifdef Q_OS_MAC |
| 1568 |
– |
QDir dir = QDir::current(); |
| 1569 |
– |
if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it |
| 1570 |
– |
dir.cdUp(); |
| 1571 |
– |
dir.cdUp(); |
| 1572 |
– |
dir.cdUp(); |
| 1573 |
– |
} |
| 1574 |
– |
return dir.absolutePath(); |
| 1575 |
– |
#else |
| 1576 |
– |
return QDir::currentPath(); |
| 1577 |
– |
#endif |
| 1578 |
– |
} |
| 1579 |
– |
|
| 1573 |
|
void MainWindow::connectSlots(){ |
| 1574 |
|
|
| 1575 |
|
//This signal is for thread that is working setup the progress bar (make it visible and set it's min-max) |