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 790 by s10k, Sat Apr 6 20:54:26 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 <    ui->pbConvertGeneral->setMinimumSize(ui->pbConvertGeneral->minimumSizeHint());
13 <    ui->pbConvertGeneral->setMinimumWidth(50);
14 <    ui->pbConvertGeneral->setMinimumHeight(ui->pbConvertGeneral->minimumHeight()*1.4);
15 <
16 <
17 <
18 <    qDebug() << ui->pbConvertGeneral->minimumHeight() << ui->pbConvertGeneral->minimumHeight();
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 38 | 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 115 | Line 109 | MainWindow::MainWindow(QWidget *parent)
109  
110      ui->mainToolBar->setLayoutDirection(Qt::RightToLeft);
111  
112 +    setConverterButtonsSize();
113 +
114   #ifdef Q_WS_MAC
115      // 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
116      ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows
# Line 123 | Line 119 | MainWindow::MainWindow(QWidget *parent)
119      ui->menuTarget_Platform->addAction(ui->actionWindows);
120      ui->actionWindows->setChecked(false);
121      ui->actionMac_Windows_demo->setChecked(true);
122 <    // Hide file menu on mac (not needed)
123 <    ui->menuFile->hide();
124 <    ui->menuFile->close();
125 <    //ui->menuBar->macMenu();
122 >    resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
123 >    // because the components on mac use more space
124 > #else
125 >    resize(640,480);
126   #endif
127  
128      connectSlots();
# Line 166 | 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 1492 | Line 1488 | QString MainWindow::getCommand(DropTable
1488  
1489   }
1490  
1491 + /**
1492 +  This is OS indepented. It maintain size ratio over the Windows and Mac.
1493 +  **/
1494 + void MainWindow::setConverterButtonsSize(){
1495 +    int height=ui->pbConvertGeneral->sizeHint().height()*1.3;
1496 +    ui->pbConvertGeneral->setMinimumHeight(height);
1497 +    ui->pbConvertTextures->setMinimumHeight(height);
1498 +    ui->pbConvertModels->setMinimumHeight(height);
1499 +    ui->pbConvertAnimations->setMinimumHeight(height);
1500 +    ui->pbConvertLevels->setMinimumHeight(height);
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)