--- Vago/trunk/Vago/mainwindow.cpp 2014/01/08 11:32:55 897 +++ Vago/trunk/Vago/mainwindow.cpp 2016/03/13 16:11:45 1031 @@ -77,6 +77,12 @@ MainWindow::MainWindow(QWidget *parent) this->vagoSettings->setValue("ConfirmExit", false); iniChanged=true; } +#ifdef Q_OS_MAC + if(!this->vagoSettings->contains("useYesAsDefaultWhenRemovingItems")){ + this->vagoSettings->setValue("useYesAsDefaultWhenRemovingItems", false); + iniChanged=true; + } +#endif if(iniChanged){ this->vagoSettings->sync(); @@ -89,6 +95,9 @@ MainWindow::MainWindow(QWidget *parent) this->outputFolder=this->workspaceLocation; this->startedWindowWidth=this->vagoSettings->value("WindowWidth").toInt(); this->startedWindowHeight=this->vagoSettings->value("WindowHeight").toInt(); +#ifdef Q_OS_MAC + this->useYesAsDefaultWhenRemovingItems=this->vagoSettings->value("useYesAsDefaultWhenRemovingItems").toBool(); +#endif //Create our workspace if it doesn't exists yet if(!QDir(this->workspaceLocation).exists()){ @@ -126,7 +135,7 @@ MainWindow::MainWindow(QWidget *parent) setConverterButtonsSize(); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC // 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 ui->tbOni->setIcon(QIcon(":/new/icons/oni_icon_mac.png")); // Oni executable on mac have a different icon than windows // Set mac platform the first one in the menu, and also make it checkable by default @@ -190,7 +199,7 @@ void MainWindow::on_tbOni_clicked() if(this->vagoSettings->value("OniWindow").toBool()){ // Run in a window? arguments << "-noswitch"; } -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN else{ arguments << "-switch"; // only supported on windows. Was added by daodan dll. } @@ -530,7 +539,13 @@ QString MainWindow::fileParsingLevels(QS command+=":"+ui->leSpecificFilesLevels->text(); } - command+=" "+myOutputFolder+" "+file; + + if(from=="DAT" && to=="ONI FILES"){ // extract files to a subdir with the files name ex: level0_Final + command += " " + myOutputFolder.insert(myOutputFolder.size()-2,QString(Util::cutName(file)).replace(".dat","")) + " " + file; + } + else{ + command+=" "+myOutputFolder+" "+file; + } } @@ -1046,12 +1061,24 @@ void MainWindow::on_pbClearSourcesMisc_c void MainWindow::removeTableContents(DropTableWidget *myTable){ int size = myTable->selectionModel()->selectedRows().size(); + QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os + if(size==0){ Util::showPopUp("Select a row first."); return; } - if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){ +#ifdef Q_OS_MAC + if(this->useYesAsDefaultWhenRemovingItems){ + defaultButton = QMessageBox::Yes; + } + else{ + defaultButton = QMessageBox::No; + } +#endif + + + if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?",defaultButton)){ for(int i=0; iremoveRow(myTable->selectedItems().at(size-i-1)->row()); myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row()); @@ -1061,12 +1088,24 @@ void MainWindow::removeTableContents(Dro } void MainWindow::clearTableContents(DropTableWidget *myTable){ + + QMessageBox::StandardButton defaultButton = QMessageBox::NoButton; // default button for clear asking question, only customizable in mac os + if(myTable->rowCount()==0){ Util::showPopUp("Nothing to clear."); return; } - if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?")){ +#ifdef Q_OS_MAC + if(this->useYesAsDefaultWhenRemovingItems){ + defaultButton = QMessageBox::Yes; + } + else{ + defaultButton = QMessageBox::No; + } +#endif + + if(Util::showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){ myTable->clearContents(); myTable->setRowCount(0); } @@ -1170,19 +1209,24 @@ void MainWindow::on_actionCheck_xmlTools /** Update items loaded - **/ -void MainWindow::on_tabWidget_selected(const QString &arg1) +**/ +void MainWindow::on_tabWidget_currentChanged(int index) { - if(arg1.compare("General",Qt::CaseSensitive)==0){ //case sentive is faster + QString tabtext = ui->tabWidget->tabText(index); + + if(tabtext.compare("XML",Qt::CaseSensitive)==0){ //case sentive is faster updateItemsLoaded(ui->twSourcesXML); } - else if(arg1.compare("Textures",Qt::CaseSensitive)==0){ + else if(tabtext.compare("Textures",Qt::CaseSensitive)==0){ updateItemsLoaded(ui->twSourcesTextures); } - else if(arg1.compare("Objects",Qt::CaseSensitive)==0){ + else if(tabtext.compare("Characters",Qt::CaseSensitive)==0){ + updateItemsLoaded(ui->twSourcesCharacters); + } + else if(tabtext.compare("Objects",Qt::CaseSensitive)==0){ updateItemsLoaded(ui->twSourcesObjects); } - else if(arg1.compare("Levels",Qt::CaseSensitive)==0){ + else if(tabtext.compare("Levels",Qt::CaseSensitive)==0){ updateItemsLoaded(ui->twSourcesLevels); } else{ @@ -1532,8 +1576,8 @@ void MainWindow::setConverterButtonsSize Gets application directory. In mac os gets the .app directory **/ QString MainWindow::getOSIndependentAppPath(){ -#ifdef Q_WS_MAC - QDir dir = QDir::current(); +#ifdef Q_OS_MAC + QDir dir = QDir(QCoreApplication::applicationDirPath()); if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it dir.cdUp(); dir.cdUp();