- Timestamp:
- Dec 30, 2017, 2:57:32 PM (7 years ago)
- Location:
- s10k/Vago
- Files:
-
- 3 added
- 7 deleted
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
s10k/Vago/Vago.pro
r1061 r1093 12 12 } 13 13 CONFIG += c++14 14 CONFIG += quazip 14 15 15 16 INCLUDEPATH += ./packageWizard … … 20 21 INCLUDEPATH += ./windowMessagesWizard 21 22 23 include(../CommonUtils/CommonUtils.pri) 24 include(../CommonLibs/CommonLibs.pri) 25 22 26 # Used this great tutorial to build zlib and quazip: 23 27 # http://www.antonioborondo.com/2014/10/22/zipping-and-unzipping-files-with-qt/ 24 INCLUDEPATH += ../Libs/zlib-1.2.825 LIBS += -L../Libs/zlib-1.2.8 -lz26 INCLUDEPATH += ../Libs/quazip-0.7.2/quazip27 win32 {28 LIBS += -L../Libs/quazip-0.7.2/quazip/release -lquazip29 }30 macx {31 LIBS += -L../Libs/quazip-0.7.2/quazip -lquazip32 }33 28 34 29 macx { … … 39 34 INCLUDEPATH += ./libs/DropTableWidget 40 35 INCLUDEPATH += ./libs/DropLineEdit 41 INCLUDEPATH += ../Libs/pugixml42 36 43 37 win32 { … … 49 43 50 44 SOURCES += \ 51 util.cpp \52 45 preferences.cpp \ 53 46 manualcommands.cpp \ 54 47 mainwindow.cpp \ 55 48 main.cpp \ 56 logger.cpp \57 49 converter.cpp \ 58 50 about.cpp \ … … 75 67 bgImageWizard/bgimagepagefinal.cpp \ 76 68 xmlToolsInterface/xmltoolsinterface.cpp \ 77 libs/BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.cpp \78 69 xmlToolsInterface/xmltoolsinterfacecommandpreview.cpp \ 79 libs/LineNumberDisplay/LineNumberDisplay.cpp \80 70 abstractwizard.cpp \ 81 71 windowMessagesWizard/wmsetuppage.cpp \ … … 86 76 ./libs/DropTableWidget/droptablewidget.cpp \ 87 77 ./libs/DropLineEdit/droplineedit.cpp \ 88 ../Libs/pugixml/pugixml.cpp78 xmlParsers/projectfilevago.cpp 89 79 90 80 HEADERS += \ 91 util.h \92 81 preferences.h \ 93 82 manualcommands.h \ 94 83 mainwindow.h \ 95 logger.h \96 84 converter.h \ 97 85 about.h \ … … 114 102 bgImageWizard/bgimagepagefinal.h \ 115 103 xmlToolsInterface/xmltoolsinterface.h \ 116 libs/BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.h \117 104 xmlToolsInterface/xmltoolsinterfacecommandpreview.h \ 118 libs/LineNumberDisplay/LineNumberDisplay.h \119 105 wizardfactory.h \ 120 106 abstractwizard.h \ … … 126 112 ./libs/DropTableWidget/droptablewidget.h \ 127 113 ./libs/DropLineEdit/droplineedit.h \ 128 ../Libs/pugixml/pugixml.hpp114 xmlParsers/projectfilevago.h 129 115 130 116 FORMS += \ -
s10k/Vago/abstractwizard.cpp
r1061 r1093 1 1 #include "abstractwizard.h" 2 2 3 AbstractWizard::AbstractWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger,const bool hasRestartButton)3 AbstractWizard::AbstractWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, const bool hasRestartButton) 4 4 { 5 5 this->appDir = appDir; 6 6 this->workspaceWizardLocation=workspaceWizardLocation; 7 7 this->vagoSettings=vagoSettings; 8 this->myLogger=myLogger;9 8 this->hasRestartButton = hasRestartButton; 10 9 this->myWizard.setWindowFlags(Qt::Window); // add minimize button in QWizard -
s10k/Vago/abstractwizard.h
r1061 r1093 1 1 #ifndef ABSTRACTWIZARD_H 2 2 #define ABSTRACTWIZARD_H 3 4 #include "logger.h"5 3 6 4 #include <QLabel> … … 24 22 QString workspaceWizardLocation; 25 23 QSettings *vagoSettings; 26 Logger *myLogger;27 24 QString appDir; 28 25 protected: 29 AbstractWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger,const bool hasRestartButton);26 AbstractWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, const bool hasRestartButton); 30 27 virtual void exec()=0; 31 28 void showWizard(const QString &windowsTitle, const QString &windowsIcon); -
s10k/Vago/bgImageWizard/bgimagepage2.cpp
r1058 r1093 2 2 #include "ui_bgimagepage2.h" 3 3 4 BGImagePage2::BGImagePage2( Logger *myLogger,QWidget *parent) :4 BGImagePage2::BGImagePage2(QWidget *parent) : 5 5 QWizardPage(parent), 6 6 ui(new Ui::BGImagePage2) 7 7 { 8 8 ui->setupUi(this); 9 this->myLogger = myLogger;10 9 11 10 this->setTitle("Image to use as background"); … … 46 45 bool BGImagePage2::validateField(QString &field){ 47 46 if(field.isEmpty()){ 48 Util:: showErrorPopUp("You need to choose an image.");47 Util::Dialogs::showError("You need to choose an image."); 49 48 return false; 50 49 } … … 66 65 QImage myImage; 67 66 if(!myImage.load(selectedImage)){ 68 UtilVago::showAndLogErrorPopUp( this->myLogger,"Couldn't load image '" + Util::cutNameWithoutBackSlash(selectedImage) + "'. Is the image corrupt?");67 UtilVago::showAndLogErrorPopUp("Couldn't load image '" + Util::FileSystem::cutNameWithoutBackSlash(selectedImage) + "'. Is the image corrupt?"); 69 68 return; 70 69 } 71 70 72 71 if(myImage.width() < 256 || myImage.height() < 256){ 73 UtilVago::showAndLogErrorPopUp( this->myLogger,"Image '" + Util::cutNameWithoutBackSlash(selectedImage) +72 UtilVago::showAndLogErrorPopUp("Image '" + Util::FileSystem::cutNameWithoutBackSlash(selectedImage) + 74 73 "' does not have a width and height >= 256."); 75 74 return; -
s10k/Vago/bgImageWizard/bgimagepage2.h
r1054 r1093 4 4 #include <QWizardPage> 5 5 #include <QBitmap> 6 #include <QDateTime> 6 7 7 8 #include "utilvago.h" 8 #include "logger.h"9 9 10 10 namespace Ui { … … 17 17 18 18 public: 19 explicit BGImagePage2( Logger *myLogger,QWidget *parent = 0);19 explicit BGImagePage2(QWidget *parent = 0); 20 20 ~BGImagePage2(); 21 21 … … 24 24 25 25 private: 26 Logger *myLogger;27 26 28 27 Ui::BGImagePage2 *ui; -
s10k/Vago/bgImageWizard/bgimagepage3.cpp
r1058 r1093 52 52 void BGImagePage3::on_leLevelId_textChanged(const QString &arg1) 53 53 { 54 if(!arg1.isEmpty() && !Util:: isStringInteger(arg1)){55 Util:: showErrorPopUp("Level id must be a number.");54 if(!arg1.isEmpty() && !Util::Validation::isStringInteger(arg1)){ 55 Util::Dialogs::showError("Level id must be a number."); 56 56 ui->leLevelId->clear(); 57 57 return; … … 136 136 137 137 if(ui->leImageName->text().trimmed().isEmpty()){ 138 Util:: showErrorPopUp("You need to input a name to the image!");138 Util::Dialogs::showError("You need to input a name to the image!"); 139 139 return false; 140 140 } 141 141 142 142 if(ui->cbCreateTXMB->isChecked() && ui->leTXMBName->text().trimmed().isEmpty()){ 143 Util:: showErrorPopUp("You need to input a name to the TXMB file!");143 Util::Dialogs::showError("You need to input a name to the TXMB file!"); 144 144 return false; 145 145 } -
s10k/Vago/bgImageWizard/bgimagepagefinal.cpp
r1058 r1093 2 2 #include "ui_BGImagePageFinal.h" 3 3 4 BGImagePageFinal::BGImagePageFinal(QString appDir, Logger *myLogger,QString bgImagesLocation, QWidget *parent) :4 BGImagePageFinal::BGImagePageFinal(QString appDir, QString bgImagesLocation, QWidget *parent) : 5 5 QWizardPage(parent), 6 6 ui(new Ui::BGImagePageFinal) … … 8 8 ui->setupUi(this); 9 9 this->appDir = appDir; 10 this->myLogger = myLogger;11 10 this->bgImagesLocation = bgImagesLocation; 12 11 this->oniSplitCommands = new QStringList(); 13 this->myOniSplitConverter = new Converter(this->appDir, this-> myLogger, this->oniSplitCommands);12 this->myOniSplitConverter = new Converter(this->appDir, this->oniSplitCommands); 14 13 15 14 ui->lbComplete->setText("<html>The wizard is now complete. The images have been created. " … … 65 64 66 65 for(const QString ¤tFile : imagesSplitted){ 67 this->oniSplitCommands->append("-create:txmp " + Util:: insertQuotes(this->bgImagesLocation) + " -format:bgr32 " + Util::insertQuotes(currentFile));66 this->oniSplitCommands->append("-create:txmp " + Util::String::insertQuotes(this->bgImagesLocation) + " -format:bgr32 " + Util::String::insertQuotes(currentFile)); 68 67 } 69 68 … … 77 76 if(txmbXmlFile.isEmpty()) 78 77 { 79 UtilVago::showAndLogErrorPopUp( this->myLogger,"Couldn't create TXMB xml file!");78 UtilVago::showAndLogErrorPopUp("Couldn't create TXMB xml file!"); 80 79 return; 81 80 } … … 83 82 // Create TXMB oni files 84 83 this->oniSplitCommands->clear(); 85 this->oniSplitCommands->append("-create " + Util:: insertQuotes(this->bgImagesLocation) + " " + Util::insertQuotes(txmbXmlFile));84 this->oniSplitCommands->append("-create " + Util::String::insertQuotes(this->bgImagesLocation) + " " + Util::String::insertQuotes(txmbXmlFile)); 86 85 this->myOniSplitConverter->start(); 87 86 this->myOniSplitConverter->wait(); … … 109 108 { 110 109 QFileInfo currImageFile(currSplittedImage); 111 texturesNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(currImageFile.baseName()));112 } 113 114 txmbNode.append_attribute("id").set_value( Util::qStrToCstr(levelId));115 116 if(!doc.save_file( Util::qStrToCstr(filePath))){110 texturesNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(currImageFile.baseName())); 111 } 112 113 txmbNode.append_attribute("id").set_value(QSTR_TO_CSTR(levelId)); 114 115 if(!doc.save_file(QSTR_TO_CSTR(filePath))){ 117 116 return ""; 118 117 } … … 148 147 149 148 if(!dividedImage.save(imageDestinationPath)){ 150 UtilVago::showAndLogErrorPopUp( this->myLogger,"Couldn't save image " + imageDestinationPath + "! Files weren't created correctly.");149 UtilVago::showAndLogErrorPopUp("Couldn't save image " + imageDestinationPath + "! Files weren't created correctly."); 151 150 return QList<QString>(); 152 151 } -
s10k/Vago/bgImageWizard/bgimagepagefinal.h
r1061 r1093 4 4 #include <QWizardPage> 5 5 #include <QImage> 6 #include <pugixml .hpp>6 #include <pugixml/pugixml.hpp> 7 7 8 8 #include "utilvago.h" … … 18 18 19 19 public: 20 explicit BGImagePageFinal(QString appDir, Logger *myLogger,QString bgImagesLocation, QWidget *parent = 0);20 explicit BGImagePageFinal(QString appDir, QString bgImagesLocation, QWidget *parent = 0); 21 21 ~BGImagePageFinal(); 22 22 … … 25 25 QString appDir; 26 26 QString bgImagesLocation; 27 Logger *myLogger;28 27 Converter *myOniSplitConverter; 29 28 QStringList *oniSplitCommands; -
s10k/Vago/bgImageWizard/bgimagewizard.cpp
r1061 r1093 1 1 #include "bgimagewizard.h" 2 2 3 BGImageWizard::BGImageWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings , Logger *myLogger)4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger,true)3 BGImageWizard::BGImageWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings) 4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, true) 5 5 { 6 6 this->appDir = appDir; 7 7 this->workspaceWizardLocation=workspaceWizardLocation; 8 8 this->vagoSettings=vagoSettings; 9 this->myLogger=myLogger;10 9 this->bgImagesLocation=this->workspaceWizardLocation+"/BGImages"; 11 10 } … … 13 12 void BGImageWizard::exec(){ 14 13 15 BGImagePage2 *page2 = new BGImagePage2( this->myLogger);14 BGImagePage2 *page2 = new BGImagePage2(); 16 15 BGImagePage3 *page3 = new BGImagePage3(); 17 BGImagePageFinal *pageFinal = new BGImagePageFinal(this->appDir, this-> myLogger, this->bgImagesLocation);16 BGImagePageFinal *pageFinal = new BGImagePageFinal(this->appDir, this->bgImagesLocation); 18 17 19 18 this->myWizard.addPage -
s10k/Vago/bgImageWizard/bgimagewizard.h
r1061 r1093 11 11 { 12 12 protected: 13 BGImageWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings , Logger *myLogger);13 BGImageWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings); 14 14 void exec(); 15 15 private: -
s10k/Vago/converter.cpp
r1054 r1093 1 1 #include "converter.h" 2 2 3 Converter::Converter(QString AppDir, Logger *myLogger,QStringList *myData)3 Converter::Converter(QString AppDir, QStringList *myData) 4 4 { 5 5 this->AppDir=AppDir; 6 this->myLogger=myLogger;7 6 this->myData=myData; 8 7 } 9 8 10 9 #ifdef Q_OS_WIN 11 Converter::Converter(QString AppDir, Logger *myLogger,QStringList *myData, QWinTaskbarProgress *win7TaskBarProgress)12 : Converter(AppDir, my Logger, myData)10 Converter::Converter(QString AppDir, QStringList *myData, QWinTaskbarProgress *win7TaskBarProgress) 11 : Converter(AppDir, myData) 13 12 { 14 13 this->win7TaskBarProgress = win7TaskBarProgress; … … 18 17 void Converter::run() 19 18 { 20 this->processHasKilled=false; 21 this->myProcess = new QProcess(); 19 this->myProcess = std::make_unique<QProcess>(); 22 20 QString result = QString(); 23 21 QString errorMessage = ""; 24 22 int numErrors=0; 25 23 26 this->myLogger->writeString("Setting OniSplit process working dir to "+this->AppDir+"."); 27 myProcess->setWorkingDirectory(this->AppDir); // Set working directory (for work with AEI2/Mac OS) 24 this->myProcess->setWorkingDirectory(this->AppDir); // Set working directory (for work with AEI2/Mac OS) 25 26 LOG_INFO << "Setting OniSplit process working dir to " + this->AppDir + "."; 28 27 29 28 #ifdef Q_OS_WIN … … 65 64 this->myProcess->waitForFinished(-1); 66 65 67 if(this->processHasKilled){ // If the process has killed there's no need to proceed with reading output or process more commands 66 // If the process has killed there's no need to proceed with reading output or process more commands 67 if(this->myProcess == nullptr){ 68 68 69 69 #ifdef Q_OS_WIN … … 73 73 #endif 74 74 75 delete this->myProcess; //delete object and make pointer invalid75 this->myProcess.reset(); //delete object and make pointer invalid 76 76 this->myData->clear(); //clean list 77 77 emit conversionAborted(); … … 80 80 } 81 81 82 result =this->myProcess->readAllStandardError();82 result = this->myProcess->readAllStandardError(); 83 83 84 84 if(!result.isEmpty()){ //if(!result.startsWith("Importing",Qt::CaseSensitive) && !result.startsWith("Importing",Qt::CaseSensitive)){ //case sensitive is faster 85 85 //catch exception 86 myLogger->writeString("Oni Split Error: \n"+this->myData->at(i)+"\n"+result);86 LOG_ERROR << "Oni Split Error: \n" + this->myData->at(i) + "\n" + result; 87 87 errorMessage=result; 88 88 numErrors++; … … 110 110 #endif 111 111 112 delete this->myProcess; //delete object and make pointer invalid112 this->myProcess.reset(); //delete object and make pointer invalid 113 113 this->myData->clear(); //clean list 114 114 … … 126 126 // Kill the process if requested 127 127 void Converter::terminateCurrProcess(){ 128 this->myProcess->kill(); 129 this->processHasKilled=true; 130 this->myLogger->writeString("Received signal to kill current OniSplit operation (user requested)."); 128 if(this->myProcess != nullptr){ 129 this->myProcess->kill(); 130 this->myProcess.reset(); 131 } 132 133 LOG_INFO << "Received signal to kill current OniSplit operation (user requested)."; 131 134 } -
s10k/Vago/converter.h
r1047 r1093 14 14 Q_OBJECT 15 15 public: 16 Converter(QString AppDir, Logger *myLogger,QStringList *myData);16 Converter(QString AppDir, QStringList *myData); 17 17 18 18 #ifdef Q_OS_WIN 19 Converter(QString AppDir, Logger *myLogger,QStringList *myData, QWinTaskbarProgress *win7TaskBarProgress);19 Converter(QString AppDir, QStringList *myData, QWinTaskbarProgress *win7TaskBarProgress); 20 20 #endif 21 21 private: 22 22 QString AppDir; 23 Logger *myLogger;24 23 QStringList *myData; 25 QProcess *myProcess; 26 bool processHasKilled; 24 std::unique_ptr<QProcess> myProcess; 27 25 #ifdef Q_OS_WIN 28 26 QWinTaskbarProgress *win7TaskBarProgress = nullptr; -
s10k/Vago/libs/DropTableWidget/droptablewidget.cpp
r1061 r1093 146 146 147 147 int idxFileName=fileCommand.indexOf(this->item(row,0)->text()); //Search first for the file name 148 int fileAbsoluteStartIdx=Util::indexOfBackward(fileCommand,"\"",idxFileName); 148 149 int fileAbsoluteStartIdx=fileCommand.lastIndexOf("\"",idxFileName); 149 150 150 151 fileCommand.remove(0,fileAbsoluteStartIdx); 151 int fileAbsoluteEndIdx=fileCommand.indexOf('"',1); //1 to find the end quoate and not the start152 152 153 return fileCommand.remove(fileAbsoluteEndIdx,(fileCommand.size()-1)-fileAbsoluteEndIdx); 153 int fileAbsoluteEndIdx=fileCommand.indexOf('"',1); //1 to find the end quote and not the start 154 155 return fileCommand.remove(fileAbsoluteEndIdx+1,(fileCommand.size()-1)-fileAbsoluteEndIdx); 154 156 } 155 157 … … 161 163 command.remove(fileAbsoluteEndIdx,command.size()-1); 162 164 163 int fileAbsoluteStartIdx= Util::indexOfBackward(command,"\"",command.size()-1)+1;165 int fileAbsoluteStartIdx=command.lastIndexOf("\"",command.size()-1)+1; 164 166 165 167 return command.remove(0,fileAbsoluteStartIdx); -
s10k/Vago/mainwindow.cpp
r1061 r1093 8 8 ui(new Ui::MainWindow) 9 9 { 10 // We use this appender because it is the native way to have \r\n in windows in plog library 11 // example: https://github.com/SergiusTheBest/plog/blob/master/samples/NativeEOL/Main.cpp 12 static plog::RollingFileAppender<plog::TxtFormatter, plog::NativeEOLConverter<>> fileAppender 13 (QSTR_TO_CSTR(Util::FileSystem::getAppPath() + "/" + GlobalVars::AppLogName), 1024*5 /* 5 Mb max log size */, 3); 14 plog::init(plog::info, &fileAppender); 15 10 16 ui->setupUi(this); 11 17 12 this->myLogger = new Logger(UtilVago::getAppPath(), GlobalVars::AppLogName); //start logger 13 14 this->myLogger->writeString("Detected AppDir: "+UtilVago::getAppPath()); 15 this->myLogger->writeString("True app dir: "+QDir::currentPath()); 18 LOG_INFO << "Detected AppDir: " + UtilVago::getAppPath(); 19 LOG_INFO << "True app dir: "+QDir::currentPath(); 16 20 17 21 setVagoWindowTitle(); 18 22 19 23 if(!QFile::exists(UtilVago::getOniSplitExecutableAbsolutePath())){ 20 UtilVago::showAndLogErrorPopUp( this->myLogger,"OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit.");24 UtilVago::showAndLogErrorPopUp("OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit."); 21 25 exit(1); 22 26 } 23 27 24 28 if(!QFile::exists(UtilVago::getXmlToolsExecutableAbsolutePath())){ 25 UtilVago::showAndLogErrorPopUp( this->myLogger,"XmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit.");29 UtilVago::showAndLogErrorPopUp("XmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it the Vago's tools folder. \n\nProgram will now exit."); 26 30 exit(1); 27 31 } … … 41 45 if(!this->vagoSettings->contains("AeFolder")){ 42 46 43 Util:: showPopUp("Seems it's the first time you are executing Vago. \n\nPlease input your Anniversary Edition (AE) Folder.");44 QString aefolder=Util:: normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder..."));47 Util::Dialogs::showInfo("Seems it's the first time you are executing Vago. \n\nPlease input your Anniversary Edition (AE) Folder."); 48 QString aefolder=Util::FileSystem::normalizePath(QFileDialog::getExistingDirectory(this,"Choose Anniversary Edition (AE) folder...")); 45 49 46 50 if(aefolder.isEmpty()){ 47 UtilVago::showAndLogErrorPopUp( this->myLogger,"AE folder is mandatory. Application will now exit.");51 UtilVago::showAndLogErrorPopUp("AE folder is mandatory. Application will now exit."); 48 52 exit(1); 49 53 } 50 54 51 55 if(!aefolder.endsWith("AE")){ 52 Util:: showWarningPopUp("Seems the folder you selected isn't called 'AE'. \n\nIf you run in any problems you can always change it in Vago preferences window.");56 Util::Dialogs::showWarning("Seems the folder you selected isn't called 'AE'. \n\nIf you run in any problems you can always change it in Vago preferences window."); 53 57 } 54 58 … … 177 181 { 178 182 delete ui; 179 this->myLogger->writeString("Application Exited.");183 LOG_INFO << "Application Exited."; 180 184 } 181 185 … … 207 211 208 212 //Create a thread for do the conversion in background 209 this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger,&this->listToProccess, this->win7TaskBarProgress);213 this->myConverter = new Converter(UtilVago::getAppPath(), &this->listToProccess, this->win7TaskBarProgress); 210 214 #else 211 this->myConverter = new Converter(UtilVago::getAppPath(), this->myLogger,&this->listToProccess);215 this->myConverter = new Converter(UtilVago::getAppPath(), &this->listToProccess); 212 216 #endif 213 217 214 218 connectSlots(); 215 219 216 this->myLogger->writeString("Application started.");220 LOG_INFO << "Application started."; 217 221 218 222 this->applicationIsFullyLoaded = true; … … 221 225 222 226 if(!lastSavedProject.isEmpty() && this->vagoSettings->value("AskToOpenLastProject").toBool()){ 223 if(Util:: showQuestionPopUp(this,"Do you want to load latest project?\n\nLatest project was '" + Util::cutNameWithoutBackSlash(lastSavedProject) + "'.")){227 if(Util::Dialogs::showQuestion(this,"Do you want to load latest project?\n\nLatest project was '" + Util::FileSystem::cutNameWithoutBackSlash(lastSavedProject) + "'.")){ 224 228 loadProjectState(lastSavedProject); 225 229 } … … 243 247 { 244 248 // it deletes itself once closed 245 WizardFactory<PackageWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings , this->myLogger);249 WizardFactory<PackageWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings); 246 250 } 247 251 … … 249 253 { 250 254 // it deletes itself once closed 251 WizardFactory<SoundWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, this->myLogger,&this->commandMap);255 WizardFactory<SoundWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings, &this->commandMap); 252 256 } 253 257 … … 255 259 { 256 260 // it deletes itself once closed 257 WizardFactory<BGImageWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings , this->myLogger);261 WizardFactory<BGImageWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings); 258 262 } 259 263 … … 261 265 { 262 266 // it deletes itself once closed 263 WizardFactory<WmWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings , this->myLogger);267 WizardFactory<WmWizard>::startInstance(UtilVago::getAppPath(), this->workspaceWizardsLocation, this->vagoSettings); 264 268 } 265 269 … … 280 284 281 285 if(!QProcess::startDetached(this->AeLocation+"/"+GlobalVars::OniExe,arguments,this->AeLocation)){ 282 showErrStatusMessage("Oni could not be started!");286 Util::StatusBar::showError(ui->statusBar, "Oni could not be started!"); 283 287 } 284 288 } … … 289 293 290 294 if(!QDesktopServices::openUrl("file:///"+this->AeLocation+"/AEInstaller/bin/AEInstaller2.jar")){ 291 showErrStatusMessage("Could not start AE Installer!");295 Util::StatusBar::showError(ui->statusBar, "Could not start AE Installer!"); 292 296 } 293 297 } … … 303 307 //We pass no parent because we want to have an independent window for XmlToolsInterface, 304 308 //so we can minimize it or maximize indepently from the MainWindow 305 XmlToolsInterface *xmlToolsWindow = new XmlToolsInterface( this->myLogger);309 XmlToolsInterface *xmlToolsWindow = new XmlToolsInterface(); 306 310 xmlToolsWindow->show(); //it destroys itself when finished. 307 311 } … … 309 313 void MainWindow::on_tbAbortConversion_clicked() 310 314 { 311 if(Util:: showQuestionPopUp(this,"Are you sure you want to abort the current conversion?")){315 if(Util::Dialogs::showQuestion(this,"Are you sure you want to abort the current conversion?")){ 312 316 emit terminateCurrProcess(); 313 317 } … … 324 328 } 325 329 330 void MainWindow::on_cbSpecificFilesLevels_toggled(bool checked) 331 { 332 ui->leSpecificFilesLevels->setEnabled(checked); 333 } 334 326 335 void MainWindow::on_cbWithAnimation_toggled(bool checked) 327 336 { 328 337 ui->leAnimationName->setEnabled(checked); 329 }330 331 void MainWindow::on_cbSpecificFilesLevels_toggled(bool checked)332 {333 ui->leSpecificFilesLevels->setEnabled(checked);334 338 } 335 339 … … 357 361 358 362 if(newVersion!=GlobalVars::AppVersion){ 359 Util:: showRichPopUp("There's a new version of Vago! (v"+newVersion+")<br/><br/>"+360 "You can download it <a href='"+GlobalVars::VagoWebUrl+"'>here</a>.");363 Util::Dialogs::showRichInfo("There's a new version of Vago! (v"+newVersion+")<br/><br/>"+ 364 "You can download it <a href='"+GlobalVars::VagoWebUrl+"'>here</a>."); 361 365 } 362 366 else{ 363 Util:: showPopUp("You are using last version.");367 Util::Dialogs::showInfo("You are using last version."); 364 368 } 365 369 } 366 370 else{ 367 UtilVago::showAndLogErrorPopUp( this->myLogger,"An error occurred checking last version:\n\n"+result->errorString());371 UtilVago::showAndLogErrorPopUp("An error occurred checking last version:\n\n"+result->errorString()); 368 372 } 369 373 result->deleteLater(); … … 393 397 { 394 398 if(QString::compare(ui->cbFromLevels->currentText(),"ONI FILES",Qt::CaseSensitive)==0 && QString::compare(ui->cbToLevels->currentText(),"DAT",Qt::CaseSensitive)==0){ //CaseSensitive is faster) 395 addFilesSource(ui->twSourcesLevels,Util:: multipleDirDialog("Choose folders with ONIs..."));399 addFilesSource(ui->twSourcesLevels,Util::Dialogs::multipleDirSelection("Choose folders with ONIs...")); 396 400 } 397 401 else{ … … 415 419 myOutputFolder+="/"+QString(fromTo).replace(" / ","_").replace(" > "," - "); 416 420 } 417 return Util:: insertQuotes(myOutputFolder+"/");421 return Util::String::insertQuotes(myOutputFolder+"/"); 418 422 } 419 423 … … 428 432 to = QString(fromTo).remove(0,fromTo.lastIndexOf("> ")+2); //+2 to start after "> " 429 433 430 //Pre-processing (check if the files/folders received are valid), e.g. check for ONI ->DAT if are only given folders and not files434 //Pre-processing (check if the files/folders received are valid), e.g. check for ONI FILES->DAT if are only given folders and not files 431 435 if(from=="ONI FILES" && to=="DAT"){ 432 436 //check if it's a folder 433 for each(QString myFile,files){437 for(const QString &myFile : files){ 434 438 if(!QDir(myFile).exists()){ 435 showErrStatusMessage("Only folders are allowed for this operation.");439 Util::StatusBar::showError(ui->statusBar, "Only folders are allowed for this operation."); 436 440 return; 437 441 } … … 440 444 } 441 445 else{ 442 foreach(QString myFile, files){ 446 for(const QString &myFile : files){ 447 443 448 //check if it's a file 444 449 if(QDir(myFile).exists()){ 445 showErrStatusMessage("Only files are allowed for this operation."); 450 Util::StatusBar::showError(ui->statusBar, "Only files are allowed for this operation."); 451 return; 452 } 453 454 // Check if the given files have the expected extensions 455 QFileInfo fileInfo(myFile); 456 457 QStringList expectedExtensions; 458 459 bool extensionIsValid = false; 460 461 if( 462 from == "DAT / TXMP ONI" || 463 from == "DAT / SNDD ONI" || 464 from == "DAT / SUBT ONI" 465 ){ 466 expectedExtensions << "DAT" << "ONI"; 467 } 468 else if(from == "TGA / DDS / PNG / JPG"){ 469 expectedExtensions << "TGA" << "DDS" << "PNG" << "JPG"; 470 } 471 else if( 472 from == "TRAM ONI" || 473 from == "TRBS / ONCC ONI" || 474 from == "M3GM ONI" || 475 from == "ONWC ONI" || 476 from == "OBAN ONI (cam)" || 477 from == "AKEV ONI" 478 ){ 479 expectedExtensions << "ONI"; 480 } 481 else if(from == "TRBS XML" || from == "MASTER XML"){ 482 expectedExtensions << "XML"; 483 } 484 else if(from == "TRBS DAE"){ 485 expectedExtensions << "DAE"; 486 } 487 else if(from == "FILM DAT"){ 488 expectedExtensions << "DAT"; 489 } 490 else if(from == "WAV / AIF"){ 491 expectedExtensions << "WAV" << "AIF"; 492 } 493 else{ 494 expectedExtensions << from; 495 } 496 497 for(const QString &currExpectedExtension : expectedExtensions){ 498 if(fileInfo.suffix().toUpper() == currExpectedExtension){ 499 extensionIsValid = true; 500 break; 501 } 502 } 503 504 if(!extensionIsValid){ 505 QString errorMsg = "Can't add the file '" + fileInfo.fileName() + "'. It isn't a " + expectedExtensions.join(" or ") + " file."; 506 Util::Dialogs::showError(errorMsg); 507 Util::StatusBar::showError(ui->statusBar, errorMsg); 446 508 return; 447 509 } … … 455 517 456 518 //if folder doesn't exist onisplit will create it for us :) 457 for each(QString currentFile,files){458 459 currentFile=Util:: normalizeAndQuote(currentFile); //insert quotes ("") in file519 for(QString currentFile : files){ 520 521 currentFile=Util::FileSystem::normalizeAndQuote(currentFile); //insert quotes ("") in file 460 522 461 523 if(lastFileName.isEmpty()){ //Optimization: all commands are the same for each file, just replace the filename … … 466 528 return; //stop adding files 467 529 } 468 currentFile=Util:: cutName(currentFile);530 currentFile=Util::FileSystem::cutName(currentFile); 469 531 }else{ //one parsing was already made just replace the filename by the old one in the command 470 532 471 currentFile=Util:: cutName(currentFile);533 currentFile=Util::FileSystem::cutName(currentFile); 472 534 473 535 command.replace(lastFileName,currentFile,Qt::CaseSensitive); //case sentive is faster … … 503 565 if(ui->gbTextures->isEnabled()){ //faster than compare strings (if is DAT/ONI) 504 566 505 if(ui->cbMipMapsTextures->is Checked()){567 if(ui->cbMipMapsTextures->isEnabled() && ui->cbMipMapsTextures->isChecked()){ 506 568 command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbMipMapsTextures->text()); 507 569 } 508 570 509 if(ui->cbNoUwrap->is Checked()){571 if(ui->cbNoUwrap->isEnabled() && ui->cbNoUwrap->isChecked()){ 510 572 command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNoUwrap->text()); 511 573 } 512 574 513 if(ui->cbNoVwrap->is Checked()){575 if(ui->cbNoVwrap->isEnabled() && ui->cbNoVwrap->isChecked()){ 514 576 command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNoVwrap->text()); 515 577 } 516 578 517 if(ui->cbLarge->is Checked()){579 if(ui->cbLarge->isEnabled() && ui->cbLarge->isChecked()){ 518 580 command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbLarge->text()); 519 581 } … … 521 583 command+=" "+this->commandMap.value(tabTitle+"->"+getTextureRBCheckedTypeTexture()->text()); 522 584 523 if(ui->cbEnvMap->is Checked()){585 if(ui->cbEnvMap->isEnabled() && ui->cbEnvMap->isChecked()){ 524 586 if(ui->leEnvMapTexture->text().isEmpty()){ 525 showErrStatusMessage("Checkbox '"+ui->cbEnvMap->text()+"' is selected. The name texture name cannot be empty.");587 Util::StatusBar::showError(ui->statusBar, "Checkbox '"+ui->cbEnvMap->text()+"' is selected. The name texture name cannot be empty."); 526 588 return ""; 527 589 } … … 535 597 QString MainWindow::fileParsingCharacters(QString tabTitle, QString myOutputFolder, QString from, QString to , QString file){ 536 598 537 QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder + " " + file ; 538 539 540 if(ui->cbCellShading->isChecked()){ 541 command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbCellShading->text()); 542 } 543 544 if(ui->cbNormals->isChecked()){ 545 command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbNormals->text()); 546 } 547 548 if(ui->cbWithTRBS_ONCC->isChecked()){ 599 QString command=this->commandMap.value(tabTitle + "->" + from + "->" + to) + " " + myOutputFolder + " " + file ; 600 601 602 if(ui->cbCellShading->isEnabled() && ui->cbCellShading->isChecked()){ 603 command+=" "+this->commandMap.value(tabTitle + "->" + ui->cbCellShading->text()); 604 } 605 606 if(ui->cbNormals->isEnabled() && ui->cbNormals->isChecked()){ 607 command+=" "+this->commandMap.value(tabTitle + "->" + ui->cbNormals->text()); 608 } 609 610 if(ui->cbStandingPose->isEnabled() && ui->cbStandingPose->isChecked()){ 611 command+=" "+this->commandMap.value(tabTitle + "->" + ui->cbStandingPose->text()); 612 } 613 614 if(ui->cbWithTRBS_ONCC->isEnabled() && ui->cbWithTRBS_ONCC->isChecked()){ 549 615 if(ui->leTRBS_ONCC->text().isEmpty()){ 550 showErrStatusMessage("Checkbox '"+ui->cbWithTRBS_ONCC->text()+"' is selected. The name cannot be empty.");616 Util::StatusBar::showError(ui->statusBar, "Checkbox '" + ui->cbWithTRBS_ONCC->text() + "' is selected. The name cannot be empty."); 551 617 return ""; 552 618 } 553 619 554 command+= " "+this->commandMap.value(tabTitle+"->"+ui->cbWithTRBS_ONCC->text())+Util::normalizeAndQuote(ui->leTRBS_ONCC->text());620 command+= " " + this->commandMap.value(tabTitle + "->" + ui->cbWithTRBS_ONCC->text()) + Util::FileSystem::normalizeAndQuote(ui->leTRBS_ONCC->text()); 555 621 } 556 622 … … 563 629 QString command=this->commandMap.value(tabTitle+"->"+from+"->"+to)+" "+myOutputFolder; 564 630 565 if(ui->cbTexture->is Checked()){631 if(ui->cbTexture->isEnabled() && ui->cbTexture->isChecked()){ 566 632 if(ui->leTextureName->text().isEmpty()){ 567 showErrStatusMessage("Checkbox '"+ui->cbTexture->text()+"' is selected. The file source cannot be empty.");633 Util::StatusBar::showError(ui->statusBar, "Checkbox '"+ui->cbTexture->text()+"' is selected. The file source cannot be empty."); 568 634 return ""; 569 635 } 570 636 command+=" "+this->commandMap.value(tabTitle+"->"+ui->cbTexture->text()) + ui->leTextureName->text(); 571 637 } 572 else if(ui->cbWithAnimation->is Checked()){638 else if(ui->cbWithAnimation->isEnabled() && ui->cbWithAnimation->isChecked()){ 573 639 if(ui->leAnimationName->text().isEmpty()){ 574 showErrStatusMessage("Checkbox '"+ui->cbWithAnimation->text()+"' is selected. The file source cannot be empty.");640 Util::StatusBar::showError(ui->statusBar, "Checkbox '"+ui->cbWithAnimation->text()+"' is selected. The file source cannot be empty."); 575 641 return ""; 576 642 } 577 command+=" "+Util:: normalizeAndQuote(ui->leAnimationName->text()) + " " + this->commandMap.value(tabTitle+"->"+ui->cbWithAnimation->text()) + file;643 command+=" "+Util::FileSystem::normalizeAndQuote(ui->leAnimationName->text()) + " " + this->commandMap.value(tabTitle+"->"+ui->cbWithAnimation->text()) + file; 578 644 return command; 579 645 } … … 594 660 command=this->commandMap.value(tabTitle+"->"+from+"->"+to); 595 661 596 if(ui->cbSpecificFilesLevels->is Checked()){662 if(ui->cbSpecificFilesLevels->isEnabled() && ui->cbSpecificFilesLevels->isChecked()){ 597 663 598 664 if(ui->leSpecificFilesLevels->text().isEmpty()){ 599 showErrStatusMessage("Checkbox '"+ui->cbSpecificFilesLevels->text()+"' is selected. The files pattern cannot be empty.");665 Util::StatusBar::showError(ui->statusBar, "Checkbox '"+ui->cbSpecificFilesLevels->text()+"' is selected. The files pattern cannot be empty."); 600 666 return ""; 601 667 } … … 605 671 606 672 if(from=="DAT" && to=="ONI FILES"){ // extract files to a subdir with the files name ex: level0_Final 607 command += " " + myOutputFolder.insert(myOutputFolder.size()-2,QString(Util:: cutName(file)).replace(".dat","")) + " " + file;673 command += " " + myOutputFolder.insert(myOutputFolder.size()-2,QString(Util::FileSystem::cutName(file)).replace(".dat","")) + " " + file; 608 674 } 609 675 else{ … … 620 686 } 621 687 622 if(ui->cbDatLevels->is Checked()){688 if(ui->cbDatLevels->isEnabled() && ui->cbDatLevels->isChecked()){ 623 689 if(ui->leTargetDatLevels->text().isEmpty()){ 624 showErrStatusMessage("Checkbox '"+ui->cbDatLevels->text()+"' is selected. The name cannot be empty.");690 Util::StatusBar::showError(ui->statusBar, "Checkbox '"+ui->cbDatLevels->text()+"' is selected. The name cannot be empty."); 625 691 return ""; 626 692 } … … 632 698 else{ 633 699 if(from=="ONI FILES"){ 634 datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util:: cutName(file).remove("/")+".dat"); //if none iputted set the same name of input file700 datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::FileSystem::cutName(file).remove("/")+".dat"); //if none iputted set the same name of input file 635 701 } 636 702 else if(from=="MASTER XML"){ 637 datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util:: cutName(file).remove("/").replace(".xml",".dat",Qt::CaseInsensitive)); //if none iputted set the same name of input file703 datName=QString(myOutputFolder).insert(myOutputFolder.size()-1,Util::FileSystem::cutName(file).remove("/").replace(".xml",".dat",Qt::CaseInsensitive)); //if none iputted set the same name of input file 638 704 } 639 705 } 640 706 if(from=="ONI FILES"){ 641 if(ui->actionWindows->is Checked()){ //is target plataform select windows?707 if(ui->actionWindows->isEnabled() && ui->actionWindows->isChecked()){ //is target plataform select windows? 642 708 return command=this->commandMap.value(tabTitle+"->"+from+"->"+to+"(PC)")+" "+ file + " "+datName; 643 709 } … … 647 713 } 648 714 else if(from=="MASTER XML"){ 649 if(ui->actionWindows->is Checked()){ //is target plataform select windows?715 if(ui->actionWindows->isEnabled() && ui->actionWindows->isChecked()){ //is target plataform select windows? 650 716 command+=this->commandMap.value(tabTitle+"->ONI FILES->"+to+"(PC)")+" "+myOutputFolder+" "+datName; //add second command 651 717 } … … 656 722 } 657 723 658 if(ui->cbBnvLevels->is Checked()){659 660 if(ui->leBnvLevels-> text().isEmpty()){661 showErrStatusMessage("Checkbox '"+ui->cbBnvLevels->text()+"' is selected. The BNV file cannot be empty.");724 if(ui->cbBnvLevels->isEnabled() && ui->cbBnvLevels->isChecked()){ 725 726 if(ui->leBnvLevels->isEnabled() && ui->leBnvLevels->text().isEmpty()){ 727 Util::StatusBar::showError(ui->statusBar, "Checkbox '"+ui->cbBnvLevels->text()+"' is selected. The BNV file cannot be empty."); 662 728 return ""; 663 729 } 664 command+=" "+Util:: normalizeAndQuote(ui->leBnvLevels->text());665 } 666 667 if(ui->cbAdditionalSourcesLevels->is Checked()){730 command+=" "+Util::FileSystem::normalizeAndQuote(ui->leBnvLevels->text()); 731 } 732 733 if(ui->cbAdditionalSourcesLevels->isEnabled() && ui->cbAdditionalSourcesLevels->isChecked()){ 668 734 669 735 if(ui->leAdditSourcesLevels->text().isEmpty()){ 670 showErrStatusMessage("Checkbox '"+ui->cbAdditionalSourcesLevels->text()+"' is selected. The source files cannot be empty.");736 Util::StatusBar::showError(ui->statusBar, "Checkbox '"+ui->cbAdditionalSourcesLevels->text()+"' is selected. The source files cannot be empty."); 671 737 return ""; 672 738 } … … 680 746 nextIndex=additionalFiles.indexOf(";",currentIndex+1); 681 747 682 command += " "+Util:: normalizeAndQuote(additionalFiles.mid(currentIndex,(nextIndex-currentIndex)));748 command += " "+Util::FileSystem::normalizeAndQuote(additionalFiles.mid(currentIndex,(nextIndex-currentIndex))); 683 749 684 750 if(nextIndex==-1){ //we got to the end, stop parsing … … 689 755 } 690 756 691 if(ui->cbGridsLevels->is Checked()){692 command+=GlobalVars::OniSplitProcSeparator+this->commandMap.value(tabTitle+"->"+ui->cbGridsLevels->text())+" "+Util:: normalizeAndQuote(ui->leBnvLevels->text())+" "+file+" -out:"+myOutputFolder;757 if(ui->cbGridsLevels->isEnabled() && ui->cbGridsLevels->isChecked()){ 758 command+=GlobalVars::OniSplitProcSeparator+this->commandMap.value(tabTitle+"->"+ui->cbGridsLevels->text())+" "+Util::FileSystem::normalizeAndQuote(ui->leBnvLevels->text())+" "+file+" -out:"+myOutputFolder; 693 759 } 694 760 … … 743 809 744 810 if(!ready){ 745 showErrStatusMessage("Please add sources to convert first.");811 Util::StatusBar::showError(ui->statusBar, "Please add sources to convert first."); 746 812 return; 747 813 } 748 814 749 815 if(this->myBar->isVisible()){ 750 Util:: showErrorPopUp("Another conversion is progress. Please wait until it finishes.");816 Util::Dialogs::showError("Another conversion is progress. Please wait until it finishes."); 751 817 return; 752 818 } … … 782 848 if(numErrors>1){ 783 849 UtilVago::showErrorPopUpLogButton(result+"\n This is the last of "+sNumErrors+" errors."); 784 showErrStatusMessage("Something gone wrong. Check log file ("+sNumErrors+" errors).");850 Util::StatusBar::showError(ui->statusBar, "Something gone wrong. Check log file ("+sNumErrors+" errors)."); 785 851 } 786 852 else{ 787 853 UtilVago::showErrorPopUpLogButton(result); 788 showErrStatusMessage("Something gone wrong. Check log file.");854 Util::StatusBar::showError(ui->statusBar, "Something gone wrong. Check log file."); 789 855 } 790 856 } 791 857 else{ 792 showSuccessStatusMessage("Everything went well!");858 Util::StatusBar::showSuccess(ui->statusBar, "Everything went well!"); 793 859 } 794 860 } … … 798 864 ui->tbAbortConversion->hide(); 799 865 800 showErrStatusMessage("Conversion was aborted."); 801 } 802 803 void MainWindow::showErrStatusMessage(QString message){ 804 805 QPalette myPalete = QPalette(); 806 myPalete.setColor( QPalette::WindowText, QColor(255,0,0)); 807 statusBar()->setPalette( myPalete ); 808 ui->statusBar->showMessage(message,10000); //display by 10 seconds 809 810 } 811 812 void MainWindow::showSuccessStatusMessage(QString message){ 813 814 QPalette myPalete = QPalette(); 815 myPalete.setColor( QPalette::WindowText, QColor(0,150,0)); 816 statusBar()->setPalette( myPalete ); 817 ui->statusBar->showMessage(message,10000); //display by 10 seconds 818 866 Util::StatusBar::showError(ui->statusBar, "Conversion was aborted."); 819 867 } 820 868 … … 865 913 this->commandMap.insert("characters->"+ui->cbCellShading->text(),"-cel"); 866 914 this->commandMap.insert("characters->"+ui->cbNormals->text(),"-normals"); 915 this->commandMap.insert("characters->"+ui->cbStandingPose->text(),"-noanim"); 867 916 //Possible Combinations 868 917 this->commandMap.insertMulti("characters->TRAM ONI","XML / XML & DAE"); … … 880 929 this->commandMap.insert("objects->OBAN ONI (cam)->DAE","-extract:dae"); 881 930 this->commandMap.insert("objects->OBJ->M3GM ONI","-create:m3gm"); 882 //###################### Characters Options931 //######################Objects Options 883 932 this->commandMap.insert("objects->"+ui->cbTexture->text(),"-tex:"); 884 933 this->commandMap.insert("objects->"+ui->cbWithAnimation->text(),"-geom:"); … … 967 1016 identifier = ui->tabWidget->tabText(TexturesTabIndex); 968 1017 969 //Options are only used for DAT/ ONI -> Image970 if(QString::compare(arg1,"DAT / ONI",Qt::CaseSensitive)==0){ //case sensitive is faster1018 //Options are only used for DAT/TXMP ONI -> Image 1019 if(QString::compare(arg1,"DAT / TXMP ONI",Qt::CaseSensitive)==0){ //case sensitive is faster 971 1020 ui->gbTextures->setEnabled(false); 972 1021 } 973 1022 else{ 974 1023 ui->gbTextures->setEnabled(true); 1024 ui->leEnvMapTexture->setEnabled(ui->cbEnvMap->isChecked()); 975 1025 } 976 1026 } … … 979 1029 980 1030 ui->cbWithTRBS_ONCC->setEnabled(false); 981 ui->cbWithTRBS_ONCC->setChecked(false);982 1031 ui->cbCellShading->setEnabled(false); 983 ui->cbCellShading->setChecked(false);984 1032 ui->cbNormals->setEnabled(false); 985 ui->cbNormals->setChecked(false); 986 //#error add drag and drop to Extract TRAM with TRBS/ONCC 1033 ui->cbStandingPose->setEnabled(false); 1034 ui->leTRBS_ONCC->setEnabled(false); 1035 1036 //#error add drag and drop to Extract TRAM with TRBS/ONCC 987 1037 if(QString::compare(arg1,"TRAM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster 988 1038 ui->cbWithTRBS_ONCC->setEnabled(true); 1039 ui->leTRBS_ONCC->setEnabled(ui->cbWithTRBS_ONCC->isChecked()); 989 1040 } 990 1041 else if(QString::compare(arg1,"TRBS DAE",Qt::CaseSensitive)==0){ … … 992 1043 ui->cbCellShading->setEnabled(true); 993 1044 } 1045 else if(QString::compare(arg1,"TRBS / ONCC ONI",Qt::CaseSensitive)==0){ 1046 ui->cbStandingPose->setEnabled(true); 1047 } 994 1048 995 1049 } … … 998 1052 999 1053 ui->cbTexture->setEnabled(false); 1000 ui-> cbTexture->setChecked(false);1054 ui->leTextureName->setEnabled(false); 1001 1055 ui->cbWithAnimation->setEnabled(false); 1002 ui-> cbWithAnimation->setChecked(false);1056 ui->leAnimationName->setEnabled(false); 1003 1057 1004 1058 if(QString::compare(arg1,"M3GM ONI",Qt::CaseSensitive)==0){ //case sensitive is faster 1005 1059 ui->cbWithAnimation->setEnabled(true); 1060 ui->leAnimationName->setEnabled(ui->cbWithAnimation->isChecked()); 1006 1061 } 1007 1062 else if(QString::compare(arg1,"OBJ",Qt::CaseSensitive)==0){ 1008 1063 ui->cbTexture->setEnabled(true); 1064 ui->leTextureName->setEnabled(ui->cbTexture->isChecked()); 1009 1065 } 1010 1066 } … … 1013 1069 1014 1070 ui->cbSpecificFilesLevels->setEnabled(false); 1015 ui-> cbSpecificFilesLevels->setChecked(false);1071 ui->leSpecificFilesLevels->setEnabled(false); 1016 1072 ui->cbDatLevels->setEnabled(false); 1017 ui-> cbDatLevels->setChecked(false);1073 ui->leTargetDatLevels->setEnabled(false); 1018 1074 ui->cbBnvLevels->setEnabled(false); 1019 ui-> cbBnvLevels->setChecked(false);1075 ui->leBnvLevels->setEnabled(false); 1020 1076 ui->cbAdditionalSourcesLevels->setEnabled(false); 1021 ui-> cbAdditionalSourcesLevels->setChecked(false);1077 ui->leAdditSourcesLevels->setEnabled(false); 1022 1078 ui->cbGridsLevels->setEnabled(false); 1023 ui->cbGridsLevels->setChecked(false);1024 1079 1025 1080 if(arg1=="DAT"){ //case sensitive is faster 1026 1081 ui->cbSpecificFilesLevels->setEnabled(true); 1082 ui->leSpecificFilesLevels->setEnabled( ui->cbSpecificFilesLevels->isChecked()); 1027 1083 } 1028 1084 else if(arg1=="ONI FILES"){ //case sensitive is faster 1029 1085 ui->cbDatLevels->setEnabled(true); 1086 ui->leTargetDatLevels->setEnabled(ui->cbDatLevels->isChecked()); 1030 1087 } 1031 1088 else if(arg1=="DAE"){ 1032 1089 ui->cbBnvLevels->setEnabled(true); 1090 ui->leBnvLevels->setEnabled(ui->cbBnvLevels->isChecked()); 1033 1091 ui->cbAdditionalSourcesLevels->setEnabled(true); 1092 ui->leAdditSourcesLevels->setEnabled(ui->cbAdditionalSourcesLevels->isChecked()); 1034 1093 } 1035 1094 } … … 1132 1191 1133 1192 if(size==0){ 1134 Util:: showPopUp("Select a row first.");1193 Util::Dialogs::showInfo("Select a row first."); 1135 1194 return; 1136 1195 } … … 1146 1205 1147 1206 1148 if(Util:: showQuestionPopUp(this,"Are you sure you want to delete the selected rows?",defaultButton)){1207 if(Util::Dialogs::showQuestion(this,"Are you sure you want to delete the selected rows?",defaultButton)){ 1149 1208 for(int i=0; i<size; i++){ 1150 1209 //myTable->removeRow(myTable->selectedItems().at(size-i-1)->row()); … … 1161 1220 1162 1221 if(myTable->rowCount()==0){ 1163 Util:: showPopUp("Nothing to clear.");1222 Util::Dialogs::showInfo("Nothing to clear."); 1164 1223 return; 1165 1224 } … … 1174 1233 #endif 1175 1234 1176 if(Util:: showQuestionPopUp(this,"Are you sure you want to clear the content?",defaultButton)){1235 if(Util::Dialogs::showQuestion(this,"Are you sure you want to clear the content?",defaultButton)){ 1177 1236 clearTableNoPrompt(myTable); 1178 1237 updateItemsLoaded(myTable); … … 1210 1269 QMessageBox::StandardButton MainWindow::askToSaveCurrentProject(){ 1211 1270 QMessageBox::StandardButton result = 1212 Util:: showQuestionPopUpWithCancel(this,"There are unsaved changes. Do you want to save the current project?", QMessageBox::StandardButton::Yes);1271 Util::Dialogs::showQuestionWithCancel(this,"There are unsaved changes. Do you want to save the current project?", QMessageBox::StandardButton::Yes); 1213 1272 1214 1273 if(result == QMessageBox::StandardButton::Yes){ … … 1284 1343 QString result=myProcess.readAllStandardOutput(); 1285 1344 1286 Util:: showPopUp("This Vago version was built with base in OniSplit version "+GlobalVars::BuiltOniSplitVersion+"\n\nCurrent version is:\n"+result.trimmed());1345 Util::Dialogs::showInfo("This Vago version was built with base in OniSplit version "+GlobalVars::BuiltOniSplitVersion+"\n\nCurrent version is:\n"+result.trimmed()); 1287 1346 } 1288 1347 … … 1295 1354 QString result=myProcess.readLine(); 1296 1355 1297 Util:: showPopUp("This Vago version was built with base in XmlTools version "+GlobalVars::BuiltXmlToolsVersion+"\n\nCurrent version is:\n"+result.trimmed());1356 Util::Dialogs::showInfo("This Vago version was built with base in XmlTools version "+GlobalVars::BuiltXmlToolsVersion+"\n\nCurrent version is:\n"+result.trimmed()); 1298 1357 } 1299 1358 … … 1335 1394 this->outputFolder=this->workspaceLocation; 1336 1395 ui->tbOpenFolder->setToolTip("Open Vago workspace"); 1337 showSuccessStatusMessage("Vago is now outputting the NEW items for Vago workspace.");1396 Util::StatusBar::showSuccess(ui->statusBar, "Vago is now outputting the NEW items for Vago workspace."); 1338 1397 } 1339 1398 … … 1341 1400 { 1342 1401 QString newDir=QFileDialog::getExistingDirectory(this,"Choose the folder for output NEW files directly...",this->AeLocation+"/GameDataFolder"); 1343 newDir=Util:: normalizePath(newDir);1402 newDir=Util::FileSystem::normalizePath(newDir); 1344 1403 1345 1404 if(newDir.isEmpty()){ … … 1358 1417 this->outputFolder=newDir; 1359 1418 1360 QString newDirName=Util:: cutName(newDir);1419 QString newDirName=Util::FileSystem::cutName(newDir); 1361 1420 ui->tbOpenFolder->setToolTip("Open "+newDirName+" output folder"); 1362 showSuccessStatusMessage("Vago is now outputting the NEW items for "+newDirName+".");1421 Util::StatusBar::showSuccess(ui->statusBar, "Vago is now outputting the NEW items for "+newDirName+"."); 1363 1422 } 1364 1423 … … 1499 1558 QList<int> selectedRows = QList<int>(); 1500 1559 1501 for each(QModelIndex rowItem,myTable->selectionModel()->selectedRows()){1560 for(const QModelIndex &rowItem : myTable->selectionModel()->selectedRows()){ 1502 1561 selectedRows << rowItem.row(); 1503 1562 } … … 1537 1596 //Can we change the settings? (the conversion must be the same) 1538 1597 QString currentSettings = (getTypeConversion(myTable)); //call function at the mainWindow with a signal (different threads?) 1539 for each(int row,selectedRows){1598 for(const int row : selectedRows){ 1540 1599 if( myTable->item(row,1)->text() != currentSettings){ //If we find out any of the selected items can't be convert disable operation 1541 1600 changeOptions->setEnabled(false); … … 1567 1626 1568 1627 QApplication::clipboard()->setText(toCopy); 1569 showSuccessStatusMessage(QString::number(size) + (size==1?" item ":" items ")+ "copied to the clipboard");1628 Util::StatusBar::showSuccess(ui->statusBar, QString::number(size) + (size==1?" item ":" items ")+ "copied to the clipboard"); 1570 1629 } 1571 1630 else if(selectedOption==moveUp.get()){ … … 1591 1650 1592 1651 QString newDir=QFileDialog::getExistingDirectory(this,"Choose the folder for the output of the files selected...",this->AeLocation+"/GameDataFolder"); 1593 newDir=Util:: normalizePath(newDir);1652 newDir=Util::FileSystem::normalizePath(newDir); 1594 1653 1595 1654 if(newDir.isEmpty()){ … … 1637 1696 1638 1697 rowsWereChangedInDropTableWidget(); 1639 showSuccessStatusMessage(result);1698 Util::StatusBar::showSuccess(ui->statusBar, result); 1640 1699 } 1641 1700 } … … 1650 1709 QString command; 1651 1710 1652 foreach(int row, rows){ 1653 1711 for(int row : rows){ 1654 1712 command=getCommand(myTable,getFileOutputFolder(fromTo,myTable->getOutputAbsolute(row)),from,to,myTable->getFileAbsolute(row)); 1655 1713 … … 1663 1721 1664 1722 rowsWereChangedInDropTableWidget(); 1665 showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed to the current settings");1723 Util::StatusBar::showSuccess(ui->statusBar, QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed to the current settings"); 1666 1724 } 1667 1725 … … 1670 1728 QString command, currentAbsoluteFile, fromTo, from, to; 1671 1729 1672 for each(int row,rows){ //No optimization possible here, commands may be different1730 for(const int row : rows){ //No optimization possible here, commands may be different 1673 1731 fromTo=myTable->item(row,1)->text(); 1674 1732 from = QString(fromTo).remove(fromTo.indexOf(" >"),fromTo.size()-1); //parse the string to get the from … … 1687 1745 1688 1746 rowsWereChangedInDropTableWidget(); 1689 showSuccessStatusMessage(QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed the output to "+(newOutput!=this->workspaceLocation?Util::cutName(newOutput):"Vago workspace"));1747 Util::StatusBar::showSuccess(ui->statusBar, QString::number(rows.size()) + (rows.size()==1?" item ":" items ")+ "changed the output to "+(newOutput!=this->workspaceLocation?Util::FileSystem::cutName(newOutput):"Vago workspace")); 1690 1748 } 1691 1749 … … 1771 1829 void MainWindow::saveProjectState(const QString &filePath) 1772 1830 { 1773 1774 QList<DropTableWidget*> tableWidgets = getAllTableWidgets(); 1775 1776 pugi::xml_document doc; 1777 1778 pugi::xml_node rootNode = doc.append_child("VagoProject"); 1779 rootNode.append_attribute("vagoVersion").set_value(GlobalVars::LastCompatibleVersion.toUtf8().constData()); 1780 1781 foreach(DropTableWidget* const &myTable, tableWidgets){ 1782 saveProjectWidget(rootNode, myTable); 1783 } 1784 1785 if(!doc.save_file(filePath.toUtf8().constData(), PUGIXML_TEXT("\t"), pugi::format_default | pugi::format_write_bom, pugi::xml_encoding::encoding_utf8)){ 1786 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while trying to save the project file. Please try another path."); 1787 return; 1788 } 1789 1790 this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path()); 1791 1792 this->lastProjectFilePath = filePath; 1793 this->unsavedChangesExist = false; 1794 1795 addNewRecentProject(filePath); 1796 1797 setVagoWindowTitle(); 1798 1799 showSuccessStatusMessage("Project saved sucessfully."); 1800 } 1801 1802 void MainWindow::saveProjectWidget(pugi::xml_node &rootNode, DropTableWidget* table) 1803 { 1804 QString from; 1805 QString to; 1806 QString tabName = getTabNameByTableWidget(table); 1807 1808 pugi::xml_node currentNodeTable = rootNode.append_child("tempName"); 1809 pugi::xml_node options; 1810 1811 if(table==ui->twSourcesXML){ //So we only need to parse one command. 1812 from = ui->cbFromXML->currentText().toUtf8().constData(); 1813 to = ui->cbToXML->currentText().toUtf8().constData(); 1814 } 1815 else if(table==ui->twSourcesTextures){ 1816 from = ui->cbFromTextures->currentText().toUtf8().constData(); 1817 to = ui->cbToTextures->currentText().toUtf8().constData(); 1818 options = currentNodeTable.append_child("Options"); 1819 options.append_attribute("type").set_value(Util::qStrToCstr(getTextureRBCheckedTypeTexture()->text())); 1820 options.append_attribute("genMipMaps").set_value(Util::boolToCstr(ui->cbMipMapsTextures->isChecked())); 1821 options.append_attribute("noUwrap").set_value(Util::boolToCstr(ui->cbNoUwrap->isChecked())); 1822 options.append_attribute("noVwrap").set_value(Util::boolToCstr(ui->cbNoVwrap->isChecked())); 1823 options.append_attribute("large").set_value(Util::boolToCstr(ui->cbLarge->isChecked())); 1824 options.append_attribute("envMap").set_value(Util::boolToCstr(ui->cbEnvMap->isChecked())); 1825 options.append_attribute("envMapValue").set_value(Util::qStrToCstr(ui->leEnvMapTexture->text())); 1826 } 1827 else if(table==ui->twSourcesCharacters){ 1828 from = ui->cbFromCharacters->currentText().toUtf8().constData(); 1829 to = ui->cbToCharacters->currentText().toUtf8().constData(); 1830 options = currentNodeTable.append_child("Options"); 1831 options.append_attribute("cellShading").set_value(Util::boolToCstr(ui->cbCellShading->isChecked())); 1832 options.append_attribute("normals").set_value(Util::boolToCstr(ui->cbNormals->isChecked())); 1833 options.append_attribute("extractTRBSONCC").set_value(Util::boolToCstr(ui->cbWithTRBS_ONCC->isChecked())); 1834 options.append_attribute("extractTRBSONCCValue").set_value(Util::qStrToCstr(ui->leTRBS_ONCC->text())); 1835 } 1836 else if(table==ui->twSourcesObjects){ 1837 from = ui->cbFromObjects->currentText().toUtf8().constData(); 1838 to = ui->cbToObjects->currentText().toUtf8().constData(); 1839 options = currentNodeTable.append_child("Options"); 1840 options.append_attribute("texture").set_value(Util::boolToCstr(ui->cbTexture->isChecked())); 1841 options.append_attribute("textureValue").set_value(Util::qStrToCstr(ui->leTextureName->text())); 1842 options.append_attribute("withAnimation").set_value(Util::boolToCstr(ui->cbWithAnimation->isChecked())); 1843 options.append_attribute("withAnimationValue").set_value(Util::qStrToCstr(ui->leAnimationName->text())); 1844 } 1845 else if(table==ui->twSourcesLevels){ 1846 from = ui->cbFromLevels->currentText().toUtf8().constData(); 1847 to = ui->cbToLevels->currentText().toUtf8().constData(); 1848 options = currentNodeTable.append_child("Options"); 1849 options.append_attribute("extractWithFiles").set_value(Util::boolToCstr(ui->cbSpecificFilesLevels->isChecked())); 1850 options.append_attribute("extractWithFilesValue").set_value(Util::qStrToCstr(ui->leSpecificFilesLevels->text())); 1851 options.append_attribute("datFilename").set_value(Util::boolToCstr(ui->cbDatLevels->isChecked())); 1852 options.append_attribute("datFilenameValue").set_value(Util::qStrToCstr(ui->leTargetDatLevels->text())); 1853 options.append_attribute("bnvSource").set_value(Util::boolToCstr(ui->cbBnvLevels->isChecked())); 1854 options.append_attribute("bnvSourceValue").set_value(Util::qStrToCstr(ui->leBnvLevels->text())); 1855 options.append_attribute("generateGrids").set_value(Util::boolToCstr(ui->cbGridsLevels->isChecked())); 1856 options.append_attribute("additionalSources").set_value(Util::boolToCstr(ui->cbAdditionalSourcesLevels->isChecked())); 1857 options.append_attribute("additionalSourcesValue").set_value(Util::qStrToCstr(ui->leAdditSourcesLevels->text())); 1858 } 1859 else{ 1860 from = ui->cbFromMisc->currentText().toUtf8().constData(); 1861 to = ui->cbToMisc->currentText().toUtf8().constData(); 1862 } 1863 1864 currentNodeTable.set_name(tabName.toUtf8().constData()); 1865 1866 currentNodeTable.append_attribute("from").set_value(from.toUtf8().constData()); 1867 currentNodeTable.append_attribute("to").set_value(to.toUtf8().constData()); 1868 1869 1870 for(int i=0; i<table->rowCount(); i++){ 1871 1872 QString currFileFolder = table->item(i,0)->text(); 1873 QString currFromTo = table->item(i,1)->text(); 1874 QString currCommand = table->item(i,2)->text(); 1875 1876 pugi::xml_node currentRow = currentNodeTable.append_child("Row"); 1877 1878 1879 currentRow.append_attribute("fileFolder").set_value(Util::qStrToCstr(currFileFolder)); 1880 currentRow.append_attribute("fromTo").set_value(Util::qStrToCstr(currFromTo)); 1881 currentRow.append_attribute("command").set_value(Util::qStrToCstr(currCommand)); 1882 1883 if(table->item(i,2)->background()==table->disabledBackStyle){ 1884 currentRow.append_attribute("disabled").set_value(true); 1885 } 1886 1887 } 1831 try{ 1832 ProjectFileVago::saveProjectDataToFile(filePath, fetchCurrentProjectData()); 1833 1834 this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path()); 1835 1836 this->lastProjectFilePath = filePath; 1837 this->unsavedChangesExist = false; 1838 1839 addNewRecentProject(filePath); 1840 1841 setVagoWindowTitle(); 1842 1843 Util::StatusBar::showSuccess(ui->statusBar, "Project saved sucessfully."); 1844 } 1845 catch(const std::exception& e){ 1846 QString errorMessage = "An error ocurred while trying to save the project file. Please try another path."; 1847 UtilVago::showAndLogErrorPopUpLogButton(errorMessage); 1848 Util::StatusBar::showError(ui->statusBar, "Couldn't save project file."); 1849 } 1850 } 1851 1852 ProjectFileVago::ProjectData MainWindow::fetchCurrentProjectData(){ 1853 1854 ProjectFileVago::ProjectData currentProjectData; 1855 1856 auto fFetchTabGenericData = 1857 [](ProjectFileVago::ProjectTable &projectTable, 1858 const QComboBox * const cbFrom, 1859 const QComboBox * const cbTo, 1860 DropTableWidget const * const table) ->void{ 1861 1862 projectTable.from = cbFrom->currentText(); 1863 projectTable.to = cbTo->currentText(); 1864 1865 for(int i=0; i<table->rowCount(); i++){ 1866 1867 ProjectFileVago::ProjectTableRow currentRow; 1868 1869 currentRow.fileFolder = table->item(i,0)->text(); 1870 currentRow.fromTo = table->item(i,1)->text(); 1871 currentRow.command= table->item(i,2)->text(); 1872 1873 if(table->item(i,2)->background()==table->disabledBackStyle){ 1874 currentRow.isDisabled = true; 1875 } 1876 1877 projectTable.rows.append(currentRow); 1878 } 1879 }; 1880 1881 // XML tab 1882 fFetchTabGenericData(currentProjectData.xmlTable, ui->cbFromXML, ui->cbToXML, ui->twSourcesXML); 1883 1884 // Textures tab 1885 fFetchTabGenericData(currentProjectData.texturesTable, ui->cbFromTextures, ui->cbToTextures, ui->twSourcesTextures); 1886 currentProjectData.texturesTable.rbTexturesType = getTextureRBCheckedTypeTexture()->text(); 1887 currentProjectData.texturesTable.cbGenMipMaps = ui->cbMipMapsTextures->isChecked(); 1888 currentProjectData.texturesTable.cbNoUwrap = ui->cbNoUwrap->isChecked(); 1889 currentProjectData.texturesTable.cbNoVwrap = ui->cbNoVwrap->isChecked(); 1890 currentProjectData.texturesTable.cbLarge = ui->cbLarge->isChecked(); 1891 currentProjectData.texturesTable.cbEnvMap = ui->cbEnvMap->isChecked(); 1892 currentProjectData.texturesTable.leEnvMapTexture = ui->leEnvMapTexture->text(); 1893 1894 // Characters tab 1895 fFetchTabGenericData(currentProjectData.charactersTable, ui->cbFromCharacters, ui->cbToCharacters, ui->twSourcesCharacters); 1896 currentProjectData.charactersTable.cbCellShading = ui->cbCellShading->isChecked(); 1897 currentProjectData.charactersTable.cbNormals = ui->cbNormals->isChecked(); 1898 currentProjectData.charactersTable.cbStandingPose = ui->cbStandingPose->isChecked(); 1899 currentProjectData.charactersTable.cbWithTRBS_ONCC = ui->cbWithTRBS_ONCC->isChecked(); 1900 currentProjectData.charactersTable.leTRBS_ONCC = ui->leTRBS_ONCC->text(); 1901 1902 // Objects tab 1903 fFetchTabGenericData(currentProjectData.objectsTable, ui->cbFromObjects, ui->cbToObjects, ui->twSourcesObjects); 1904 currentProjectData.objectsTable.cbTexture = ui->cbTexture->isChecked(); 1905 currentProjectData.objectsTable.leTextureName = ui->leTextureName->text(); 1906 currentProjectData.objectsTable.cbWithAnimation = ui->cbWithAnimation->isChecked(); 1907 currentProjectData.objectsTable.leAnimationName = ui->leAnimationName->text(); 1908 1909 // Levels tab 1910 fFetchTabGenericData(currentProjectData.levelsTable, ui->cbFromLevels, ui->cbToLevels, ui->twSourcesLevels); 1911 currentProjectData.levelsTable.cbSpecificFilesLevels = ui->cbSpecificFilesLevels->isChecked(); 1912 currentProjectData.levelsTable.leSpecificFilesLevels = ui->leSpecificFilesLevels->text(); 1913 currentProjectData.levelsTable.cbDatLevels = ui->cbDatLevels->isChecked(); 1914 currentProjectData.levelsTable.leTargetDatLevels = ui->leTargetDatLevels->text(); 1915 currentProjectData.levelsTable.cbBnvLevels = ui->cbBnvLevels->isChecked(); 1916 currentProjectData.levelsTable.leBnvLevels = ui->leBnvLevels->text(); 1917 currentProjectData.levelsTable.cbGridsLevels = ui->cbGridsLevels->isChecked(); 1918 currentProjectData.levelsTable.cbAdditionalSourcesLevels = ui->cbAdditionalSourcesLevels->isChecked(); 1919 currentProjectData.levelsTable.leAdditSourcesLevels = ui->leAdditSourcesLevels->text(); 1920 1921 // Misc tab 1922 fFetchTabGenericData(currentProjectData.miscTable, ui->cbFromMisc, ui->cbToMisc, ui->twSourcesMisc); 1923 1924 return currentProjectData; 1888 1925 } 1889 1926 … … 1941 1978 } 1942 1979 else{ 1943 vagoTitle += Util:: cutNameWithoutBackSlash(this->lastProjectFilePath);1980 vagoTitle += Util::FileSystem::cutNameWithoutBackSlash(this->lastProjectFilePath); 1944 1981 } 1945 1982 … … 2019 2056 void MainWindow::loadProjectState(const QString &filePath) 2020 2057 { 2058 2059 auto fLoadTabGenericData = 2060 [this]( // we are capturing this only to call the addRowTable function... 2061 const ProjectFileVago::ProjectTable &tableData, 2062 DropTableWidget * const table, 2063 QComboBox * const cbFrom, 2064 QComboBox * const cbTo) -> void{ 2065 2066 cbFrom->setCurrentText(tableData.from); 2067 cbTo->setCurrentText(tableData.to); 2068 2069 // Add rows 2070 for(const ProjectFileVago::ProjectTableRow ¤tRow : tableData.rows){ 2071 addRowTable(table,currentRow.fileFolder,currentRow.fromTo,currentRow.command, currentRow.isDisabled); 2072 } 2073 2074 }; 2021 2075 2022 2076 this->projectIsLoading = true; … … 2030 2084 } 2031 2085 2032 QString statusError = "Couldn't load project."; 2033 2034 pugi::xml_document doc; 2035 2036 pugi::xml_parse_result result = doc.load_file(Util::qStrToCstr(filePath)); 2037 2038 if(result.status!=pugi::status_ok){ 2039 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "An error ocurred while loading project file.\n" + QString(result.description())); 2040 showErrStatusMessage(statusError); 2086 try{ 2087 ProjectFileVago::ProjectData projectData = ProjectFileVago::readProjectDataFromFile(filePath); 2088 2089 // XML tab 2090 fLoadTabGenericData(projectData.xmlTable, ui->twSourcesXML, ui->cbFromXML, ui->cbToXML); 2091 2092 // Textures tab 2093 fLoadTabGenericData(projectData.texturesTable, ui->twSourcesTextures, ui->cbFromTextures, ui->cbToTextures); 2094 getTextureRBTypeTextureByName(projectData.texturesTable.rbTexturesType)->setChecked(true); 2095 ui->cbMipMapsTextures->setChecked(projectData.texturesTable.cbGenMipMaps); 2096 ui->cbNoUwrap->setChecked(projectData.texturesTable.cbNoUwrap); 2097 ui->cbNoVwrap->setChecked(projectData.texturesTable.cbNoVwrap); 2098 ui->cbLarge->setChecked(projectData.texturesTable.cbLarge); 2099 ui->cbEnvMap->setChecked(projectData.texturesTable.cbEnvMap); 2100 ui->leEnvMapTexture->setText(projectData.texturesTable.leEnvMapTexture); 2101 2102 // Characters tab 2103 fLoadTabGenericData(projectData.charactersTable, ui->twSourcesCharacters, ui->cbFromCharacters, ui->cbToCharacters); 2104 2105 ui->cbCellShading->setChecked(projectData.charactersTable.cbCellShading); 2106 ui->cbNormals->setChecked(projectData.charactersTable.cbNormals); 2107 ui->cbStandingPose->setChecked(projectData.charactersTable.cbStandingPose); 2108 ui->cbWithTRBS_ONCC->setChecked(projectData.charactersTable.cbWithTRBS_ONCC); 2109 ui->leTRBS_ONCC->setText(projectData.charactersTable.leTRBS_ONCC); 2110 2111 // Objects tab 2112 fLoadTabGenericData(projectData.objectsTable, ui->twSourcesObjects, ui->cbFromObjects, ui->cbToObjects); 2113 2114 ui->cbTexture->setChecked(projectData.objectsTable.cbTexture); 2115 ui->leTextureName->setText(projectData.objectsTable.leTextureName); 2116 ui->cbWithAnimation->setChecked(projectData.objectsTable.cbWithAnimation); 2117 ui->leAnimationName->setText(projectData.objectsTable.leAnimationName); 2118 2119 // Levels tab 2120 fLoadTabGenericData(projectData.levelsTable, ui->twSourcesLevels, ui->cbFromLevels, ui->cbToLevels); 2121 2122 ui->cbSpecificFilesLevels->setChecked(projectData.levelsTable.cbSpecificFilesLevels); 2123 ui->leSpecificFilesLevels->setText(projectData.levelsTable.leSpecificFilesLevels); 2124 ui->cbDatLevels->setChecked(projectData.levelsTable.cbDatLevels); 2125 ui->leTargetDatLevels->setText(projectData.levelsTable.leTargetDatLevels); 2126 ui->cbBnvLevels->setChecked(projectData.levelsTable.cbBnvLevels); 2127 ui->leBnvLevels->setText(projectData.levelsTable.leBnvLevels); 2128 ui->cbGridsLevels->setChecked(projectData.levelsTable.cbGridsLevels); 2129 ui->cbAdditionalSourcesLevels->setChecked(projectData.levelsTable.cbAdditionalSourcesLevels); 2130 ui->leAdditSourcesLevels->setText(projectData.levelsTable.leAdditSourcesLevels); 2131 2132 // Misc tab 2133 fLoadTabGenericData(projectData.miscTable, ui->twSourcesMisc, ui->cbFromMisc, ui->cbToMisc); 2134 2135 this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path()); 2136 2137 this->lastProjectFilePath = filePath; 2138 this->unsavedChangesExist = false; 2139 2140 addNewRecentProject(filePath); 2141 2142 setVagoWindowTitle(); 2143 2041 2144 this->projectIsLoading = false; 2042 return; 2043 } 2044 2045 2046 if(QString(doc.root().first_child().name()) != "VagoProject"){ 2047 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, QString(doc.root().name()) + "The file opened is not a valid VagoProject file. Load aborted."); 2048 showErrStatusMessage(statusError); 2145 2146 Util::StatusBar::showSuccess(ui->statusBar, "Project loaded sucessfully."); 2147 } 2148 catch(const std::exception& e){ 2049 2149 this->projectIsLoading = false; 2050 return; 2051 } 2052 2053 QString projVagoVersion; 2054 2055 try{ 2056 projVagoVersion = QString(doc.select_node("/VagoProject/@vagoVersion").attribute().value()); 2057 } 2058 catch (const pugi::xpath_exception& e) 2059 { 2060 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't find the vagoVersion of the current project. Load aborted.\n" + QString(e.what())); 2061 showErrStatusMessage(statusError); 2062 this->projectIsLoading = false; 2063 return; 2064 } 2065 2066 if(!projVagoVersion.startsWith(GlobalVars::LastCompatibleVersion)){ 2067 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "The project that you are trying to load seems it is not compatible with your Vago Version. Please update Vago and try again."); 2068 showErrStatusMessage(statusError); 2069 this->projectIsLoading = false; 2070 return; 2071 } 2072 2073 // After the initial validations begin loading the project data 2074 2075 QList<DropTableWidget*> tableWidgets = getAllTableWidgets(); 2076 2077 try{ 2078 foreach(DropTableWidget* const &myTable, tableWidgets){ 2079 loadProjectWidget(doc, myTable); 2080 } 2081 } 2082 catch(const std::exception& e){ 2083 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't load the vago project. Error: " + QString(e.what())); 2084 showErrStatusMessage(statusError); 2085 this->projectIsLoading = false; 2086 return; 2087 } 2088 2089 this->vagoSettings->setValue("LastProjectPath",QFileInfo(filePath).absoluteDir().path()); 2090 2091 this->lastProjectFilePath = filePath; 2092 this->unsavedChangesExist = false; 2093 2094 addNewRecentProject(filePath); 2095 2096 setVagoWindowTitle(); 2097 2098 this->projectIsLoading = false; 2099 2100 showSuccessStatusMessage("Project loaded sucessfully."); 2101 } 2102 2103 2104 void MainWindow::loadProjectWidget(pugi::xml_document &doc, DropTableWidget* table) 2105 { 2106 QString tabName = getTabNameByTableWidget(table); 2107 QString from (doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/@from")).attribute().value()); 2108 QString to (doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/@to")).attribute().value()); 2109 2110 if(table==ui->twSourcesXML){ 2111 ui->cbFromXML->setCurrentText(from); 2112 on_cbFromXML_currentIndexChanged(from); 2113 ui->cbToXML->setCurrentText(to); 2114 } 2115 else if(table==ui->twSourcesTextures){ 2116 //ui->cbFromTextures->setCurrentText(from); 2117 on_cbFromTextures_currentIndexChanged(from); 2118 ui->cbToTextures->setCurrentText(to); 2119 2120 getTextureRBTypeTextureByName((doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@type")).attribute().value()))->setChecked(true); 2121 ui->cbMipMapsTextures->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@genMipMaps")).attribute().as_bool()); 2122 ui->cbNoUwrap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@noUwrap")).attribute().as_bool()); 2123 ui->cbNoVwrap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@noVwrap")).attribute().as_bool()); 2124 ui->cbLarge->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@large")).attribute().as_bool()); 2125 ui->cbEnvMap->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@envMap")).attribute().as_bool()); 2126 ui->leEnvMapTexture->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@envMapValue")).attribute().value())); 2127 } 2128 else if(table==ui->twSourcesCharacters){ 2129 ui->cbFromCharacters->setCurrentText(from); 2130 on_cbFromCharacters_currentIndexChanged(from); 2131 ui->cbToCharacters->setCurrentText(to); 2132 2133 2134 ui->cbCellShading->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@cellShading")).attribute().as_bool()); 2135 ui->cbNormals->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@normals")).attribute().as_bool()); 2136 ui->cbWithTRBS_ONCC->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractTRBSONCC")).attribute().as_bool()); 2137 ui->leTRBS_ONCC->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractTRBSONCCValue")).attribute().value())); 2138 } 2139 else if(table==ui->twSourcesObjects){ 2140 ui->cbFromObjects->setCurrentText(from); 2141 on_cbFromObjects_currentIndexChanged(from); 2142 ui->cbToObjects->setCurrentText(to); 2143 2144 ui->cbTexture->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@texture")).attribute().as_bool()); 2145 ui->leTextureName->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@textureValue")).attribute().value())); 2146 ui->cbWithAnimation->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@withAnimation")).attribute().as_bool()); 2147 ui->leAnimationName->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@withAnimationValue")).attribute().value())); 2148 } 2149 else if(table==ui->twSourcesLevels){ 2150 ui->cbFromLevels->setCurrentText(from); 2151 on_cbFromLevels_currentIndexChanged(from); 2152 ui->cbToLevels->setCurrentText(to); 2153 2154 ui->cbSpecificFilesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractWithFiles")).attribute().as_bool()); 2155 ui->leSpecificFilesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@extractWithFilesValue")).attribute().value())); 2156 ui->cbDatLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@datFilename")).attribute().as_bool()); 2157 ui->leTargetDatLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@datFilenameValue")).attribute().value())); 2158 ui->cbBnvLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSource")).attribute().as_bool()); 2159 ui->leBnvLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@bnvSourceValue")).attribute().value())); 2160 ui->cbGridsLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@generateGrids")).attribute().as_bool()); 2161 ui->cbAdditionalSourcesLevels->setChecked(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSources")).attribute().as_bool()); 2162 ui->leAdditSourcesLevels->setText(QString(doc.select_node(Util::qStrToCstr("/VagoProject/"+tabName+"/Options/@additionalSourcesValue")).attribute().value())); 2163 } 2164 else{ 2165 ui->cbFromMisc->setCurrentText(from); 2166 on_cbFromMisc_currentIndexChanged(from); 2167 ui->cbToMisc->setCurrentText(to); 2168 } 2169 2170 // Clean previous rows 2171 clearTableNoPrompt(table); 2172 2173 for(const pugi::xpath_node &xPathNode : doc.select_nodes(Util::qStrToCstr("/VagoProject/"+tabName+"/Row"))){ 2174 pugi::xml_node currNode = xPathNode.node(); 2175 2176 QString currFileFolder = currNode.attribute("fileFolder").value(); 2177 QString currFromTo = currNode.attribute("fromTo").value(); 2178 QString currCommand = currNode.attribute("command").value(); 2179 2180 bool isToDisable = false; 2181 pugi::xml_attribute disabledAttr = currNode.attribute("disabled"); 2182 isToDisable = disabledAttr.empty() ? false : disabledAttr.as_bool(); 2183 2184 addRowTable(table,currFileFolder,currFromTo,currCommand, isToDisable); 2185 } 2150 QString errorMessage = "Couldn't load the Vago project. Error: " + QString(e.what()); 2151 LOG_ERROR << errorMessage; 2152 Util::Dialogs::showError(errorMessage); 2153 Util::StatusBar::showError(ui->statusBar, "Couldn't load project."); 2154 } 2155 2186 2156 } 2187 2157 -
s10k/Vago/mainwindow.h
r1061 r1093 13 13 #include "xmltoolsinterface.h" 14 14 #include "wizardfactory.h" 15 #include "xmlParsers/projectfilevago.h" 15 16 16 17 #include <QMainWindow> … … 33 34 #include <QScriptValueIterator> 34 35 #include <droptablewidget.h> 35 #include <pugixml .hpp>36 #include <pugixml/pugixml.hpp> 36 37 #ifdef Q_OS_WIN 37 38 #include <QWinTaskbarProgress> … … 170 171 void on_cbWithTRBS_ONCC_toggled(bool checked); 171 172 173 void on_cbFromXML_currentIndexChanged(const QString &arg1); 174 175 void on_cbSpecificFilesLevels_toggled(bool checked); 176 177 void on_tbAbortConversion_clicked(); 178 179 void on_tabWidget_currentChanged(int); 180 181 void on_actionSave_Project_triggered(); 182 183 void on_actionSave_triggered(); 184 185 void on_actionLoad_Project_triggered(); 186 187 void on_actionProject1_triggered(); 188 189 void on_actionProject2_triggered(); 190 191 void on_actionProject3_triggered(); 192 193 void on_actionProject4_triggered(); 194 195 void on_actionProject5_triggered(); 196 197 void on_actionBackground_Image_Wizard_triggered(); 198 199 void on_actionNew_Project_triggered(); 200 201 void on_tbXmlToolsInterface_clicked(); 202 203 void on_actionWindow_Messages_Wizard_triggered(); 204 172 205 void on_cbWithAnimation_toggled(bool checked); 173 174 void on_cbFromXML_currentIndexChanged(const QString &arg1);175 176 void on_cbSpecificFilesLevels_toggled(bool checked);177 178 void on_tbAbortConversion_clicked();179 180 void on_tabWidget_currentChanged(int);181 182 void on_actionSave_Project_triggered();183 184 void on_actionSave_triggered();185 186 void on_actionLoad_Project_triggered();187 188 void on_actionProject1_triggered();189 190 void on_actionProject2_triggered();191 192 void on_actionProject3_triggered();193 194 void on_actionProject4_triggered();195 196 void on_actionProject5_triggered();197 198 void on_actionBackground_Image_Wizard_triggered();199 200 void on_actionNew_Project_triggered();201 202 void on_tbXmlToolsInterface_clicked();203 204 void on_actionWindow_Messages_Wizard_triggered();205 206 206 207 private: 207 208 Ui::MainWindow *ui; 208 Logger *myLogger;209 209 QString workspaceLocation; //Workspace location 210 210 QString workspaceWizardsLocation; //Workspace wizard location … … 241 241 enum {XMLTabIndex, TexturesTabIndex, CharactersTabIndex, ObjectsTabIndex, LevelsTabIndex, MiscTabIndex}; 242 242 243 private: 243 244 void connectSlots(); 244 void showErrStatusMessage(QString message);245 void showSuccessStatusMessage(QString message);246 245 void mapCommands(); 247 246 void addRowTable(DropTableWidget *myTable, QString file, QString fromTo, QString command, bool isToDisabled=false); … … 256 255 void setConverterButtonsSize(); 257 256 void saveProjectState(const QString &filePath); 258 void saveProjectWidget(pugi::xml_node &rootNode, DropTableWidget* table);259 257 void loadProjectState(const QString &filePath); 260 258 void setVagoWindowTitle(); 261 void loadProjectWidget(pugi::xml_document &doc, DropTableWidget* table);262 259 void saveRecentProjects(); 263 260 void loadRecentProjects(); … … 284 281 QList<DropTableWidget*> getAllTableWidgets(); 285 282 QMessageBox::StandardButton askToSaveCurrentProject(); 283 ProjectFileVago::ProjectData fetchCurrentProjectData(); 286 284 287 285 signals: -
s10k/Vago/mainwindow.ui
r1061 r1093 701 701 <layout class="QHBoxLayout" name="horizontalLayout_3"> 702 702 <item> 703 <widget class="QCheckBox" name="cbStandingPose"> 704 <property name="toolTip"> 705 <string>Export the model in a "standing pose". If not checked model is exported in the "wrapped form" (all body parts set to 0)</string> 706 </property> 707 <property name="text"> 708 <string>Standing Pose</string> 709 </property> 710 </widget> 711 </item> 712 <item> 703 713 <widget class="QCheckBox" name="cbCellShading"> 704 714 <property name="enabled"> … … 905 915 </property> 906 916 <property name="toolTip"> 907 <string>Give model a texture. 917 <string>Give model a texture. 908 918 It's the name of a TXMP.oni file, don't include the extension.</string> 909 919 </property> … … 922 932 </property> 923 933 <property name="toolTip"> 924 <string> Give model a texture.925 It's the name of a TXMP.oni file, don't include the extension.</string>934 <string>Extract M3GM.oni with an animation file (OBAN.oni). 935 Add the full path to the OBAN.oni file (include extension).</string> 926 936 </property> 927 937 <property name="text"> … … 936 946 </property> 937 947 <property name="toolTip"> 938 <string> Give model a texture.939 It's the name of a TXMP.oni file, don't include the extension.</string>948 <string>Extract M3GM.oni with an animation file (OBAN.oni). 949 Add the full path to the OBAN.oni file (include extension).</string> 940 950 </property> 941 951 <property name="placeholderText"> -
s10k/Vago/manualcommands.cpp
r1058 r1093 45 45 46 46 if(command.isEmpty()){ 47 Util:: showErrorPopUp("Please input a command first.");47 Util::Dialogs::showError("Please input a command first."); 48 48 return; 49 49 } … … 86 86 void ManualCommands::on_pbClear_clicked() 87 87 { 88 if(Util:: showQuestionPopUp(this,"Clear the output?")){88 if(Util::Dialogs::showQuestion(this,"Clear the output?")){ 89 89 ui->ptOutput->clear(); 90 90 } -
s10k/Vago/packageWizard/packagepage2.cpp
r1047 r1093 6 6 const QString PackagePage2::CacheFile = "nodes.json"; 7 7 8 PackagePage2::PackagePage2( Logger *myLogger,QWidget *parent) :8 PackagePage2::PackagePage2(QWidget *parent) : 9 9 QWizardPage(parent), 10 10 ui(new Ui::PackagePage2) 11 11 { 12 12 ui->setupUi(this); 13 this->myLogger=myLogger; 13 14 14 this->setTitle("Mandatory Fields"); 15 15 … … 38 38 QString number=ui->lePackageNumber->text(); 39 39 40 bool emptyContent=Util:: checkEmptySpaces(QStringList()<<modName<<authors<<version<<description<<number);40 bool emptyContent=Util::Validation::checkEmptySpaces(QStringList()<<modName<<authors<<version<<description<<number); 41 41 42 42 43 43 if(emptyContent){ 44 Util:: showErrorPopUp("You need to fill all fields first!");44 Util::Dialogs::showError("You need to fill all fields first!"); 45 45 return false; 46 46 } 47 47 48 48 if(number.size()!=5){ 49 Util:: showErrorPopUp("Invalid number format. It should contain 5 numbers.");49 Util::Dialogs::showError("Invalid number format. It should contain 5 numbers."); 50 50 return false; 51 51 } 52 52 53 if(!Util:: isStringInteger(number)){54 Util:: showErrorPopUp("Number is not numeric.");53 if(!Util::Validation::isStringInteger(number)){ 54 Util::Dialogs::showError("Number is not numeric."); 55 55 return false; 56 56 } … … 68 68 QString number = ui->lePackageNumber->text(); 69 69 70 if(Util:: checkEmptySpaces(QStringList(number))){71 Util:: showErrorPopUp("Number is empty. Please fill it first.");70 if(Util::Validation::checkEmptySpaces(QStringList(number))){ 71 Util::Dialogs::showError("Number is empty. Please fill it first."); 72 72 return; 73 73 } 74 74 75 75 if(number.size()!=5){ 76 Util:: showErrorPopUp("Invalid number format. It should contain 5 numeric characters.");76 Util::Dialogs::showError("Invalid number format. It should contain 5 numeric characters."); 77 77 return; 78 78 } 79 79 80 if(Util:: isStringInteger(number)){80 if(Util::Validation::isStringInteger(number)){ 81 81 82 82 bool necessaryToRedownload=false; … … 108 108 } 109 109 else{ 110 Util:: showErrorPopUp("Number is not numeric.");110 Util::Dialogs::showError("Number is not numeric."); 111 111 } 112 112 } … … 124 124 125 125 if(!file.open(QIODevice::WriteOnly)){ 126 UtilVago::showAndLogErrorPopUp( this->myLogger,"Error fetching package data: creating cache file.");126 UtilVago::showAndLogErrorPopUp("Error fetching package data: creating cache file."); 127 127 return; 128 128 } … … 132 132 //Let's extract the cache data 133 133 if(JlCompress::extractFile(GlobalVars::VagoTemporaryDir+"/"+this->ZipCacheFile, "/"+this->CacheFile ,GlobalVars::VagoTemporaryDir+"/"+this->CacheFile).isEmpty()){ 134 UtilVago::showAndLogErrorPopUp( this->myLogger,"An error occurred while unzipping the package data.");134 UtilVago::showAndLogErrorPopUp("An error occurred while unzipping the package data."); 135 135 } 136 136 … … 139 139 } 140 140 else{ 141 UtilVago::showAndLogErrorPopUpLogButton( this->myLogger,"An error occurred checking number availability:\n\n"+result->errorString());141 UtilVago::showAndLogErrorPopUpLogButton("An error occurred checking number availability:\n\n"+result->errorString()); 142 142 } 143 143 … … 150 150 QFile file(GlobalVars::VagoTemporaryDir+"/"+this->CacheFile); //let's read the chache unzipped 151 151 if(!file.open(QIODevice::ReadOnly)){ 152 UtilVago::showAndLogErrorPopUp( this->myLogger,"Error reading downloaded package cache data.");152 UtilVago::showAndLogErrorPopUp("Error reading downloaded package cache data."); 153 153 return; 154 154 } … … 177 177 178 178 if(!existingModName.isEmpty()){ 179 Util:: showRichErrorPopUp("Package "+packageNumber+" is already being used by the following mod:<br/><br/>"+179 Util::Dialogs::showRichError("Package "+packageNumber+" is already being used by the following mod:<br/><br/>"+ 180 180 existingModName+"<br/><br/>"+ 181 181 "More information <a href='"+existingModUrl+"'>here</a>."); 182 182 } 183 183 else{ 184 Util:: showPopUp("It seems that the package number " + packageNumber + " is not being used yet! :)");184 Util::Dialogs::showInfo("It seems that the package number " + packageNumber + " is not being used yet! :)"); 185 185 } 186 186 } -
s10k/Vago/packageWizard/packagepage2.h
r1047 r1093 21 21 22 22 public: 23 explicit PackagePage2( Logger *myLogger,QWidget *parent = 0);23 explicit PackagePage2(QWidget *parent = 0); 24 24 25 25 ~PackagePage2(); … … 34 34 private: 35 35 Ui::PackagePage2 *ui; 36 Logger *myLogger;37 36 static const QString ZipCacheFile; 38 37 static const QString CacheFile; -
s10k/Vago/packageWizard/packagepage3.cpp
r771 r1093 33 33 if(!field.isEmpty()){ 34 34 35 QStringList list =Util:: substring(field,",");35 QStringList list =Util::String::substring(field,","); 36 36 37 37 for(int i=0; i<list.size(); i++){ 38 38 39 39 if(list.at(i).isEmpty()){ 40 Util:: showErrorPopUp("There are commas without numbers in their sides.");40 Util::Dialogs::showError("There are commas without numbers in their sides."); 41 41 return false; 42 42 } 43 43 44 if(!Util:: isStringInteger(list.at(i))){45 Util:: showErrorPopUp("Number is not numeric.");44 if(!Util::Validation::isStringInteger(list.at(i))){ 45 Util::Dialogs::showError("Number is not numeric."); 46 46 return false; 47 47 } … … 49 49 if(!isLevels){ 50 50 if(list.at(i).size()!=5){ 51 Util:: showErrorPopUp("You have invalid packages numbers. Each number must have 5 digits.");51 Util::Dialogs::showError("You have invalid packages numbers. Each number must have 5 digits."); 52 52 return false; 53 53 } -
s10k/Vago/packageWizard/packagepage4.cpp
r799 r1093 69 69 70 70 //Pre-processing (check if received only folders) 71 for each(QString myFile,resources){71 for(const QString &myFile : resources){ 72 72 if(!QDir(myFile).exists()){ 73 Util:: showErrorPopUp("Only folders are allowed for this operation.");73 Util::Dialogs::showError("Only folders are allowed for this operation."); 74 74 return; 75 75 } … … 78 78 QString type=ui->pbSwitchFiles->text().replace(" files",""); 79 79 80 for each(QString currentFolder,resources){80 for(QString currentFolder: resources){ 81 81 82 currentFolder=Util:: normalizePath(currentFolder); //normalize path82 currentFolder=Util::FileSystem::normalizePath(currentFolder); //normalize path 83 83 84 84 //Get actual number rows … … 89 89 90 90 //Add to table and list to 91 QTableWidgetItem *newFolder = new QTableWidgetItem(Util:: cutName(currentFolder));91 QTableWidgetItem *newFolder = new QTableWidgetItem(Util::FileSystem::cutName(currentFolder)); 92 92 QTableWidgetItem *newType = new QTableWidgetItem(type); 93 93 QTableWidgetItem *newFullPath = new QTableWidgetItem(currentFolder); … … 139 139 void PackagePage4::addTableContents(DropTableWidget *myTable){ 140 140 if(ui->pbSwitchFiles->text()==".oni files"){ 141 addResourcesPackage(myTable,Util:: multipleDirDialog("Choose folders with .oni files..."));141 addResourcesPackage(myTable,Util::Dialogs::multipleDirSelection("Choose folders with .oni files...")); 142 142 } 143 143 else if(ui->pbSwitchFiles->text()==".bsl files"){ 144 addResourcesPackage(myTable,Util:: multipleDirDialog("Choose folders with .bsl files..."));144 addResourcesPackage(myTable,Util::Dialogs::multipleDirSelection("Choose folders with .bsl files...")); 145 145 } 146 146 else{ 147 addResourcesPackage(myTable,Util:: multipleDirDialog("Choose folders with .oni-patch files..."));147 addResourcesPackage(myTable,Util::Dialogs::multipleDirSelection("Choose folders with .oni-patch files...")); 148 148 } 149 149 } … … 153 153 154 154 if(size==0){ 155 Util:: showPopUp("Select a row first.");155 Util::Dialogs::showInfo("Select a row first."); 156 156 return; 157 157 } 158 158 159 if(Util:: showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){159 if(Util::Dialogs::showQuestion(this,"Are you sure you want to delete the selected rows?")){ 160 160 for(int i=0; i<size; i++){ 161 161 myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row()); … … 166 166 bool PackagePage4::validatePage(){ 167 167 if(ui->twCommon->rowCount()==0 && ui->twWindows->rowCount()==0 && ui->twMac->rowCount()==0){ 168 Util:: showErrorPopUp("You need to add some folders with resources first!");168 Util::Dialogs::showError("You need to add some folders with resources first!"); 169 169 return false; 170 170 } -
s10k/Vago/packageWizard/packagewizard.cpp
r1061 r1093 1 1 #include "packagewizard.h" 2 2 3 PackageWizard::PackageWizard(const QString &appDir, QString workspaceWizardLocation, QSettings *vagoSettings , Logger *myLogger)4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger,false)3 PackageWizard::PackageWizard(const QString &appDir, QString workspaceWizardLocation, QSettings *vagoSettings) 4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, false) 5 5 { 6 6 this->packagesLocation=this->workspaceWizardLocation+"/Packages"; … … 8 8 9 9 void PackageWizard::exec(){ 10 PackagePage2 *page2 = new PackagePage2( this->myLogger);10 PackagePage2 *page2 = new PackagePage2(); 11 11 PackagePage3 *page3 = new PackagePage3(); 12 12 PackagePage4 *page4 = new PackagePage4(); … … 58 58 this->vagoSettings->setValue("PackageCreator/CreateZip",createZip); 59 59 60 const QString packageName=packageNumber+Util:: fullTrim(modName);60 const QString packageName=packageNumber+Util::String::fullTrim(modName); 61 61 62 62 // Start package creation... … … 88 88 89 89 if (!modInfo.open(QIODevice::WriteOnly | QIODevice::Text)){ //open to write 90 UtilVago::showAndLogErrorPopUp( this->myLogger,"Couldn't create Mod_Info.cfg file when creating AE Package.");90 UtilVago::showAndLogErrorPopUp("Couldn't create Mod_Info.cfg file when creating AE Package."); 91 91 return; 92 92 } … … 124 124 if(createZip){ 125 125 if(!JlCompress::compressDir(this->packagesLocation+"/"+packageName+".zip", modDir)){ 126 UtilVago::showAndLogErrorPopUp( this->myLogger,"An error occurred while zipping the package.");126 UtilVago::showAndLogErrorPopUp("An error occurred while zipping the package."); 127 127 } 128 128 } … … 162 162 } 163 163 QDir().mkpath(path); //create path if doesn't exist 164 if(!Util:: copyDir(sourceFolder,path,false)){//copy contents (creates dest destination automatically if not exists yet)164 if(!Util::FileSystem::copyDir(sourceFolder,path,false)){//copy contents (creates dest destination automatically if not exists yet) 165 165 166 UtilVago::showAndLogErrorPopUpLogButton( this->myLogger,"An error occurred while copying the folder/files to the package folder: \n"166 UtilVago::showAndLogErrorPopUpLogButton("An error occurred while copying the folder/files to the package folder: \n" 167 167 "Copying from "+sourceFolder+"\n to "+path); 168 168 } -
s10k/Vago/packageWizard/packagewizard.h
r1061 r1093 20 20 void beforeClose(QDialog::DialogCode resultStatus); 21 21 protected: 22 PackageWizard(const QString &appDir, QString workspaceWizardLocation, QSettings *vagoSettings , Logger *myLogger);22 PackageWizard(const QString &appDir, QString workspaceWizardLocation, QSettings *vagoSettings); 23 23 void exec(); 24 24 }; -
s10k/Vago/preferences.cpp
r1054 r1093 38 38 void Preferences::accept (){ 39 39 QStringList options; 40 QRect screenRes = Util:: getScreenResolution();40 QRect screenRes = Util::System::getScreenResolution(); 41 41 42 42 options << ui->leAEfolder->text() << ui->leWorkspace->text() << ui->leWidth->text() << ui->leHeight->text(); 43 43 44 if(Util:: checkEmptySpaces(options)){45 Util:: showErrorPopUp("Setting not saved! There are empty settings.");44 if(Util::Validation::checkEmptySpaces(options)){ 45 Util::Dialogs::showError("Setting not saved! There are empty settings."); 46 46 return; 47 47 } 48 48 49 if(Util:: checkIfIntegers(QStringList() << ui->leWidth->text() << ui->leHeight->text() )){50 Util:: showErrorPopUp("Setting not saved! Width and Height must be numbers.");49 if(Util::Validation::checkIfIntegers(QStringList() << ui->leWidth->text() << ui->leHeight->text() )){ 50 Util::Dialogs::showError("Setting not saved! Width and Height must be numbers."); 51 51 return; 52 52 } 53 53 54 54 if(ui->leWidth->text().toInt() > screenRes.width() || ui->leHeight->text().toInt() > screenRes.height()){ 55 Util:: showErrorPopUp("Setting not saved! Width or Height specified are greater than actual screen resolution.");55 Util::Dialogs::showError("Setting not saved! Width or Height specified are greater than actual screen resolution."); 56 56 return; 57 57 } 58 58 59 59 if(ui->leWidth->text().toInt() <= 0 || ui->leHeight->text().toInt() <= 0 ){ 60 Util:: showErrorPopUp("Settings not saved! Width and Height must be greater than 0.");60 Util::Dialogs::showError("Settings not saved! Width and Height must be greater than 0."); 61 61 return; 62 62 } … … 74 74 #endif 75 75 76 Util:: showPopUp("You need to restart the application to all changes take effect.");76 Util::Dialogs::showInfo("You need to restart the application to all changes take effect."); 77 77 78 78 QDialog::accept(); … … 82 82 { 83 83 QString newDir=QFileDialog::getExistingDirectory(this,"Choose workspace folder..."); 84 newDir=Util:: normalizePath(newDir);84 newDir=Util::FileSystem::normalizePath(newDir); 85 85 86 86 if(!newDir.isEmpty()){ … … 92 92 { 93 93 QString newDir=QFileDialog::getExistingDirectory(this,"Choose AE folder..."); 94 newDir=Util:: normalizePath(newDir);94 newDir=Util::FileSystem::normalizePath(newDir); 95 95 96 96 if(!newDir.isEmpty()){ -
s10k/Vago/readme.txt
r1062 r1093 1 1 Readme.txt 2 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 Vago GUI v1. 33 Vago GUI v1.4 4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 5 … … 37 37 ---------------------------------- 38 38 Change Log: 39 ---------------------------------- 40 1.4, 30-12-2017 41 - Fixed crash when abort window was confirmed after the conversion has finished 42 - Replaced our custom log class by the plog library 43 - Fixed paragraphs not being created in "Window messages wizard" 44 - Added extensions validations to the conversions 45 - Add "Standing Pose" to ONCC extraction (-noanim) 46 - Fixed some inconsistencies of disabled options, now if a option changes states to invalid 47 (can't be used with current conversion), it is simply disabled and not used, but will remain 48 with the state unchanged (e.g. the checkbox may remain checked) 49 - Fixed bug in Textures tab, options didn't get disabled once enabled (when TGA -> TXMP) 50 - Added internal upgrade vago projects feature (so the vago projects can be updated over time depending on each 51 Vago version changes) 52 - Some code refactoring to make the code more modular and easier to build (now uses s10k's "shared" libraries for 53 qtcreator projects) 39 54 ---------------------------------- 40 55 1.3, 09-12-2016 -
s10k/Vago/soundWizard/soundpage2.cpp
r801 r1093 55 55 56 56 if(size==0){ 57 Util:: showPopUp("Select a row first.");57 Util::Dialogs::showInfo("Select a row first."); 58 58 return; 59 59 } 60 60 61 if(Util:: showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){61 if(Util::Dialogs::showQuestion(this,"Are you sure you want to delete the selected rows?")){ 62 62 for(int i=0; i<size; i++){ 63 63 ui->twSoundFiles->removeRow(ui->twSoundFiles->selectionModel()->selectedRows().at(size-i-1).row()); … … 71 71 72 72 //Pre-processing (check if received only folders) 73 for each(QString myFile,resources){73 for(const QString &myFile : resources){ 74 74 QString currFileExt="."+QFileInfo(myFile).completeSuffix(); 75 75 if(QDir(myFile).exists()){ 76 Util:: showErrorPopUp("Only files are allowed for this operation.");76 Util::Dialogs::showError("Only files are allowed for this operation."); 77 77 return; 78 78 } 79 79 80 for each(QString vext,this->allowedFiles){80 for(QString vext : this->allowedFiles){ 81 81 vext.remove("*"); 82 82 if(currFileExt.endsWith(vext)){ … … 87 87 88 88 if(!fileExtValid){ 89 Util:: showErrorPopUp("Files must be in the follow formats:\n" +89 Util::Dialogs::showError("Files must be in the follow formats:\n" + 90 90 this->allowedFiles.join(" ")); 91 91 return; … … 93 93 } 94 94 95 for each(QString currentFile,resources){95 for(const QString ¤tFile : resources){ 96 96 97 97 //Get actual number rows … … 103 103 //Add to table and list to 104 104 QTableWidgetItem *newName = new QTableWidgetItem(QFileInfo(currentFile).baseName()); 105 QTableWidgetItem *newFileLocation = new QTableWidgetItem(Util:: normalizePath(currentFile));105 QTableWidgetItem *newFileLocation = new QTableWidgetItem(Util::FileSystem::normalizePath(currentFile)); 106 106 107 107 myTable->setItem(twSize,0,newName); … … 125 125 126 126 if(ui->twSoundFiles->rowCount()==0){ 127 Util:: showErrorPopUp("You need to add some sound files first!");127 Util::Dialogs::showError("You need to add some sound files first!"); 128 128 return false; 129 129 } … … 133 133 } 134 134 135 if(ui->rbOther->isChecked() && Util:: checkEmptySpaces(QStringList() << ui->leOtherLocation->text())){136 Util:: showErrorPopUp("Please input a directory to output the files.");135 if(ui->rbOther->isChecked() && Util::Validation::checkEmptySpaces(QStringList() << ui->leOtherLocation->text())){ 136 Util::Dialogs::showError("Please input a directory to output the files."); 137 137 return false; 138 138 } 139 139 140 140 if(ui->rbOther->isChecked() && !QDir(ui->leOtherLocation->text()).exists()){ 141 Util:: showErrorPopUp("Invalid directory specified in other location. Please fix it.");141 Util::Dialogs::showError("Invalid directory specified in other location. Please fix it."); 142 142 return false; 143 143 } -
s10k/Vago/soundWizard/soundpage3.cpp
r771 r1093 34 34 << ui->leTreshold->text(); 35 35 36 if(Util:: checkEmptySpaces(leContents)){37 Util:: showErrorPopUp("Please fill all fields first!");36 if(Util::Validation::checkEmptySpaces(leContents)){ 37 Util::Dialogs::showError("Please fill all fields first!"); 38 38 return false; 39 39 } 40 40 41 if(Util:: checkIfDoubles(leContents)){42 Util:: showErrorPopUp("All fields must contains numbers!");41 if(Util::Validation::checkIfDoubles(leContents)){ 42 Util::Dialogs::showError("All fields must contains numbers!"); 43 43 return false; 44 44 } -
s10k/Vago/soundWizard/soundpage4.cpp
r771 r1093 30 30 << ui->leWeight->text(); 31 31 32 if(Util:: checkEmptySpaces(leContents)){33 Util:: showErrorPopUp("Please fill all fields first!");32 if(Util::Validation::checkEmptySpaces(leContents)){ 33 Util::Dialogs::showError("Please fill all fields first!"); 34 34 return false; 35 35 } 36 36 37 if(Util:: checkIfDoubles(leContents)){38 Util:: showErrorPopUp("All fields must contains numbers!");37 if(Util::Validation::checkIfDoubles(leContents)){ 38 Util::Dialogs::showError("All fields must contains numbers!"); 39 39 return false; 40 40 } -
s10k/Vago/soundWizard/soundpage5.cpp
r1054 r1093 29 29 ui->leImpactVelocity->text() << ui->leMinOcclusion->text(); 30 30 31 if(Util:: checkEmptySpaces(leContents)){32 Util:: showErrorPopUp("Please fill all fields first!");31 if(Util::Validation::checkEmptySpaces(leContents)){ 32 Util::Dialogs::showError("Please fill all fields first!"); 33 33 return false; 34 34 } 35 35 36 if(Util:: checkIfDoubles(leContents)){37 Util:: showErrorPopUp("All fields must contains numbers!");36 if(Util::Validation::checkIfDoubles(leContents)){ 37 Util::Dialogs::showError("All fields must contains numbers!"); 38 38 return false; 39 39 } -
s10k/Vago/soundWizard/soundpagefinal.cpp
r1061 r1093 2 2 #include "ui_soundpagefinal.h" 3 3 4 SoundPageFinal::SoundPageFinal(QString AppDir, QString soundsLocation, DropTableWidget *page2Table, Logger *myLogger,QHash<QString, QString> *commandMap, QWidget *parent) :4 SoundPageFinal::SoundPageFinal(QString AppDir, QString soundsLocation, DropTableWidget *page2Table, QHash<QString, QString> *commandMap, QWidget *parent) : 5 5 QWizardPage(parent), 6 6 ui(new Ui::soundpagefinal) … … 9 9 this->soundsLocation=soundsLocation; 10 10 this->page2Table=page2Table; 11 this->myLogger=myLogger;12 11 this->commandMap=commandMap; 13 12 14 13 this->xmlCommands = new QStringList(); 15 14 this->oniSplitCommands = new QStringList(); 16 this->myXmlProcessor = new XmlProcessor(AppDir, this-> myLogger,this->xmlCommands);17 this->myConverter = new Converter(AppDir, this->myLogger,this->oniSplitCommands);15 this->myXmlProcessor = new XmlProcessor(AppDir, this->xmlCommands); 16 this->myConverter = new Converter(AppDir,this->oniSplitCommands); 18 17 19 18 ui->lbComplete->setText("<html>The wizard is now complete. The sounds have been converted. " … … 126 125 } 127 126 128 sphereRadious=Util:: normalizeDecimalSeparator(field("leSphereRadious").toString());129 minElapsedTime=Util:: normalizeDecimalSeparator(field("leMinElapsedTime").toString());130 maxElapsedTime=Util:: normalizeDecimalSeparator(field("leMaxElapsedTime").toString());131 minVolumeDistance=Util:: normalizeDecimalSeparator(field("leMinVolumeDistance").toString());132 maxVolumeDistance=Util:: normalizeDecimalSeparator(field("leMaxVolumeDistance").toString());133 minOcclusion=Util:: normalizeDecimalSeparator(field("leMinOcclusion").toString());134 treshold=Util:: normalizeDecimalSeparator(field("leTreshold").toString());127 sphereRadious=Util::String::normalizeDecimalSeparator(field("leSphereRadious").toString()); 128 minElapsedTime=Util::String::normalizeDecimalSeparator(field("leMinElapsedTime").toString()); 129 maxElapsedTime=Util::String::normalizeDecimalSeparator(field("leMaxElapsedTime").toString()); 130 minVolumeDistance=Util::String::normalizeDecimalSeparator(field("leMinVolumeDistance").toString()); 131 maxVolumeDistance=Util::String::normalizeDecimalSeparator(field("leMaxVolumeDistance").toString()); 132 minOcclusion=Util::String::normalizeDecimalSeparator(field("leMinOcclusion").toString()); 133 treshold=Util::String::normalizeDecimalSeparator(field("leTreshold").toString()); 135 134 136 135 // Get data page 4 137 136 138 volume=Util:: normalizeDecimalSeparator(field("leVolume").toString());139 minVolume=Util:: normalizeDecimalSeparator(field("leMinVolume").toString());140 maxVolume=Util:: normalizeDecimalSeparator(field("leMaxVolume").toString());141 pitch=Util:: normalizeDecimalSeparator(field("lePitch").toString());142 minPitch=Util:: normalizeDecimalSeparator(field("leMinPitch").toString());143 maxPitch=Util:: normalizeDecimalSeparator(field("leMaxPitch").toString());144 weight=Util:: normalizeDecimalSeparator(field("leWeight").toString());137 volume=Util::String::normalizeDecimalSeparator(field("leVolume").toString()); 138 minVolume=Util::String::normalizeDecimalSeparator(field("leMinVolume").toString()); 139 maxVolume=Util::String::normalizeDecimalSeparator(field("leMaxVolume").toString()); 140 pitch=Util::String::normalizeDecimalSeparator(field("lePitch").toString()); 141 minPitch=Util::String::normalizeDecimalSeparator(field("leMinPitch").toString()); 142 maxPitch=Util::String::normalizeDecimalSeparator(field("leMaxPitch").toString()); 143 weight=Util::String::normalizeDecimalSeparator(field("leWeight").toString()); 145 144 146 145 preventRepeat=field("cbPreventRepeat").toBool(); … … 176 175 } 177 176 178 minVolumeDistanceImp=Util:: normalizeDecimalSeparator(field("leMinVolumeDistanceImp").toString());179 maxVolumeDistanceImp=Util:: normalizeDecimalSeparator(field("leMaxVolumeDistanceImp").toString());180 minAngleImp=Util:: normalizeDecimalSeparator(field("leMinAngleImp").toString());181 maxAngleImp=Util:: normalizeDecimalSeparator(field("leMaxAngleImp").toString());182 minAttenuationImp=Util:: normalizeDecimalSeparator(field("leMinAttenuationImp").toString());183 impactVelocityImp=Util:: normalizeDecimalSeparator(field("leImpactVelocityImp").toString());184 minOcclusionImp=Util:: normalizeDecimalSeparator(field("leMinOcclusionImp").toString());177 minVolumeDistanceImp=Util::String::normalizeDecimalSeparator(field("leMinVolumeDistanceImp").toString()); 178 maxVolumeDistanceImp=Util::String::normalizeDecimalSeparator(field("leMaxVolumeDistanceImp").toString()); 179 minAngleImp=Util::String::normalizeDecimalSeparator(field("leMinAngleImp").toString()); 180 maxAngleImp=Util::String::normalizeDecimalSeparator(field("leMaxAngleImp").toString()); 181 minAttenuationImp=Util::String::normalizeDecimalSeparator(field("leMinAttenuationImp").toString()); 182 impactVelocityImp=Util::String::normalizeDecimalSeparator(field("leImpactVelocityImp").toString()); 183 minOcclusionImp=Util::String::normalizeDecimalSeparator(field("leMinOcclusionImp").toString()); 185 184 186 185 //######################################################### Starting xml processing 187 186 188 187 // Clean tmp dir 189 if(!Util:: rmDir(GlobalVars::VagoTemporaryDir)){190 UtilVago::showAndLogErrorPopUpLogButton( this->myLogger,"Couldn't clean vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir);188 if(!Util::FileSystem::rmDir(GlobalVars::VagoTemporaryDir)){ 189 UtilVago::showAndLogErrorPopUpLogButton("Couldn't clean vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir); 191 190 return; 192 191 } 193 192 194 193 if(!QDir(QDir::tempPath()).mkpath("VagoTemp")){ 195 UtilVago::showAndLogErrorPopUpLogButton( this->myLogger,"Couldn't reconstruct vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir);194 UtilVago::showAndLogErrorPopUpLogButton("Couldn't reconstruct vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir); 196 195 } 197 196 … … 205 204 206 205 (*this->xmlCommands) 207 << "--replace-all-values -e Priority -n "+Util:: insertQuotes(priority)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"208 << "--replace-all-values -e Flags -n "+(flags.join(" ").isEmpty() ? Util:: insertQuotes("") : Util::insertQuotes(flags.join(" ")))+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"209 << "--replace-all-values -e SphereRadius -n "+Util:: insertQuotes(sphereRadious)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"210 << "--replace-all-values -e Treshold -n "+Util:: insertQuotes(treshold)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"211 << "--replace-all-values -e MinOcclusion -n "+Util:: insertQuotes(minOcclusion)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"212 << "--replace-all-values --parent-element-name ElapsedTime -e Max -n "+Util:: insertQuotes(maxElapsedTime)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"213 << "--replace-all-values --parent-element-name ElapsedTime -e Min -n "+Util:: insertQuotes(minElapsedTime)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"214 << "--replace-all-values --parent-element-name Distance -e Max -n "+Util:: insertQuotes(maxVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"215 << "--replace-all-values --parent-element-name Distance -e Min -n "+Util:: insertQuotes(minVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"216 << "--replace-all-values --parent-element-name SoundGroup -e Volume -n "+Util:: insertQuotes(volume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"217 << "--replace-all-values --parent-element-name SoundGroup -e Pitch -n "+Util:: insertQuotes(pitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"218 << "--replace-all-values --parent-element-name SoundGroup -e NumberOfChannels -n "+Util:: insertQuotes(numberChannels)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"219 << "--replace-all-values --parent-element-name Volume -e Min -n "+Util:: insertQuotes(minVolume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"220 << "--replace-all-values --parent-element-name Volume -e Max -n "+Util:: insertQuotes(maxVolume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"221 << "--replace-all-values --parent-element-name Pitch -e Min -n "+Util:: insertQuotes(minPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"222 << "--replace-all-values --parent-element-name Pitch -e Max -n "+Util:: insertQuotes(maxPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"223 << "--replace-all-values -e Weight -n "+Util:: insertQuotes(weight)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"224 << "--replace-all-values -e Priority -n "+Util:: insertQuotes(priorityImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"225 << "--replace-all-values --parent-element-name Distance -e Min -n "+Util:: insertQuotes(minVolumeDistanceImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"226 << "--replace-all-values --parent-element-name Distance -e Max -n "+Util:: insertQuotes(maxVolumeDistanceImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"227 << "--replace-all-values --parent-element-name Angle -e Min -n "+Util:: insertQuotes(minAngleImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"228 << "--replace-all-values --parent-element-name Angle -e Max -n "+Util:: insertQuotes(maxAngleImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"229 << "--replace-all-values -e MinAttenuation -n "+Util:: insertQuotes(minAttenuationImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"230 << "--replace-all-values -e ImpactVelocity -n "+Util:: insertQuotes(impactVelocityImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"231 << "--replace-all-values -e MinOcclusion -n "+Util:: insertQuotes(minOcclusionImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose";206 << "--replace-all-values -e Priority -n "+Util::String::insertQuotes(priority)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 207 << "--replace-all-values -e Flags -n "+(flags.join(" ").isEmpty() ? Util::String::insertQuotes("") : Util::String::insertQuotes(flags.join(" ")))+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 208 << "--replace-all-values -e SphereRadius -n "+Util::String::insertQuotes(sphereRadious)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 209 << "--replace-all-values -e Treshold -n "+Util::String::insertQuotes(treshold)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 210 << "--replace-all-values -e MinOcclusion -n "+Util::String::insertQuotes(minOcclusion)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 211 << "--replace-all-values --parent-element-name ElapsedTime -e Max -n "+Util::String::insertQuotes(maxElapsedTime)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 212 << "--replace-all-values --parent-element-name ElapsedTime -e Min -n "+Util::String::insertQuotes(minElapsedTime)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 213 << "--replace-all-values --parent-element-name Distance -e Max -n "+Util::String::insertQuotes(maxVolumeDistance)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 214 << "--replace-all-values --parent-element-name Distance -e Min -n "+Util::String::insertQuotes(minVolumeDistance)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" 215 << "--replace-all-values --parent-element-name SoundGroup -e Volume -n "+Util::String::insertQuotes(volume)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 216 << "--replace-all-values --parent-element-name SoundGroup -e Pitch -n "+Util::String::insertQuotes(pitch)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 217 << "--replace-all-values --parent-element-name SoundGroup -e NumberOfChannels -n "+Util::String::insertQuotes(numberChannels)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 218 << "--replace-all-values --parent-element-name Volume -e Min -n "+Util::String::insertQuotes(minVolume)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 219 << "--replace-all-values --parent-element-name Volume -e Max -n "+Util::String::insertQuotes(maxVolume)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 220 << "--replace-all-values --parent-element-name Pitch -e Min -n "+Util::String::insertQuotes(minPitch)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 221 << "--replace-all-values --parent-element-name Pitch -e Max -n "+Util::String::insertQuotes(maxPitch)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 222 << "--replace-all-values -e Weight -n "+Util::String::insertQuotes(weight)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" 223 << "--replace-all-values -e Priority -n "+Util::String::insertQuotes(priorityImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose" 224 << "--replace-all-values --parent-element-name Distance -e Min -n "+Util::String::insertQuotes(minVolumeDistanceImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose" 225 << "--replace-all-values --parent-element-name Distance -e Max -n "+Util::String::insertQuotes(maxVolumeDistanceImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose" 226 << "--replace-all-values --parent-element-name Angle -e Min -n "+Util::String::insertQuotes(minAngleImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose" 227 << "--replace-all-values --parent-element-name Angle -e Max -n "+Util::String::insertQuotes(maxAngleImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose" 228 << "--replace-all-values -e MinAttenuation -n "+Util::String::insertQuotes(minAttenuationImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose" 229 << "--replace-all-values -e ImpactVelocity -n "+Util::String::insertQuotes(impactVelocityImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose" 230 << "--replace-all-values -e MinOcclusion -n "+Util::String::insertQuotes(minOcclusionImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"; 232 231 233 232 if(preventRepeat){ 234 (*this->xmlCommands) << "--replace-all-values --parent-element-name SoundGroup -e Flags -n PreventRepeat -f "+Util:: insertQuotes(grpFileLocation)+" --no-backups --no-verbose";233 (*this->xmlCommands) << "--replace-all-values --parent-element-name SoundGroup -e Flags -n PreventRepeat -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"; 235 234 } 236 235 … … 245 244 for(int i=0; i<this->page2Table->rowCount(); i++){ 246 245 247 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util:: insertQuotes(outputFolder)+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert246 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert 248 247 249 248 currFileName=this->page2Table->item(i,0)->text(); // get current file name … … 256 255 QFile::copy(impFileLocation, currImpFileLocation); 257 256 258 (*this->xmlCommands) << "--replace-all-values -e BaseTrack1 -n "+Util:: insertQuotes(currFileName)+" -f "+Util::insertQuotes(currAmbFileLocation)+" --no-backups --no-verbose" // process the xml259 << "--replace-all-values -e Sound -n "+Util:: insertQuotes(currFileName)+" -f "+Util::insertQuotes(currGrpFileLocation)+" --no-backups --no-verbose"260 << "--replace-all-values -e Group -n "+Util:: insertQuotes(currFileName)+" -f "+Util::insertQuotes(currImpFileLocation)+" --no-backups --no-verbose";257 (*this->xmlCommands) << "--replace-all-values -e BaseTrack1 -n "+Util::String::insertQuotes(currFileName)+" -f "+Util::String::insertQuotes(currAmbFileLocation)+" --no-backups --no-verbose" // process the xml 258 << "--replace-all-values -e Sound -n "+Util::String::insertQuotes(currFileName)+" -f "+Util::String::insertQuotes(currGrpFileLocation)+" --no-backups --no-verbose" 259 << "--replace-all-values -e Group -n "+Util::String::insertQuotes(currFileName)+" -f "+Util::String::insertQuotes(currImpFileLocation)+" --no-backups --no-verbose"; 261 260 262 261 myXmlProcessor->start(); 263 262 myXmlProcessor->wait(); // Wait until all xml is edited 264 263 265 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util:: insertQuotes(outputFolder)+" "+Util::insertQuotes(currAmbFileLocation);266 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util:: insertQuotes(outputFolder)+" "+Util::insertQuotes(currGrpFileLocation);267 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util:: insertQuotes(outputFolder)+" "+Util::insertQuotes(currImpFileLocation);264 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(currAmbFileLocation); 265 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(currGrpFileLocation); 266 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(currImpFileLocation); 268 267 } 269 268 -
s10k/Vago/soundWizard/soundpagefinal.h
r1061 r1093 7 7 #include <droptablewidget.h> 8 8 9 #include "logger.h"10 9 #include "xmlprocessor.h" 11 10 #include "converter.h" … … 20 19 21 20 public: 22 explicit SoundPageFinal(QString AppDir, QString soundsLocation, DropTableWidget *page2Table, Logger *myLogger,QHash<QString, QString> *commandMap, QWidget *parent = 0);21 explicit SoundPageFinal(QString AppDir, QString soundsLocation, DropTableWidget *page2Table, QHash<QString, QString> *commandMap, QWidget *parent = 0); 23 22 ~SoundPageFinal(); 24 23 … … 27 26 Ui::soundpagefinal *ui; 28 27 DropTableWidget *page2Table; 29 Logger *myLogger;30 28 XmlProcessor *myXmlProcessor; 31 29 Converter *myConverter; -
s10k/Vago/soundWizard/soundwizard.cpp
r1061 r1093 1 1 #include "soundwizard.h" 2 2 3 SoundWizard::SoundWizard(QString appDir, QString workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger,QHash<QString, QString> *commandMap)4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger,true)3 SoundWizard::SoundWizard(QString appDir, QString workspaceWizardLocation, QSettings *vagoSettings, QHash<QString, QString> *commandMap) 4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, true) 5 5 { 6 6 this->appDir=appDir; … … 14 14 SoundPage4 *page4 = new SoundPage4(); 15 15 SoundPage5 *page5 = new SoundPage5(); 16 SoundPageFinal *pageFinal = new SoundPageFinal(this->appDir, this->soundsLocation,page2->soundTable, this->myLogger,this->commandMap);16 SoundPageFinal *pageFinal = new SoundPageFinal(this->appDir, this->soundsLocation,page2->soundTable, this->commandMap); 17 17 18 18 this->myWizard.addPage -
s10k/Vago/soundWizard/soundwizard.h
r1061 r1093 14 14 #include "util.h" 15 15 #include "abstractwizard.h" 16 #include "logger.h"17 16 #include "soundpage2.h" 18 17 #include "soundpage3.h" … … 24 23 { 25 24 protected: 26 SoundWizard(QString appLocation, QString workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger,QHash<QString, QString> *commandMap);25 SoundWizard(QString appLocation, QString workspaceWizardLocation, QSettings *vagoSettings, QHash<QString, QString> *commandMap); 27 26 void exec(); 28 27 QHash<QString, QString> *commandMap; -
s10k/Vago/utilvago.cpp
r1054 r1093 7 7 } 8 8 9 void showAndLogWarningPopUp( Logger *logger,const QString &message){10 logger->writeString(message);9 void showAndLogWarningPopUp(const QString &message){ 10 LOG_WARNING << message; 11 11 12 12 QMessageBox msgBox; … … 30 30 31 31 //Same of above but also writtes directly to the log file the error 32 void showAndLogWarningPopUpLogButton( Logger *logger,const QString &message){32 void showAndLogWarningPopUpLogButton(const QString &message){ 33 33 34 logger->writeString(message);34 LOG_WARNING << message; 35 35 36 36 QMessageBox msgBox; … … 45 45 } 46 46 47 void showAndLogErrorPopUp( Logger *logger,const QString &message){47 void showAndLogErrorPopUp(const QString &message){ 48 48 49 logger->writeString(message);49 LOG_ERROR << message; 50 50 51 51 QMessageBox msgBox; … … 69 69 70 70 //Same of above but also writtes directly to the log file the error 71 void showAndLogErrorPopUpLogButton( Logger *logger,const QString &message){71 void showAndLogErrorPopUpLogButton(const QString &message){ 72 72 73 logger->writeString(message);73 LOG_ERROR << message; 74 74 75 75 QMessageBox msgBox; … … 118 118 119 119 #ifdef Q_OS_MAC 120 return getMonoExecutablePath() + " " + Util:: insertQuotes(getOniSplitExecutableAbsolutePath());120 return getMonoExecutablePath() + " " + Util::String::insertQuotes(getOniSplitExecutableAbsolutePath()); 121 121 #else 122 return Util:: insertQuotes(getOniSplitExecutableAbsolutePath());122 return Util::String::insertQuotes(getOniSplitExecutableAbsolutePath()); 123 123 #endif 124 124 } 125 125 126 126 QString getXmlToolsExecutable(){ 127 return Util:: insertQuotes(getXmlToolsExecutableAbsolutePath());127 return Util::String::insertQuotes(getXmlToolsExecutableAbsolutePath()); 128 128 } 129 129 … … 144 144 #endif 145 145 146 QString getDateTimeFormatForFilename(const QDateTime ¤tDateTime){ 147 return currentDateTime.toString("yyyy-MM-dd_hh-mm-ss"); 146 148 } 149 150 } -
s10k/Vago/utilvago.h
r1061 r1093 2 2 #define UTILVAGO_H 3 3 4 #include "util.h" 5 #include "logger.h" 4 #include <util.h> 5 #include <cpp17optional/optional.hpp> 6 #include <plog/Log.h> 7 #include <plog/Converters/NativeEOLConverter.h> 8 9 #include <QDateTime> 6 10 7 11 namespace GlobalVars{ 8 12 9 const QString AppVersion="1. 3";10 const QString LastCompatibleVersion = "1. 0";13 const QString AppVersion="1.4"; 14 const QString LastCompatibleVersion = "1.4"; 11 15 const QString ToolsFolder = "tools"; 12 16 const QString OniSplitString="OniSplit.exe"; … … 46 50 namespace UtilVago{ 47 51 void openLogFile(); 48 void showAndLogWarningPopUp( Logger *logger,const QString &message);52 void showAndLogWarningPopUp(const QString &message); 49 53 void showWarningPopUpLogButton(const QString &message); 50 void showAndLogWarningPopUpLogButton( Logger *logger,const QString &message);51 void showAndLogErrorPopUp( Logger *logger,const QString &message);54 void showAndLogWarningPopUpLogButton(const QString &message); 55 void showAndLogErrorPopUp(const QString &message); 52 56 void showErrorPopUpLogButton(const QString &message); 53 void showAndLogErrorPopUpLogButton( Logger *logger,const QString &message);57 void showAndLogErrorPopUpLogButton(const QString &message); 54 58 QString getOSIndependentAppPath(); 55 59 QString getAppPath(); … … 61 65 QString getMonoExecutablePath(); 62 66 #endif 67 QString getDateTimeFormatForFilename(const QDateTime ¤tDateTime); 63 68 } 64 69 -
s10k/Vago/windowMessagesWizard/wmfinalpage.cpp
r1063 r1093 2 2 #include "ui_wmfinalpage.h" 3 3 4 WmFinalPage::WmFinalPage(QString AppDir, QString wmLocation, Logger *myLogger,QList<std::shared_ptr<WmPage> > &pages, QWidget *parent) :4 WmFinalPage::WmFinalPage(QString AppDir, QString wmLocation, QList<std::shared_ptr<WmPage> > &pages, QWidget *parent) : 5 5 QWizardPage(parent), ui(new Ui::wmfinalpage), pages(pages) 6 6 { 7 7 ui->setupUi(this); 8 8 this->wmLocation=wmLocation; 9 this->myLogger=myLogger;10 9 11 10 this->oniSplitCommands = new QStringList(); 12 this->myConverter = new Converter(AppDir, this-> myLogger,this->oniSplitCommands);11 this->myConverter = new Converter(AppDir, this->oniSplitCommands); 13 12 14 13 ui->lbComplete->setText("<html>The wizard is now complete. The window messages have been converted. " … … 55 54 typeNode = rootNode.append_child("OPge"); 56 55 typeNode.append_attribute("id").set_value(++globalSectionCounter); 57 typeNode.append_child("LevelNumber").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(field("leLevelId").toString()));58 typeNode.append_child("Pages").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(QString("#") + QString::number(++globalSectionCounter)));56 typeNode.append_child("LevelNumber").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(field("leLevelId").toString())); 57 typeNode.append_child("Pages").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(QString("#") + QString::number(++globalSectionCounter))); 59 58 pugi::xml_node igpaNode = rootNode.append_child("IGPA"); 60 59 igpaNode.append_attribute("id").set_value(globalSectionCounter); … … 62 61 currentIGPGId = globalSectionCounter; 63 62 for(int i=0; i<this->pages.size(); i++){ 64 pagesNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));63 pagesNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 65 64 } 66 65 break; … … 69 68 typeNode = rootNode.append_child("DPge"); 70 69 typeNode.append_attribute("id").set_value(++globalSectionCounter); 71 typeNode.append_child("LevelNumber").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(field("leLevelId").toString()));72 typeNode.append_child("PageNumber").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(field("lePageNumber").toString()));73 typeNode.append_child("IsLearnedMove").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(QString::number(static_cast<int>(field("cbIsLearnedMove").toBool()))));74 currentIGPGId = globalSectionCounter; 75 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));70 typeNode.append_child("LevelNumber").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(field("leLevelId").toString())); 71 typeNode.append_child("PageNumber").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(field("lePageNumber").toString())); 72 typeNode.append_child("IsLearnedMove").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(QString::number(static_cast<int>(field("cbIsLearnedMove").toBool())))); 73 currentIGPGId = globalSectionCounter; 74 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 76 75 break; 77 76 case WINDOW_TYPE::HELP: … … 79 78 typeNode.append_attribute("id").set_value(++globalSectionCounter); 80 79 currentIGPGId = globalSectionCounter; 81 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));80 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 82 81 break; 83 82 case WINDOW_TYPE::TEXT_CONSOLE: … … 85 84 typeNode = rootNode.append_child("TxtC"); 86 85 typeNode.append_attribute("id").set_value(++globalSectionCounter); 87 typeNode.append_child("Pages").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));86 typeNode.append_child("Pages").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 88 87 pugi::xml_node igpaNode = rootNode.append_child("IGPA"); 89 88 igpaNode.append_attribute("id").set_value(globalSectionCounter); … … 91 90 pugi::xml_node pagesNode = igpaNode.append_child("Pages"); 92 91 for(int i=0; i<this->pages.size(); i++){ 93 pagesNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));92 pagesNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 94 93 } 95 94 break; … … 98 97 typeNode = rootNode.append_child("WPge"); 99 98 typeNode.append_attribute("id").set_value(++globalSectionCounter); 100 typeNode.append_child("WeaponClass").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(field("leWeaponClassName").toString()));101 currentIGPGId = globalSectionCounter; 102 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));99 typeNode.append_child("WeaponClass").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(field("leWeaponClassName").toString())); 100 currentIGPGId = globalSectionCounter; 101 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 103 102 break; 104 103 case WINDOW_TYPE::ITEM: 105 104 typeNode = rootNode.append_child("IPge"); 106 105 typeNode.append_attribute("id").set_value(++globalSectionCounter); 107 typeNode.append_child("PageNumber").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(field("lePageNumber").toString()));108 currentIGPGId = globalSectionCounter; 109 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));106 typeNode.append_child("PageNumber").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(field("lePageNumber").toString())); 107 currentIGPGId = globalSectionCounter; 108 typeNode.append_child("Page").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 110 109 break; 111 110 case WINDOW_TYPE::ENUM_END: 112 UtilVago::showAndLogErrorPopUp( this->myLogger,"An error ocurred: WmFinalPage::startProcessing invalid WINDOW_TYPE");111 UtilVago::showAndLogErrorPopUp("An error ocurred: WmFinalPage::startProcessing invalid WINDOW_TYPE"); 113 112 break; 114 113 } … … 132 131 133 132 this->oniSplitCommands->clear(); 134 this->oniSplitCommands->append("-create:txmp " + Util:: insertQuotes(this->wmLocation) + " -format:bgr32 " + Util::insertQuotes(imageLocation));133 this->oniSplitCommands->append("-create:txmp " + Util::String::insertQuotes(this->wmLocation) + " -format:bgr32 " + Util::String::insertQuotes(imageLocation)); 135 134 136 135 this->myConverter->start(); // finally process the onisplit commands … … 152 151 currentIGSAId = globalSectionCounter; 153 152 154 igpgNode.append_child("Image").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(imageTXMPName));155 igpgNode.append_child("Text1").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));156 igpgNode.append_child("Text2").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));153 igpgNode.append_child("Image").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(imageTXMPName)); 154 igpgNode.append_child("Text1").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 155 igpgNode.append_child("Text2").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 157 156 158 157 // IGSA … … 166 165 167 166 for(int i=0; i<mainTextNumberOfRows; i++){ 168 igsaMainTextStringsNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));167 igsaMainTextStringsNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 169 168 } 170 169 … … 174 173 pugi::xml_node igsaFooterTextStringsNode = igsaFooterTextNode.append_child("Strings"); 175 174 for(int i=0; i<footerTextNumberOfRows; i++){ 176 igsaFooterTextStringsNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("#" + QString::number(++globalSectionCounter)));175 igsaFooterTextStringsNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("#" + QString::number(++globalSectionCounter))); 177 176 } 178 177 … … 202 201 203 202 pugi::xml_node igstMainTextFontNode = igstMainTextNode.append_child("Font"); 204 igstMainTextFontNode.append_child("Family").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr("TSFF" + format.font().family()));205 igstMainTextFontNode.append_child("Style").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(style));206 igstMainTextFontNode.append_child("Color").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(colorRGB));207 igstMainTextFontNode.append_child("Size").append_child(pugi::xml_node_type::node_pcdata).set_value( Util::qStrToCstr(QString::number(format.font().pointSize())));203 igstMainTextFontNode.append_child("Family").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR("TSFF" + format.font().family())); 204 igstMainTextFontNode.append_child("Style").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(style)); 205 igstMainTextFontNode.append_child("Color").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(colorRGB)); 206 igstMainTextFontNode.append_child("Size").append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(QString::number(format.font().pointSize()))); 208 207 igstMainTextFontNode.append_child("Flags").append_child(pugi::xml_node_type::node_pcdata).set_value("Family Style Color Size"); 209 208 210 igstMainTextNode.append_child("Text").append_child(pugi::xml_node_type::node_pcdata).set_value(Util::qStrToCstr(currentCursor.selection().toPlainText())); 209 QString currentRowText = currentCursor.selection().toPlainText(); 210 211 pugi::xml_node currentIGStNode = igstMainTextNode.append_child("Text"); 212 213 if(!currentRowText.trimmed().isEmpty()){ 214 currentIGStNode.append_child(pugi::xml_node_type::node_pcdata).set_value(QSTR_TO_CSTR(currentRowText)); 215 } 216 else{ 217 // Empty paragraph use OniSplit correct representation (<Text xml:space="preserve"> </Text>) 218 currentIGStNode.append_child(pugi::xml_node_type::node_pcdata).set_value(" "); 219 currentIGStNode.append_attribute("xml:space").set_value("preserve"); 220 } 211 221 } 212 222 … … 220 230 } 221 231 222 if(!doc.save_file( Util::qStrToCstr(filePath))){223 UtilVago::showAndLogErrorPopUpLogButton( this->myLogger,"Couldn't create " + filePath + " file!");232 if(!doc.save_file(QSTR_TO_CSTR(filePath))){ 233 UtilVago::showAndLogErrorPopUpLogButton("Couldn't create " + filePath + " file!"); 224 234 return; 225 235 } … … 227 237 // Convert XML file to Oni 228 238 this->oniSplitCommands->clear(); 229 this->oniSplitCommands->append("-create " + Util:: insertQuotes(this->wmLocation) + " " + Util::insertQuotes(filePath));239 this->oniSplitCommands->append("-create " + Util::String::insertQuotes(this->wmLocation) + " " + Util::String::insertQuotes(filePath)); 230 240 231 241 this->myConverter->start(); // finally process the onisplit commands -
s10k/Vago/windowMessagesWizard/wmfinalpage.h
r1061 r1093 6 6 #include <QUrl> 7 7 #include <droptablewidget.h> 8 #include <pugixml .hpp>8 #include <pugixml/pugixml.hpp> 9 9 10 #include "logger.h"11 10 #include "xmlprocessor.h" 12 11 #include "converter.h" … … 23 22 24 23 public: 25 explicit WmFinalPage(QString AppDir, QString wmLocation, Logger *myLogger,QList<std::shared_ptr<WmPage> > &pages, QWidget *parent = 0);24 explicit WmFinalPage(QString AppDir, QString wmLocation, QList<std::shared_ptr<WmPage> > &pages, QWidget *parent = 0); 26 25 ~WmFinalPage(); 27 26 … … 29 28 QString wmLocation; 30 29 Ui::wmfinalpage *ui; 31 Logger *myLogger;32 30 Converter *myConverter; 33 31 QStringList *oniSplitCommands; -
s10k/Vago/windowMessagesWizard/wmformatpage.cpp
r1061 r1093 2 2 #include "ui_wmformatpage.h" 3 3 4 WmFormatPage::WmFormatPage( Logger *myLogger,QWidget *parent) :4 WmFormatPage::WmFormatPage(QWidget *parent) : 5 5 QWizardPage(parent), 6 6 ui(new Ui::WmFormatPage) 7 7 { 8 8 ui->setupUi(this); 9 10 this->myLogger = myLogger;11 9 12 10 this->setTitle("Pages Formatting"); … … 51 49 break; 52 50 case WINDOW_TYPE::ENUM_END: 53 UtilVago::showAndLogErrorPopUp( this->myLogger,"An error ocurred: WmFormatPage::initializePage invalid WINDOW_TYPE");51 UtilVago::showAndLogErrorPopUp("An error ocurred: WmFormatPage::initializePage invalid WINDOW_TYPE"); 54 52 break; 55 53 } … … 72 70 ) 73 71 { 74 Util:: showErrorPopUp("You need to fill at least one text section in all pages!");72 Util::Dialogs::showError("You need to fill at least one text section in all pages!"); 75 73 return false; 76 74 } … … 80 78 // If we can add more than one page, ask the user if he already added them all 81 79 if(ui->pbAddPageAfter->isEnabled()){ 82 return Util:: showQuestionPopUp(this, "Have you added all the window pages?");80 return Util::Dialogs::showQuestion(this, "Have you added all the window pages?"); 83 81 } 84 82 … … 126 124 break; 127 125 case WINDOW_TYPE::ENUM_END: 128 UtilVago::showAndLogErrorPopUp( this->myLogger,"An error ocurred: WmFormatPage::addPage invalid WINDOW_TYPE");126 UtilVago::showAndLogErrorPopUp("An error ocurred: WmFormatPage::addPage invalid WINDOW_TYPE"); 129 127 break; 130 128 } … … 190 188 191 189 if(textEdits.size() == 0){ 192 Util:: showPopUp("Select some text first.");190 Util::Dialogs::showInfo("Select some text first."); 193 191 return; 194 192 } … … 252 250 253 251 if(!ok){ 254 Util:: showErrorPopUp("The inputted font size is not valid!");252 Util::Dialogs::showError("The inputted font size is not valid!"); 255 253 ui->cbTextSize->setCurrentIndex(0); // reset to default number 256 254 return; … … 279 277 { 280 278 if(ui->twPages->count() <= 1){ 281 Util:: showErrorPopUp("You must have at least one page!");279 Util::Dialogs::showError("You must have at least one page!"); 282 280 return; 283 281 } 284 282 285 if(Util:: showQuestionPopUp(this, "Are you sure do you want to delete the current page?")){283 if(Util::Dialogs::showQuestion(this, "Are you sure do you want to delete the current page?")){ 286 284 int indexToDelete = ui->twPages->currentIndex(); 287 285 -
s10k/Vago/windowMessagesWizard/wmformatpage.h
r1061 r1093 20 20 21 21 public: 22 explicit WmFormatPage( Logger *myLogger,QWidget *parent = 0);22 explicit WmFormatPage(QWidget *parent = 0); 23 23 QList<std::shared_ptr<WmPage> >& getCurrentPages(); 24 24 … … 56 56 QList<std::shared_ptr<WmPage>> currentPages; 57 57 bool windowsIsInitialized = false; 58 Logger *myLogger;59 58 60 59 private: -
s10k/Vago/windowMessagesWizard/wmsetuppage.cpp
r1061 r1093 46 46 } 47 47 48 if(Util:: checkEmptySpaces(stringsToCheck)){49 Util:: showErrorPopUp("You need to fill all fields first!");48 if(Util::Validation::checkEmptySpaces(stringsToCheck)){ 49 Util::Dialogs::showError("You need to fill all fields first!"); 50 50 return false; 51 51 } … … 62 62 } 63 63 64 if(!Util:: isStringInteger(arg1)){65 Util:: showErrorPopUp("The level id inputted is invalid! It must be a number.");64 if(!Util::Validation::isStringInteger(arg1)){ 65 Util::Dialogs::showError("The level id inputted is invalid! It must be a number."); 66 66 return; 67 67 } … … 91 91 } 92 92 93 if(!Util:: isStringInteger(arg1)){94 Util:: showErrorPopUp("The page number inputted is invalid! It must be a number.");93 if(!Util::Validation::isStringInteger(arg1)){ 94 Util::Dialogs::showError("The page number inputted is invalid! It must be a number."); 95 95 return; 96 96 } -
s10k/Vago/windowMessagesWizard/wmwizard.cpp
r1061 r1093 1 1 #include "wmwizard.h" 2 2 3 WmWizard::WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings , Logger *myLogger)4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger,true)3 WmWizard::WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings) 4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, true) 5 5 { 6 6 this->bgImagesLocation=this->workspaceWizardLocation+"/WindowMessages"; … … 10 10 11 11 WmSetupPage *setupPage = new WmSetupPage(); 12 WmFormatPage *formatPage = new WmFormatPage( this->myLogger);13 WmFinalPage *finalPage = new WmFinalPage(this->appDir, this->bgImagesLocation, this->myLogger,formatPage->getCurrentPages());12 WmFormatPage *formatPage = new WmFormatPage(); 13 WmFinalPage *finalPage = new WmFinalPage(this->appDir, this->bgImagesLocation, formatPage->getCurrentPages()); 14 14 15 15 this->myWizard.addPage -
s10k/Vago/windowMessagesWizard/wmwizard.h
r1061 r1093 11 11 { 12 12 protected: 13 WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings , Logger *myLogger);13 WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings); 14 14 void exec(); 15 15 private: -
s10k/Vago/wizardfactory.h
r1061 r1093 9 9 { 10 10 public: 11 static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings , Logger *myLogger){12 (new WizardFactory<T>(appDir, workspaceWizardLocation, vagoSettings , myLogger))->exec();11 static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings){ 12 (new WizardFactory<T>(appDir, workspaceWizardLocation, vagoSettings))->exec(); 13 13 } 14 14 private: … … 18 18 const QString &appDir, 19 19 const QString &workspaceWizardLocation, 20 QSettings *vagoSettings, 21 Logger *myLogger 22 ):T(appDir, workspaceWizardLocation, vagoSettings, myLogger){} 20 QSettings *vagoSettings 21 ):T(appDir, workspaceWizardLocation, vagoSettings){} 23 22 }; 24 23 … … 28 27 { 29 28 public: 30 static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger,QHash<QString, QString> *commandMap){31 (new WizardFactory(appDir, workspaceWizardLocation, vagoSettings, myLogger,commandMap))->exec();29 static void startInstance(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, QHash<QString, QString> *commandMap){ 30 (new WizardFactory(appDir, workspaceWizardLocation, vagoSettings, commandMap))->exec(); 32 31 } 33 32 private: … … 37 36 const QString &workspaceWizardLocation, 38 37 QSettings *vagoSettings, 39 Logger *myLogger,40 38 QHash<QString, QString> *commandMap 41 ):SoundWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger,commandMap){}39 ):SoundWizard(appDir, workspaceWizardLocation, vagoSettings, commandMap){} 42 40 }; 43 41 -
s10k/Vago/xmlToolsInterface/xmltoolsinterface.cpp
r1059 r1093 2 2 #include "ui_xmltoolsinterface.h" 3 3 4 XmlToolsInterface::XmlToolsInterface( Logger *myLogger,QWidget *parent) :4 XmlToolsInterface::XmlToolsInterface(QWidget *parent) : 5 5 QMainWindow(parent), 6 6 ui(new Ui::XmlToolsInterface), … … 9 9 ui->setupUi(this); 10 10 this->setAttribute(Qt::WA_DeleteOnClose, true); //destroy itself once finished. 11 this->myLogger = myLogger; 12 this->xmlProcessor = new XmlProcessor(UtilVago::getAppPath(), this->myLogger, &this->listToProccess); 11 this->xmlProcessor = new XmlProcessor(UtilVago::getAppPath(), &this->listToProccess); 13 12 14 13 // setup the correct input options for the current selection … … 162 161 if(oldFile.exists()){ 163 162 if(!oldFile.remove()){ 164 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, 165 "Couldn't remove old temporary file to preview XML patch! Existing file:\n" 163 UtilVago::showAndLogErrorPopUpLogButton("Couldn't remove old temporary file to preview XML patch! Existing file:\n" 166 164 + previewFileLocation 167 165 ); … … 170 168 171 169 if(!QFile::copy(currentFileLocation, previewFileLocation)){ 172 UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, 173 "Couldn't create temporary file to preview the XML patch!\nFrom: " + 170 UtilVago::showAndLogErrorPopUpLogButton("Couldn't create temporary file to preview the XML patch!\nFrom: " + 174 171 currentFileLocation + 175 172 "\nTo: " + previewFileLocation … … 204 201 205 202 if(ui->leInputInputFiles->text().trimmed().isEmpty()){ 206 Util:: showErrorPopUp("You must provide an Input File!");203 Util::Dialogs::showError("You must provide an Input File!"); 207 204 return false; 208 205 } 209 206 210 207 if(ui->rbFilterRelativeElements->isChecked() && ui->leFilterElement->text().trimmed().isEmpty()){ 211 Util:: showErrorPopUp("With Relative Elements checked you must provide a Element Name!");208 Util::Dialogs::showError("With Relative Elements checked you must provide a Element Name!"); 212 209 return false; 213 210 } 214 211 215 212 if(ui->cbFilterParentElement->isChecked() && ui->leFilterParentElement->text().trimmed().isEmpty()){ 216 Util:: showErrorPopUp("Parent Element is checked but none was provided!");213 Util::Dialogs::showError("Parent Element is checked but none was provided!"); 217 214 return false; 218 215 } … … 221 218 if(ui->leFilterAttributeName->text().trimmed().isEmpty()) 222 219 { 223 Util:: showErrorPopUp("Attribute Name is checked but none was provided!");220 Util::Dialogs::showError("Attribute Name is checked but none was provided!"); 224 221 return false; 225 222 } … … 227 224 if(ui->leFilterAttributeValue->text().trimmed().isEmpty()) 228 225 { 229 Util:: showErrorPopUp("With Attribute Name checked you must provide a Attribute Value!");226 Util::Dialogs::showError("With Attribute Name checked you must provide a Attribute Value!"); 230 227 return false; 231 228 } … … 234 231 if(ui->rbFilterXPathExpression->isChecked() && ui->leFilterXPathExpression->text().trimmed().isEmpty()) 235 232 { 236 Util:: showErrorPopUp("X-Path Expression is checked but none was provided!");233 Util::Dialogs::showError("X-Path Expression is checked but none was provided!"); 237 234 return false; 238 235 } 239 236 240 237 if(ui->cbXmlToolsOperation->currentText() == "Add Values" && ui->leInputNewValues->text().isEmpty()){ 241 Util:: showErrorPopUp(R"|(With "Add Values" operation selected you must provide the "New Value(s)" to be added.)|");238 Util::Dialogs::showError(R"|(With "Add Values" operation selected you must provide the "New Value(s)" to be added.)|"); 242 239 return false; 243 240 } 244 241 245 242 if(ui->cbXmlToolsOperation->currentText() == "Remove Values" && ui->leInputCurrentValues->text().isEmpty()){ 246 Util:: showErrorPopUp(R"|(With "Remove Value" operation selected you must provide the "Current Value(s)" to be removed.)|");243 Util::Dialogs::showError(R"|(With "Remove Value" operation selected you must provide the "Current Value(s)" to be removed.)|"); 247 244 return false; 248 245 } … … 269 266 // if there's a preview in progress don't display the message below 270 267 if(!this->previewInProgress){ 271 Util:: showPopUp("File(s) processed with sucess!");268 Util::Dialogs::showInfo("File(s) processed with sucess!"); 272 269 } 273 270 } … … 305 302 306 303 if(ui->leInputNewValues->isEnabled()){ 307 currCommand += "--new-val " + Util:: insertQuotes(ui->leInputNewValues->text()) + " ";304 currCommand += "--new-val " + Util::String::insertQuotes(ui->leInputNewValues->text()) + " "; 308 305 } 309 306 310 307 if(ui->leInputCurrentValues->isEnabled()){ 311 currCommand += "--current-val " + Util:: insertQuotes(ui->leInputCurrentValues->text()) + " ";308 currCommand += "--current-val " + Util::String::insertQuotes(ui->leInputCurrentValues->text()) + " "; 312 309 } 313 310 314 311 if(ui->leInputPositions->isEnabled() && !ui->leInputPositions->text().trimmed().isEmpty()){ 315 currCommand += "--positions " + Util:: insertQuotes(ui->leInputPositions->text()) + " ";312 currCommand += "--positions " + Util::String::insertQuotes(ui->leInputPositions->text()) + " "; 316 313 } 317 314 318 315 if(ui->leInputDiffOldNewValue->isEnabled()){ 319 currCommand += "--diff-old-new-val " + Util:: insertQuotes(ui->leInputDiffOldNewValue->text()) + " ";316 currCommand += "--diff-old-new-val " + Util::String::insertQuotes(ui->leInputDiffOldNewValue->text()) + " "; 320 317 } 321 318 322 319 if(ui->rbFilterRelativeElements->isChecked()){ 323 320 if(ui->leFilterElement->isEnabled()){ 324 currCommand += "--element-name " + Util:: insertQuotes(ui->leFilterElement->text()) + " ";321 currCommand += "--element-name " + Util::String::insertQuotes(ui->leFilterElement->text()) + " "; 325 322 } 326 323 if(ui->leFilterParentElement->isEnabled()){ 327 currCommand += "--parent-element-name " + Util:: insertQuotes(ui->leFilterParentElement->text()) + " ";324 currCommand += "--parent-element-name " + Util::String::insertQuotes(ui->leFilterParentElement->text()) + " "; 328 325 } 329 326 if(ui->leFilterAttributeName->isEnabled()){ 330 currCommand += "--attribute-name " + Util:: insertQuotes(ui->leFilterAttributeName->text()) + " ";331 currCommand += "--attribute-value " + Util:: insertQuotes(ui->leFilterAttributeValue->text()) + " ";327 currCommand += "--attribute-name " + Util::String::insertQuotes(ui->leFilterAttributeName->text()) + " "; 328 currCommand += "--attribute-value " + Util::String::insertQuotes(ui->leFilterAttributeValue->text()) + " "; 332 329 } 333 330 } 334 331 else{ 335 332 if(ui->leFilterXPathExpression->isEnabled()){ 336 currCommand += "--xpath-expression " + Util:: insertQuotes(ui->leFilterXPathExpression->text()) + " ";333 currCommand += "--xpath-expression " + Util::String::insertQuotes(ui->leFilterXPathExpression->text()) + " "; 337 334 } 338 335 } 339 336 340 337 if(alternativeFileLocation.isEmpty()){ 341 currCommand += "--files " + Util:: insertQuotes(ui->leInputInputFiles->text());338 currCommand += "--files " + Util::String::insertQuotes(ui->leInputInputFiles->text()); 342 339 } 343 340 else{ 344 currCommand += "--files " + Util:: insertQuotes(alternativeFileLocation);341 currCommand += "--files " + Util::String::insertQuotes(alternativeFileLocation); 345 342 } 346 343 -
s10k/Vago/xmlToolsInterface/xmltoolsinterface.h
r1058 r1093 24 24 25 25 public: 26 explicit XmlToolsInterface( Logger *myLogger,QWidget *parent = 0);26 explicit XmlToolsInterface(QWidget *parent = 0); 27 27 ~XmlToolsInterface(); 28 28 … … 73 73 private: 74 74 Ui::XmlToolsInterface *ui; 75 Logger *myLogger = nullptr;76 75 QStringList listToProccess; //commands to execute 77 76 XmlProcessor *xmlProcessor = nullptr; -
s10k/Vago/xmlToolsInterface/xmltoolsinterfacecommandpreview.cpp
r1058 r1093 23 23 ui->tePreviewFileText->setText(this->previewText); 24 24 25 highlighterCurrentFile = new BasicXMLSyntaxHighlighter(ui->teCurrentFileText);26 highlighterPreviewFile = new BasicXMLSyntaxHighlighter(ui->tePreviewFileText);25 highlighterCurrentFile.setDocument(ui->teCurrentFileText->document()); 26 highlighterPreviewFile.setDocument(ui->tePreviewFileText->document()); 27 27 28 28 previewFile.close(); … … 172 172 } 173 173 174 highlighterPreviewFile ->rehighlight();175 highlighterCurrentFile ->rehighlight();174 highlighterPreviewFile.rehighlight(); 175 highlighterCurrentFile.rehighlight(); 176 176 } 177 177 178 178 XmlToolsInterfaceCommandPreview::~XmlToolsInterfaceCommandPreview() 179 179 { 180 delete this->highlighterCurrentFile;181 delete this->highlighterPreviewFile;182 180 delete this->lineNumberDisplayCurrentFile; 183 181 delete this->lineNumberDisplayPreviewFile; -
s10k/Vago/xmlToolsInterface/xmltoolsinterfacecommandpreview.h
r1058 r1093 6 6 #include <QScrollBar> 7 7 8 #include "../libs/BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.h"9 #include "../libs/LineNumberDisplay/LineNumberDisplay.h"8 #include <BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.h> 9 #include <LineNumberDisplay/LineNumberDisplay.h> 10 10 #include "util.h" 11 11 … … 24 24 private: 25 25 Ui::XmlToolsInterfaceCommandPreview *ui; 26 BasicXMLSyntaxHighlighter *highlighterCurrentFile;27 BasicXMLSyntaxHighlighter *highlighterPreviewFile;26 BasicXMLSyntaxHighlighter highlighterCurrentFile; 27 BasicXMLSyntaxHighlighter highlighterPreviewFile; 28 28 LineNumberDisplay *lineNumberDisplayCurrentFile; 29 29 LineNumberDisplay *lineNumberDisplayPreviewFile; -
s10k/Vago/xmlprocessor.cpp
r1052 r1093 1 1 #include "xmlprocessor.h" 2 2 3 XmlProcessor::XmlProcessor(QString AppDir, Logger *myLogger,QStringList *commands)3 XmlProcessor::XmlProcessor(QString AppDir, QStringList *commands) 4 4 { 5 5 this->AppDir=AppDir; 6 this->myLogger=myLogger;7 6 this->commands=commands; 8 7 } … … 25 24 if(!result.isEmpty()){ 26 25 //catch exception 27 myLogger->writeString("Xml Tools Error: \n"+this->commands->at(i)+"\n"+result);26 LOG_ERROR << "Xml Tools Error: \n" + this->commands->at(i) + "\n"+result; 28 27 errorMessage=result; 29 28 numErrors++; -
s10k/Vago/xmlprocessor.h
r1047 r1093 10 10 Q_OBJECT 11 11 public: 12 XmlProcessor(QString AppDir, Logger *myLogger,QStringList *commands);12 XmlProcessor(QString AppDir, QStringList *commands); 13 13 private: 14 14 QString AppDir; 15 Logger *myLogger;16 15 QStringList *commands; 17 16
Note:
See TracChangeset
for help on using the changeset viewer.