| 1 |  | #include "BGImagePageFinal.h" | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 2 |  | #include "ui_BGImagePageFinal.h" | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 4 | < | BGImagePageFinal::BGImagePageFinal(QString appDir, Logger *myLogger, QString bgImagesLocation, QWidget *parent) : | 
 
 
 
 
 
 
 
 
 | 4 | > | BGImagePageFinal::BGImagePageFinal(QString appDir, QString bgImagesLocation, QWidget *parent) : | 
 
 
 
 
 
 
 
 
 
 
 | 5 |  | QWizardPage(parent), | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 6 |  | ui(new Ui::BGImagePageFinal) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 7 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 8 |  | ui->setupUi(this); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 9 |  | this->appDir = appDir; | 
 
 
 
 
 
 
 
 
 | 10 | – | this->myLogger = myLogger; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 10 |  | this->bgImagesLocation = bgImagesLocation; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 11 |  | this->oniSplitCommands = new QStringList(); | 
 
 
 
 
 
 
 
 
 
 
 | 12 | < | this->myOniSplitConverter = new Converter(this->appDir, this->myLogger, this->oniSplitCommands); | 
 
 
 
 
 
 
 
 
 | 12 | > | this->myOniSplitConverter = new Converter(this->appDir, this->oniSplitCommands); | 
 
 
 
 
 
 
 
 
 
 
 | 13 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 14 |  | ui->lbComplete->setText("<html>The wizard is now complete. The images have been created. " | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 15 |  | "You can view all created files clicking <a href=' '>here.</a><br />" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 |  | this->oniSplitCommands->clear(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 64 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 65 |  | for(const QString ¤tFile : imagesSplitted){ | 
 
 
 
 
 
 
 
 
 
 
 | 66 | < | 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)); | 
 
 
 
 
 
 
 
 
 
 
 | 67 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 |  | this->myOniSplitConverter->start(); // finally process the onisplit commands | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 75 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 76 |  | if(txmbXmlFile.isEmpty()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 77 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 78 | < | UtilVago::showAndLogErrorPopUp(this->myLogger, "Couldn't create TXMB xml file!"); | 
 
 
 
 
 
 
 
 
 | 78 | > | UtilVago::showAndLogErrorPopUp("Couldn't create TXMB xml file!"); | 
 
 
 
 
 
 
 
 
 
 
 | 79 |  | return; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 80 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 82 |  | // Create TXMB oni files | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 |  | this->oniSplitCommands->clear(); | 
 
 
 
 
 
 
 
 
 
 
 | 84 | < | 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)); | 
 
 
 
 
 
 
 
 
 
 
 | 85 |  | this->myOniSplitConverter->start(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 86 |  | this->myOniSplitConverter->wait(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 87 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 |  | for(const QString &currSplittedImage : imagesSplitted) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 108 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 109 |  | QFileInfo currImageFile(currSplittedImage); | 
 
 
 
 
 
 
 
 
 
 
 | 110 | < | texturesNode.append_child("Link").append_child(pugi::xml_node_type::node_pcdata).set_value(Util::qStrToCstr(currImageFile.baseName())); | 
 
 
 
 
 
 
 
 
 | 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(Util::qStrToCstr(levelId)); | 
 
 
 
 
 
 
 
 
 | 113 | > | txmbNode.append_attribute("id").set_value(QSTR_TO_CSTR(levelId)); | 
 
 
 
 
 
 
 
 
 
 
 | 114 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 115 | < | if(!doc.save_file(Util::qStrToCstr(filePath))){ | 
 
 
 
 
 
 
 
 
 | 115 | > | if(!doc.save_file(QSTR_TO_CSTR(filePath))){ | 
 
 
 
 
 
 
 
 
 
 
 | 116 |  | return ""; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 117 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 118 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 146 |  | QString imageDestinationPath = this->bgImagesLocation + "/" + imageName + currentImageId + "." + imageType; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 147 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 148 |  | if(!dividedImage.save(imageDestinationPath)){ | 
 
 
 
 
 
 
 
 
 
 
 | 149 | < | 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."); | 
 
 
 
 
 
 
 
 
 
 
 | 150 |  | return QList<QString>(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 152 |  |  |