| 9 |
|
{ |
| 10 |
|
ui->setupUi(this); |
| 11 |
|
|
| 12 |
+ |
this->AppDir=getOSIndependentAppPath(); |
| 13 |
+ |
|
| 14 |
+ |
this->myLogger = new Logger(this->AppDir); //start logger |
| 15 |
+ |
|
| 16 |
+ |
this->myLogger->writeString("Detected AppDir: "+this->AppDir); |
| 17 |
+ |
this->myLogger->writeString("True app dir: "+QDir::currentPath()); |
| 18 |
+ |
|
| 19 |
|
this->setWindowTitle("Vago v"+GlobalVars::AppVersion); |
| 20 |
|
|
| 21 |
< |
if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitString)){ |
| 21 |
> |
if(!QFile::exists(this->AppDir+"/"+GlobalVars::OniSplitString)){ |
| 22 |
|
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."); |
| 23 |
|
exit(1); |
| 24 |
|
} |
| 25 |
|
|
| 26 |
< |
if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsString)){ |
| 26 |
> |
if(!QFile::exists(this->AppDir+"/"+GlobalVars::XmlToolsString)){ |
| 27 |
|
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."); |
| 28 |
|
exit(1); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
< |
this->vagoSettings = new QSettings(QDir::currentPath() + "/" + this->VagoSettingsName, QSettings::IniFormat); |
| 31 |
> |
this->vagoSettings = new QSettings(this->AppDir + "/" + this->VagoSettingsName, QSettings::IniFormat); |
| 32 |
|
|
| 33 |
|
//First Execution? Old configuration? Settings missed? |
| 34 |
|
bool iniChanged=false; |
| 37 |
|
iniChanged=true; |
| 38 |
|
} |
| 39 |
|
if(!this->vagoSettings->contains("Workspace")){ |
| 40 |
< |
this->vagoSettings->setValue("Workspace", QDir::currentPath()+"/VagoWorkspace"); |
| 40 |
> |
this->vagoSettings->setValue("Workspace", this->AppDir+"/VagoWorkspace"); |
| 41 |
|
iniChanged=true; |
| 42 |
|
} |
| 43 |
|
if(!this->vagoSettings->contains("AeFolder")){ |
| 95 |
|
|
| 96 |
|
ui->statusBar->addPermanentWidget(myBar); //this adds automatically in right |
| 97 |
|
|
| 91 |
– |
this->myLogger = new Logger(); //start logger |
| 92 |
– |
|
| 98 |
|
//Initialize list pointers |
| 99 |
|
this->listToProccess = new QStringList; |
| 100 |
|
|
| 101 |
|
//Create a thread for do the conversion in background |
| 102 |
< |
this->myConverter = new Converter(this->myLogger,this->listToProccess); |
| 102 |
> |
this->myConverter = new Converter(this->AppDir,this->myLogger,this->listToProccess); |
| 103 |
|
|
| 104 |
|
// User interface |
| 105 |
|
ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button |
| 165 |
|
|
| 166 |
|
void MainWindow::on_actionSound_Wizard_triggered() |
| 167 |
|
{ |
| 168 |
< |
SoundWizard myWizard (this->workspaceWizardsLocation, this->myLogger, &this->commandMap); |
| 168 |
> |
SoundWizard myWizard (this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap); |
| 169 |
|
myWizard.exec(); |
| 170 |
|
} |
| 171 |
|
|
| 1135 |
|
void MainWindow::on_actionCheck_OniSplit_version_triggered() |
| 1136 |
|
{ |
| 1137 |
|
QProcess *myProcess = new QProcess(); |
| 1138 |
+ |
myProcess->setWorkingDirectory(this->AppDir); |
| 1139 |
|
myProcess->start(GlobalVars::OniSplitExeName+" -version"); |
| 1140 |
|
myProcess->waitForFinished(-1); |
| 1141 |
|
QString result=myProcess->readAllStandardOutput(); |
| 1146 |
|
void MainWindow::on_actionCheck_xmlTools_version_triggered() |
| 1147 |
|
{ |
| 1148 |
|
QProcess *myProcess = new QProcess(); |
| 1149 |
+ |
myProcess->setWorkingDirectory(this->AppDir); |
| 1150 |
|
myProcess->start(GlobalVars::XmlToolsExeName+" version"); |
| 1151 |
|
myProcess->waitForFinished(-1); |
| 1152 |
|
QString result=myProcess->readLine(); |
| 1506 |
|
ui->pbConvertMisc->setMinimumHeight(height); |
| 1507 |
|
} |
| 1508 |
|
|
| 1509 |
+ |
/** |
| 1510 |
+ |
Gets application directory. In mac os gets the .app directory |
| 1511 |
+ |
**/ |
| 1512 |
+ |
QString MainWindow::getOSIndependentAppPath(){ |
| 1513 |
+ |
#ifdef Q_WS_MAC |
| 1514 |
+ |
QDir dir = QDir::current(); |
| 1515 |
+ |
if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it |
| 1516 |
+ |
dir.cdUp(); |
| 1517 |
+ |
dir.cdUp(); |
| 1518 |
+ |
dir.cdUp(); |
| 1519 |
+ |
} |
| 1520 |
+ |
return dir.absolutePath(); |
| 1521 |
+ |
#else |
| 1522 |
+ |
return QDir::currentPath(); |
| 1523 |
+ |
#endif |
| 1524 |
+ |
} |
| 1525 |
+ |
|
| 1526 |
|
void MainWindow::connectSlots(){ |
| 1527 |
|
|
| 1528 |
|
//This signal is for thread that is working setup the progress bar (make it visible and set it's min-max) |