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 791 by s10k, Sat Apr 6 21:08:35 2013 UTC

# Line 9 | Line 9 | MainWindow::MainWindow(QWidget *parent)
9   {
10      ui->setupUi(this);
11  
12 <    this->setWindowTitle("Vago v"+GlobalVars::AppVersion);
12 >    ui->pbConvertGeneral->setMinimumSize(ui->pbConvertGeneral->minimumSizeHint());
13 >    ui->pbConvertGeneral->setMinimumWidth(50);
14 >    ui->pbConvertGeneral->setMinimumHeight(ui->pbConvertGeneral->minimumHeight()*1.4);
15 >
16 >    qDebug() << ui->pbConvertGeneral->minimumHeight() << ui->pbConvertGeneral->minimumHeight();
17  
18 <    // QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale ());
18 >    this->setWindowTitle("Vago v"+GlobalVars::AppVersion);
19  
20 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitExeName)){
20 >    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::OniSplitString)){
21          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.");
22          exit(1);
23      }
24  
25 <    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsExeName)){
25 >    if(!QFile::exists(QDir::currentPath()+"/"+GlobalVars::XmlToolsString)){
26          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.");
27          exit(1);
28      }
# Line 41 | Line 45 | MainWindow::MainWindow(QWidget *parent)
45          QString aefolder=Util::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder..."));
46  
47          if(aefolder.isEmpty()){
48 <            Util::showErrorPopUp("AE folder is mandatory. Application will exit.");
48 >            Util::showErrorPopUp("AE folder is mandatory. Application will now exit.");
49              exit(1);
50          }
51  
# Line 98 | Line 102 | MainWindow::MainWindow(QWidget *parent)
102      //Create a thread for do the conversion in background
103      this->myConverter = new Converter(this->myLogger,this->listToProccess);
104  
105 +    // User interface
106      ui->mainToolBar->addWidget(ui->tbAE); //add ae installer launch button
107      ui->mainToolBar->addWidget(ui->emptySpacerLabel); //trick, we can't add directly a space so we add an empty
108      ui->mainToolBar->addWidget(ui->tbOni); //add oni launch buttonlabel
# Line 108 | Line 113 | MainWindow::MainWindow(QWidget *parent)
113  
114      ui->mainToolBar->setLayoutDirection(Qt::RightToLeft);
115  
116 + #ifdef Q_WS_MAC
117 +    // 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
118 +    ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows
119 +    // Set mac platform the first one in the menu, and also make it checkable by default
120 +    ui->menuTarget_Platform->removeAction(ui->actionWindows);
121 +    ui->menuTarget_Platform->addAction(ui->actionWindows);
122 +    ui->actionWindows->setChecked(false);
123 +    ui->actionMac_Windows_demo->setChecked(true);
124 +    // Hide file menu on mac (not needed)
125 +    ui->menuFile->hide();
126 +    ui->menuFile->close();
127 +    //ui->menuBar->macMenu();
128 + #endif
129 +
130      connectSlots();
131  
132      //Commands Mapping
# Line 153 | Line 172 | void MainWindow::on_tbOni_clicked()
172   {
173      QStringList arguments;
174  
175 <    if(this->vagoSettings->value("OniWindow").toBool()){ //Run in a window?
175 >    if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window?
176          arguments << "-noswitch";
177      }
178 + #ifdef Q_WS_WIN
179      else{
180 <        arguments << "-switch";
180 >        arguments << "-switch"; // only supported on windows. Was added by daodan dll.
181      }
182 + #endif
183  
184 <    arguments << " -debugfiles";
184 >    arguments << "-debugfiles";
185  
186 <    if(!QProcess::startDetached(this->AeLocation+"/Oni.exe",arguments,this->AeLocation)){
186 >    if(!QProcess::startDetached(this->AeLocation+"/"+GlobalVars::OniExe,arguments,this->AeLocation)){
187          showErrStatusMessage("Oni could not be started!");
188      }
189   }
# Line 171 | Line 192 | void MainWindow::on_tbAE_clicked()
192   {
193      // If the app turn out someday to a native app use QProcess::startDetached instead...
194  
195 <    if(!QDesktopServices::openUrl(this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){
195 >    if(!QDesktopServices::openUrl("file:///"+this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){
196          showErrStatusMessage("Could not start AE Installer!");
197      }
198   }

Diff Legend

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