Ignore:
Timestamp:
Dec 30, 2017, 2:57:32 PM (7 years ago)
Author:
s10k
Message:

Vago 1.4

Location:
s10k/Vago/windowMessagesWizard
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • s10k/Vago/windowMessagesWizard/wmfinalpage.cpp

    r1063 r1093  
    22#include "ui_wmfinalpage.h"
    33
    4 WmFinalPage::WmFinalPage(QString AppDir, QString wmLocation, Logger *myLogger, QList<std::shared_ptr<WmPage> > &pages, QWidget *parent) :
     4WmFinalPage::WmFinalPage(QString AppDir, QString wmLocation, QList<std::shared_ptr<WmPage> > &pages, QWidget *parent) :
    55    QWizardPage(parent), ui(new Ui::wmfinalpage), pages(pages)
    66{
    77    ui->setupUi(this);
    88    this->wmLocation=wmLocation;
    9     this->myLogger=myLogger;
    109
    1110    this->oniSplitCommands = new QStringList();
    12     this->myConverter = new Converter(AppDir, this->myLogger,this->oniSplitCommands);
     11    this->myConverter = new Converter(AppDir, this->oniSplitCommands);
    1312
    1413    ui->lbComplete->setText("<html>The wizard is now complete. The window messages have been converted. "
     
    5554        typeNode = rootNode.append_child("OPge");
    5655        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)));
    5958        pugi::xml_node igpaNode = rootNode.append_child("IGPA");
    6059        igpaNode.append_attribute("id").set_value(globalSectionCounter);
     
    6261        currentIGPGId = globalSectionCounter;
    6362        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)));
    6564        }
    6665        break;
     
    6968        typeNode = rootNode.append_child("DPge");
    7069        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)));
    7675        break;
    7776    case  WINDOW_TYPE::HELP:
     
    7978        typeNode.append_attribute("id").set_value(++globalSectionCounter);
    8079        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)));
    8281        break;
    8382    case  WINDOW_TYPE::TEXT_CONSOLE:
     
    8584        typeNode = rootNode.append_child("TxtC");
    8685        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)));
    8887        pugi::xml_node igpaNode = rootNode.append_child("IGPA");
    8988        igpaNode.append_attribute("id").set_value(globalSectionCounter);
     
    9190        pugi::xml_node pagesNode = igpaNode.append_child("Pages");
    9291        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)));
    9493        }
    9594        break;
     
    9897        typeNode = rootNode.append_child("WPge");
    9998        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)));
    103102        break;
    104103    case  WINDOW_TYPE::ITEM:
    105104        typeNode = rootNode.append_child("IPge");
    106105        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)));
    110109        break;
    111110    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");
    113112        break;
    114113    }
     
    132131
    133132            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));
    135134
    136135            this->myConverter->start(); // finally process the onisplit commands
     
    152151        currentIGSAId = globalSectionCounter;
    153152
    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)));
    157156
    158157        // IGSA
     
    166165
    167166        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)));
    169168        }
    170169
     
    174173        pugi::xml_node igsaFooterTextStringsNode = igsaFooterTextNode.append_child("Strings");
    175174        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)));
    177176        }
    178177
     
    202201
    203202                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())));
    208207                igstMainTextFontNode.append_child("Flags").append_child(pugi::xml_node_type::node_pcdata).set_value("Family Style Color Size");
    209208
    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                }
    211221            }
    212222
     
    220230    }
    221231
    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!");
    224234        return;
    225235    }
     
    227237    // Convert XML file to Oni
    228238    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));
    230240
    231241    this->myConverter->start(); // finally process the onisplit commands
  • s10k/Vago/windowMessagesWizard/wmfinalpage.h

    r1061 r1093  
    66#include <QUrl>
    77#include <droptablewidget.h>
    8 #include <pugixml.hpp>
     8#include <pugixml/pugixml.hpp>
    99
    10 #include "logger.h"
    1110#include "xmlprocessor.h"
    1211#include "converter.h"
     
    2322   
    2423public:
    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);
    2625    ~WmFinalPage();
    2726   
     
    2928    QString wmLocation;
    3029    Ui::wmfinalpage *ui;
    31     Logger *myLogger;
    3230    Converter *myConverter;
    3331    QStringList *oniSplitCommands;
  • s10k/Vago/windowMessagesWizard/wmformatpage.cpp

    r1061 r1093  
    22#include "ui_wmformatpage.h"
    33
    4 WmFormatPage::WmFormatPage(Logger *myLogger, QWidget *parent) :
     4WmFormatPage::WmFormatPage(QWidget *parent) :
    55    QWizardPage(parent),
    66    ui(new Ui::WmFormatPage)
    77{
    88    ui->setupUi(this);
    9 
    10     this->myLogger = myLogger;
    119
    1210    this->setTitle("Pages Formatting");
     
    5149        break;
    5250    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");
    5452        break;
    5553    }
     
    7270                )
    7371        {
    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!");
    7573            return false;
    7674        }
     
    8078    // If we can add more than one page, ask the user if he already added them all
    8179    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?");
    8381    }
    8482
     
    126124        break;
    127125    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");
    129127        break;
    130128    }
     
    190188
    191189    if(textEdits.size() == 0){
    192         Util::showPopUp("Select some text first.");
     190        Util::Dialogs::showInfo("Select some text first.");
    193191        return;
    194192    }
     
    252250
    253251                if(!ok){
    254                     Util::showErrorPopUp("The inputted font size is not valid!");
     252                    Util::Dialogs::showError("The inputted font size is not valid!");
    255253                    ui->cbTextSize->setCurrentIndex(0); // reset to default number
    256254                    return;
     
    279277{
    280278    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!");
    282280        return;
    283281    }
    284282
    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?")){
    286284        int indexToDelete = ui->twPages->currentIndex();
    287285
  • s10k/Vago/windowMessagesWizard/wmformatpage.h

    r1061 r1093  
    2020   
    2121public:
    22     explicit WmFormatPage(Logger *myLogger, QWidget *parent = 0);
     22    explicit WmFormatPage(QWidget *parent = 0);
    2323    QList<std::shared_ptr<WmPage> >& getCurrentPages();
    2424
     
    5656    QList<std::shared_ptr<WmPage>> currentPages;
    5757    bool windowsIsInitialized = false;
    58     Logger *myLogger;
    5958
    6059private:
  • s10k/Vago/windowMessagesWizard/wmsetuppage.cpp

    r1061 r1093  
    4646    }
    4747
    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!");
    5050        return false;
    5151    }
     
    6262    }
    6363
    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.");
    6666        return;
    6767    }
     
    9191    }
    9292
    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.");
    9595        return;
    9696    }
  • s10k/Vago/windowMessagesWizard/wmwizard.cpp

    r1061 r1093  
    11#include "wmwizard.h"
    22
    3 WmWizard::WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger)
    4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger, true)
     3WmWizard::WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings)
     4:AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, true)
    55{
    66    this->bgImagesLocation=this->workspaceWizardLocation+"/WindowMessages";
     
    1010
    1111    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());
    1414
    1515    this->myWizard.addPage
  • s10k/Vago/windowMessagesWizard/wmwizard.h

    r1061 r1093  
    1111{
    1212protected:
    13     WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger);
     13    WmWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings);
    1414    void exec();
    1515private:
Note: See TracChangeset for help on using the changeset viewer.