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 792 by s10k, Sat Apr 6 23:10:19 2013 UTC vs.
Revision 803 by s10k, Wed Apr 10 22:01:56 2013 UTC

# Line 9 | Line 9 | MainWindow::MainWindow(QWidget *parent)
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;
# Line 30 | Line 37 | MainWindow::MainWindow(QWidget *parent)
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")){
# Line 88 | Line 95 | MainWindow::MainWindow(QWidget *parent)
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  
# Line 117 | Line 122 | MainWindow::MainWindow(QWidget *parent)
122      ui->menuTarget_Platform->addAction(ui->actionWindows);
123      ui->actionWindows->setChecked(false);
124      ui->actionMac_Windows_demo->setChecked(true);
125 +    resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
126 +    // because the components on mac use more space
127 + #else
128 +    resize(640,480);
129   #endif
130  
131      connectSlots();
# Line 156 | Line 165 | void MainWindow::on_actionAE_Package_Cre
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  
# Line 1495 | Line 1504 | void MainWindow::setConverterButtonsSize
1504      ui->pbConvertMisc->setMinimumHeight(height);
1505   }
1506  
1507 + /**
1508 +  Gets application directory. In mac os gets the .app directory
1509 +  **/
1510 + QString MainWindow::getOSIndependentAppPath(){
1511 + #ifdef Q_WS_MAC
1512 +    QDir dir = QDir::current();
1513 +    if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it
1514 +        dir.cdUp();
1515 +        dir.cdUp();
1516 +        dir.cdUp();
1517 +    }
1518 +    return dir.absolutePath();
1519 + #else
1520 +    return  QDir::currentPath();
1521 + #endif
1522 + }
1523 +
1524   void MainWindow::connectSlots(){
1525  
1526      //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)