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

Vago 1.4

Location:
s10k/Vago/xmlToolsInterface
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • s10k/Vago/xmlToolsInterface/xmltoolsinterface.cpp

    r1059 r1093  
    22#include "ui_xmltoolsinterface.h"
    33
    4 XmlToolsInterface::XmlToolsInterface(Logger *myLogger, QWidget *parent) :
     4XmlToolsInterface::XmlToolsInterface(QWidget *parent) :
    55    QMainWindow(parent),
    66    ui(new Ui::XmlToolsInterface),
     
    99    ui->setupUi(this);
    1010    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);
    1312
    1413    // setup the correct input options for the current selection
     
    162161    if(oldFile.exists()){
    163162        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"
    166164                                                    + previewFileLocation
    167165                                                    );
     
    170168
    171169    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: " +
    174171                                                currentFileLocation +
    175172                                                "\nTo: " + previewFileLocation
     
    204201
    205202    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!");
    207204        return false;
    208205    }
    209206
    210207    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!");
    212209        return false;
    213210    }
    214211
    215212    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!");
    217214        return false;
    218215    }
     
    221218        if(ui->leFilterAttributeName->text().trimmed().isEmpty())
    222219        {
    223             Util::showErrorPopUp("Attribute Name is checked but none was provided!");
     220            Util::Dialogs::showError("Attribute Name is checked but none was provided!");
    224221            return false;
    225222        }
     
    227224        if(ui->leFilterAttributeValue->text().trimmed().isEmpty())
    228225        {
    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!");
    230227            return false;
    231228        }
     
    234231    if(ui->rbFilterXPathExpression->isChecked() && ui->leFilterXPathExpression->text().trimmed().isEmpty())
    235232    {
    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!");
    237234        return false;
    238235    }
    239236
    240237    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.)|");
    242239        return false;
    243240    }
    244241
    245242    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.)|");
    247244        return false;
    248245    }
     
    269266        // if there's a preview in progress don't display the message below
    270267        if(!this->previewInProgress){
    271             Util::showPopUp("File(s) processed with sucess!");
     268            Util::Dialogs::showInfo("File(s) processed with sucess!");
    272269        }
    273270    }
     
    305302
    306303    if(ui->leInputNewValues->isEnabled()){
    307         currCommand += "--new-val " + Util::insertQuotes(ui->leInputNewValues->text()) + " ";
     304        currCommand += "--new-val " + Util::String::insertQuotes(ui->leInputNewValues->text()) + " ";
    308305    }
    309306
    310307    if(ui->leInputCurrentValues->isEnabled()){
    311         currCommand += "--current-val " + Util::insertQuotes(ui->leInputCurrentValues->text()) + " ";
     308        currCommand += "--current-val " + Util::String::insertQuotes(ui->leInputCurrentValues->text()) + " ";
    312309    }
    313310
    314311    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()) + " ";
    316313    }
    317314
    318315    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()) + " ";
    320317    }
    321318
    322319    if(ui->rbFilterRelativeElements->isChecked()){
    323320        if(ui->leFilterElement->isEnabled()){
    324             currCommand += "--element-name " + Util::insertQuotes(ui->leFilterElement->text()) + " ";
     321            currCommand += "--element-name " + Util::String::insertQuotes(ui->leFilterElement->text()) + " ";
    325322        }
    326323        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()) + " ";
    328325        }
    329326        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()) + " ";
    332329        }
    333330    }
    334331    else{
    335332        if(ui->leFilterXPathExpression->isEnabled()){
    336             currCommand += "--xpath-expression " + Util::insertQuotes(ui->leFilterXPathExpression->text()) + " ";
     333            currCommand += "--xpath-expression " + Util::String::insertQuotes(ui->leFilterXPathExpression->text()) + " ";
    337334        }
    338335    }
    339336
    340337    if(alternativeFileLocation.isEmpty()){
    341         currCommand += "--files " + Util::insertQuotes(ui->leInputInputFiles->text());
     338        currCommand += "--files " + Util::String::insertQuotes(ui->leInputInputFiles->text());
    342339    }
    343340    else{
    344         currCommand += "--files " + Util::insertQuotes(alternativeFileLocation);
     341        currCommand += "--files " + Util::String::insertQuotes(alternativeFileLocation);
    345342    }
    346343
  • s10k/Vago/xmlToolsInterface/xmltoolsinterface.h

    r1058 r1093  
    2424   
    2525public:
    26     explicit XmlToolsInterface(Logger *myLogger, QWidget *parent = 0);
     26    explicit XmlToolsInterface(QWidget *parent = 0);
    2727    ~XmlToolsInterface();
    2828
     
    7373private:
    7474    Ui::XmlToolsInterface *ui;
    75     Logger *myLogger = nullptr;
    7675    QStringList listToProccess; //commands to execute
    7776    XmlProcessor *xmlProcessor = nullptr;
  • s10k/Vago/xmlToolsInterface/xmltoolsinterfacecommandpreview.cpp

    r1058 r1093  
    2323    ui->tePreviewFileText->setText(this->previewText);
    2424
    25     highlighterCurrentFile = new BasicXMLSyntaxHighlighter(ui->teCurrentFileText);
    26     highlighterPreviewFile = new BasicXMLSyntaxHighlighter(ui->tePreviewFileText);
     25    highlighterCurrentFile.setDocument(ui->teCurrentFileText->document());
     26    highlighterPreviewFile.setDocument(ui->tePreviewFileText->document());
    2727
    2828    previewFile.close();
     
    172172    }
    173173
    174     highlighterPreviewFile->rehighlight();
    175     highlighterCurrentFile->rehighlight();
     174    highlighterPreviewFile.rehighlight();
     175    highlighterCurrentFile.rehighlight();
    176176}
    177177
    178178XmlToolsInterfaceCommandPreview::~XmlToolsInterfaceCommandPreview()
    179179{
    180     delete this->highlighterCurrentFile;
    181     delete this->highlighterPreviewFile;
    182180    delete this->lineNumberDisplayCurrentFile;
    183181    delete this->lineNumberDisplayPreviewFile;
  • s10k/Vago/xmlToolsInterface/xmltoolsinterfacecommandpreview.h

    r1058 r1093  
    66#include <QScrollBar>
    77
    8 #include "../libs/BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.h"
    9 #include "../libs/LineNumberDisplay/LineNumberDisplay.h"
     8#include <BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.h>
     9#include <LineNumberDisplay/LineNumberDisplay.h>
    1010#include "util.h"
    1111
     
    2424private:
    2525    Ui::XmlToolsInterfaceCommandPreview *ui;
    26     BasicXMLSyntaxHighlighter *highlighterCurrentFile;
    27     BasicXMLSyntaxHighlighter *highlighterPreviewFile;
     26    BasicXMLSyntaxHighlighter highlighterCurrentFile;
     27    BasicXMLSyntaxHighlighter highlighterPreviewFile;
    2828    LineNumberDisplay *lineNumberDisplayCurrentFile;
    2929    LineNumberDisplay *lineNumberDisplayPreviewFile;
Note: See TracChangeset for help on using the changeset viewer.