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