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 793 by s10k, Sat Apr 6 23:30:00 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 +    resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
121 +    // because the components on mac use more space
122 + #endif
123 +
124      connectSlots();
125  
126      //Commands Mapping
# Line 153 | Line 166 | void MainWindow::on_tbOni_clicked()
166   {
167      QStringList arguments;
168  
169 <    if(this->vagoSettings->value("OniWindow").toBool()){ //Run in a window?
169 >    if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window?
170          arguments << "-noswitch";
171      }
172 + #ifdef Q_WS_WIN
173      else{
174 <        arguments << "-switch";
174 >        arguments << "-switch"; // only supported on windows. Was added by daodan dll.
175      }
176 + #endif
177  
178 <    arguments << " -debugfiles";
178 >    arguments << "-debugfiles";
179  
180 <    if(!QProcess::startDetached(this->AeLocation+"/Oni.exe",arguments,this->AeLocation)){
180 >    if(!QProcess::startDetached(this->AeLocation+"/"+GlobalVars::OniExe,arguments,this->AeLocation)){
181          showErrStatusMessage("Oni could not be started!");
182      }
183   }
# Line 171 | Line 186 | void MainWindow::on_tbAE_clicked()
186   {
187      // If the app turn out someday to a native app use QProcess::startDetached instead...
188  
189 <    if(!QDesktopServices::openUrl(this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){
189 >    if(!QDesktopServices::openUrl("file:///"+this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){
190          showErrStatusMessage("Could not start AE Installer!");
191      }
192   }
# Line 1469 | Line 1484 | QString MainWindow::getCommand(DropTable
1484  
1485   }
1486  
1487 + /**
1488 +  This is OS indepented. It maintain size ratio over the Windows and Mac.
1489 +  **/
1490 + void MainWindow::setConverterButtonsSize(){
1491 +    int height=ui->pbConvertGeneral->sizeHint().height()*1.3;
1492 +    ui->pbConvertGeneral->setMinimumHeight(height);
1493 +    ui->pbConvertTextures->setMinimumHeight(height);
1494 +    ui->pbConvertModels->setMinimumHeight(height);
1495 +    ui->pbConvertAnimations->setMinimumHeight(height);
1496 +    ui->pbConvertLevels->setMinimumHeight(height);
1497 +    ui->pbConvertMisc->setMinimumHeight(height);
1498 + }
1499 +
1500   void MainWindow::connectSlots(){
1501  
1502      //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)