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 797 by s10k, Sun Apr 7 01:02:07 2013 UTC vs.
Revision 801 by s10k, Sun Apr 7 15:36:17 2013 UTC

# Line 9 | Line 9 | MainWindow::MainWindow(QWidget *parent)
9   {
10      ui->setupUi(this);
11  
12 +    this->AppDir=getOSIndependentAppPath();
13 +
14      this->setWindowTitle("Vago v"+GlobalVars::AppVersion);
15  
16 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitString)){
16 >    if(!QFile::exists(this->AppDir+"/"+GlobalVars::OniSplitString)){
17          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.");
18          exit(1);
19      }
20  
21 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsString)){
21 >    if(!QFile::exists(this->AppDir+"/"+GlobalVars::XmlToolsString)){
22          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.");
23          exit(1);
24      }
25  
26 <    this->vagoSettings = new QSettings(QDir::currentPath() + "/" + this->VagoSettingsName, QSettings::IniFormat);
26 >    this->vagoSettings = new QSettings(this->AppDir + "/" + this->VagoSettingsName, QSettings::IniFormat);
27  
28      //First Execution? Old configuration? Settings missed?
29      bool iniChanged=false;
# Line 30 | Line 32 | MainWindow::MainWindow(QWidget *parent)
32          iniChanged=true;
33      }
34      if(!this->vagoSettings->contains("Workspace")){
35 <        this->vagoSettings->setValue("Workspace", QDir::currentPath()+"/VagoWorkspace");
35 >        this->vagoSettings->setValue("Workspace", this->AppDir+"/VagoWorkspace");
36          iniChanged=true;
37      }
38      if(!this->vagoSettings->contains("AeFolder")){
# Line 160 | Line 162 | void MainWindow::on_actionAE_Package_Cre
162  
163   void MainWindow::on_actionSound_Wizard_triggered()
164   {
165 <    SoundWizard myWizard (this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
165 >    SoundWizard myWizard (this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
166      myWizard.exec();
167   }
168  
# Line 1499 | Line 1501 | void MainWindow::setConverterButtonsSize
1501      ui->pbConvertMisc->setMinimumHeight(height);
1502   }
1503  
1504 + /**
1505 +  Gets application directory. In mac os gets the .app directory
1506 +  **/
1507 + QString MainWindow::getOSIndependentAppPath(){
1508 + #ifdef Q_WS_MAC
1509 +    QDir dir = QDir::current();
1510 +    if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it
1511 +        dir.cdUp();
1512 +        dir.cdUp();
1513 +    }
1514 +    return dir.absolutePath();
1515 + #else
1516 +    return  QDir::currentPath();
1517 + #endif
1518 + }
1519 +
1520   void MainWindow::connectSlots(){
1521  
1522      //This signal is for thread that is working setup the progress bar (make it visible and set it's min-max)

Diff Legend

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