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 771 by s10k, Sun Mar 31 19:02:16 2013 UTC vs.
Revision 792 by s10k, Sat Apr 6 23:10:19 2013 UTC

# Line 11 | Line 11 | MainWindow::MainWindow(QWidget *parent)
11  
12      this->setWindowTitle("Vago v"+GlobalVars::AppVersion);
13  
14 <    // QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale ());
15 <
16 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitExeName)){
14 >    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitString)){
15          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.");
16          exit(1);
17      }
18  
19 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsExeName)){
19 >    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsString)){
20          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.");
21          exit(1);
22      }
# Line 41 | Line 39 | MainWindow::MainWindow(QWidget *parent)
39          QString aefolder=Util::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder..."));
40  
41          if(aefolder.isEmpty()){
42 <            Util::showErrorPopUp("AE folder is mandatory. Application will exit.");
42 >            Util::showErrorPopUp("AE folder is mandatory. Application will now exit.");
43              exit(1);
44          }
45  
# Line 98 | Line 96 | MainWindow::MainWindow(QWidget *parent)
96      //Create a thread for do the conversion in background
97      this->myConverter = new Converter(this->myLogger,this->listToProccess);
98  
99 +    // User interface
100      ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button
101      ui->mainToolBar->addWidget(ui->emptySpacerLabel); //trick, we can't add directly a space so we add an empty
102      ui->mainToolBar->addWidget(ui->tbOni); //add oni launch buttonlabel
# Line 108 | Line 107 | MainWindow::MainWindow(QWidget *parent)
107  
108      ui->mainToolBar->setLayoutDirection(Qt::RightToLeft);
109  
110 +    setConverterButtonsSize();
111 +
112 + #ifdef Q_WS_MAC
113 +    // 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
114 +    ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows
115 +    // Set mac platform the first one in the menu, and also make it checkable by default
116 +    ui->menuTarget_Platform->removeAction(ui->actionWindows);
117 +    ui->menuTarget_Platform->addAction(ui->actionWindows);
118 +    ui->actionWindows->setChecked(false);
119 +    ui->actionMac_Windows_demo->setChecked(true);
120 + #endif
121 +
122      connectSlots();
123  
124      //Commands Mapping
# Line 153 | Line 164 | void MainWindow::on_tbOni_clicked()
164   {
165      QStringList arguments;
166  
167 <    if(this->vagoSettings->value("OniWindow").toBool()){ //Run in a window?
167 >    if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window?
168          arguments << "-noswitch";
169      }
170 + #ifdef Q_WS_WIN
171      else{
172 <        arguments << "-switch";
172 >        arguments << "-switch"; // only supported on windows. Was added by daodan dll.
173      }
174 + #endif
175  
176 <    arguments << " -debugfiles";
176 >    arguments << "-debugfiles";
177  
178 <    if(!QProcess::startDetached(this->AeLocation+"/Oni.exe",arguments,this->AeLocation)){
178 >    if(!QProcess::startDetached(this->AeLocation+"/"+GlobalVars::OniExe,arguments,this->AeLocation)){
179          showErrStatusMessage("Oni could not be started!");
180      }
181   }
# Line 171 | Line 184 | void MainWindow::on_tbAE_clicked()
184   {
185      // If the app turn out someday to a native app use QProcess::startDetached instead...
186  
187 <    if(!QDesktopServices::openUrl(this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){
187 >    if(!QDesktopServices::openUrl("file:///"+this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){
188          showErrStatusMessage("Could not start AE Installer!");
189      }
190   }
# Line 1469 | Line 1482 | QString MainWindow::getCommand(DropTable
1482  
1483   }
1484  
1485 + /**
1486 +  This is OS indepented. It maintain size ratio over the Windows and Mac.
1487 +  **/
1488 + void MainWindow::setConverterButtonsSize(){
1489 +    int height=ui->pbConvertGeneral->sizeHint().height()*1.3;
1490 +    ui->pbConvertGeneral->setMinimumHeight(height);
1491 +    ui->pbConvertTextures->setMinimumHeight(height);
1492 +    ui->pbConvertModels->setMinimumHeight(height);
1493 +    ui->pbConvertAnimations->setMinimumHeight(height);
1494 +    ui->pbConvertLevels->setMinimumHeight(height);
1495 +    ui->pbConvertMisc->setMinimumHeight(height);
1496 + }
1497 +
1498   void MainWindow::connectSlots(){
1499  
1500      //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)