Changeset 1093 for s10k/Vago/bgImageWizard
- Timestamp:
- Dec 30, 2017, 2:57:32 PM (7 years ago)
- Location:
- s10k/Vago/bgImageWizard
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
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:
Note:
See TracChangeset
for help on using the changeset viewer.