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 897 by s10k, Wed Jan 8 11:32:55 2014 UTC vs.
Revision 1031 by iritscen, Sun Mar 13 16:11:45 2016 UTC

# Line 77 | Line 77 | MainWindow::MainWindow(QWidget *parent)
77          this->vagoSettings->setValue("ConfirmExit", false);
78          iniChanged=true;
79      }
80 + #ifdef Q_OS_MAC
81 +    if(!this->vagoSettings->contains("useYesAsDefaultWhenRemovingItems")){
82 +        this->vagoSettings->setValue("useYesAsDefaultWhenRemovingItems", false);
83 +        iniChanged=true;
84 +    }
85 + #endif
86  
87      if(iniChanged){
88          this->vagoSettings->sync();
# Line 89 | Line 95 | MainWindow::MainWindow(QWidget *parent)
95      this->outputFolder=this->workspaceLocation;
96      this->startedWindowWidth=this->vagoSettings->value("WindowWidth").toInt();
97      this->startedWindowHeight=this->vagoSettings->value("WindowHeight").toInt();
98 + #ifdef Q_OS_MAC
99 +    this->useYesAsDefaultWhenRemovingItems=this->vagoSettings->value("useYesAsDefaultWhenRemovingItems").toBool();
100 + #endif
101  
102      //Create our workspace if it doesn't exists yet
103      if(!QDir(this->workspaceLocation).exists()){
# Line 126 | Line 135 | MainWindow::MainWindow(QWidget *parent)
135  
136      setConverterButtonsSize();
137  
138 < #ifdef Q_WS_MAC
138 > #ifdef Q_OS_MAC
139      // 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
140      ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows
141      // Set mac platform the first one in the menu, and also make it checkable by default
# Line 190 | Line 199 | void MainWindow::on_tbOni_clicked()
199      if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window?
200          arguments << "-noswitch";
201      }
202 < #ifdef Q_WS_WIN
202 > #ifdef Q_OS_WIN
203      else{
204          arguments << "-switch"; // only supported on windows. Was added by daodan dll.
205      }
# Line 530 | Line 539 | QString MainWindow::fileParsingLevels(QS
539  
540              command+=":"+ui->leSpecificFilesLevels->text();
541          }
542 <        command+=" "+myOutputFolder+" "+file;
542 >
543 >        if(from=="DAT" && to=="ONI FILES"){ // extract files to a subdir with the files name ex: level0_Final
544 >            command += " " + myOutputFolder.insert(myOutputFolder.size()-2,QString(Util::cutName(file)).replace(".dat","")) + " " + file;
545 >        }
546 >        else{
547 >            command+=" "+myOutputFolder+" "+file;
548 >        }
549  
550      }
551  
# Line 1046 | Line 1061 | void MainWindow::on_pbClearSourcesMisc_c
1061   void MainWindow::removeTableContents(DropTableWidget *myTable){
1062      int size = myTable->selectionModel()->selectedRows().size();
1063  
1064 +    QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os
1065 +
1066      if(size==0){
1067          Util::showPopUp("Select a row first.");
1068          return;
1069      }
1070  
1071 <    if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){
1071 > #ifdef Q_OS_MAC
1072 >    if(this->useYesAsDefaultWhenRemovingItems){
1073 >        defaultButton = QMessageBox::Yes;
1074 >    }
1075 >    else{
1076 >        defaultButton = QMessageBox::No;
1077 >    }
1078 > #endif
1079 >
1080 >
1081 >    if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?",defaultButton)){
1082          for(int i=0; i<size; i++){
1083              //myTable->removeRow(myTable->selectedItems().at(size-i-1)->row());
1084              myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row());
# Line 1061 | Line 1088 | void MainWindow::removeTableContents(Dro
1088   }
1089  
1090   void MainWindow::clearTableContents(DropTableWidget *myTable){
1091 +
1092 +    QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os
1093 +
1094      if(myTable->rowCount()==0){
1095          Util::showPopUp("Nothing to clear.");
1096          return;
1097      }
1098  
1099 <    if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?")){
1099 > #ifdef Q_OS_MAC
1100 >    if(this->useYesAsDefaultWhenRemovingItems){
1101 >        defaultButton = QMessageBox::Yes;
1102 >    }
1103 >    else{
1104 >        defaultButton = QMessageBox::No;
1105 >    }
1106 > #endif
1107 >
1108 >    if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){
1109          myTable->clearContents();
1110          myTable->setRowCount(0);
1111      }
# Line 1170 | Line 1209 | void MainWindow::on_actionCheck_xmlTools
1209  
1210   /**
1211    Update items loaded
1212 <  **/
1213 < void MainWindow::on_tabWidget_selected(const QString &arg1)
1212 > **/
1213 > void MainWindow::on_tabWidget_currentChanged(int index)
1214   {
1215 <    if(arg1.compare("General",Qt::CaseSensitive)==0){ //case sentive is faster
1215 >    QString tabtext = ui->tabWidget->tabText(index);
1216 >
1217 >    if(tabtext.compare("XML",Qt::CaseSensitive)==0){ //case sentive is faster
1218          updateItemsLoaded(ui->twSourcesXML);
1219      }
1220 <    else if(arg1.compare("Textures",Qt::CaseSensitive)==0){
1220 >    else if(tabtext.compare("Textures",Qt::CaseSensitive)==0){
1221          updateItemsLoaded(ui->twSourcesTextures);
1222      }
1223 <    else if(arg1.compare("Objects",Qt::CaseSensitive)==0){
1223 >    else if(tabtext.compare("Characters",Qt::CaseSensitive)==0){
1224 >        updateItemsLoaded(ui->twSourcesCharacters);
1225 >    }
1226 >    else if(tabtext.compare("Objects",Qt::CaseSensitive)==0){
1227          updateItemsLoaded(ui->twSourcesObjects);
1228      }
1229 <    else if(arg1.compare("Levels",Qt::CaseSensitive)==0){
1229 >    else if(tabtext.compare("Levels",Qt::CaseSensitive)==0){
1230          updateItemsLoaded(ui->twSourcesLevels);
1231      }
1232      else{
# Line 1532 | Line 1576 | void MainWindow::setConverterButtonsSize
1576    Gets application directory. In mac os gets the .app directory
1577    **/
1578   QString MainWindow::getOSIndependentAppPath(){
1579 < #ifdef Q_WS_MAC
1580 <    QDir dir = QDir::current();
1579 > #ifdef Q_OS_MAC
1580 >    QDir dir = QDir(QCoreApplication::applicationDirPath());
1581      if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it
1582          dir.cdUp();
1583          dir.cdUp();

Diff Legend

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