--- Vago/trunk/Vago/xmlToolsInterface/xmltoolsinterface.cpp 2016/10/30 16:01:17 1059 +++ s10k/Vago/xmlToolsInterface/xmltoolsinterface.cpp 2017/12/30 13:57:32 1093 @@ -1,15 +1,14 @@ #include "xmltoolsinterface.h" #include "ui_xmltoolsinterface.h" -XmlToolsInterface::XmlToolsInterface(Logger *myLogger, QWidget *parent) : +XmlToolsInterface::XmlToolsInterface(QWidget *parent) : QMainWindow(parent), ui(new Ui::XmlToolsInterface), xmlProcessor() { ui->setupUi(this); this->setAttribute(Qt::WA_DeleteOnClose, true); //destroy itself once finished. - this->myLogger = myLogger; - this->xmlProcessor = new XmlProcessor(UtilVago::getAppPath(), this->myLogger, &this->listToProccess); + this->xmlProcessor = new XmlProcessor(UtilVago::getAppPath(), &this->listToProccess); // setup the correct input options for the current selection on_rbFilterRelativeElements_clicked(); @@ -161,16 +160,14 @@ void XmlToolsInterface::on_pbPreviewOper if(oldFile.exists()){ if(!oldFile.remove()){ - UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, - "Couldn't remove old temporary file to preview XML patch! Existing file:\n" + UtilVago::showAndLogErrorPopUpLogButton("Couldn't remove old temporary file to preview XML patch! Existing file:\n" + previewFileLocation ); } } if(!QFile::copy(currentFileLocation, previewFileLocation)){ - UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, - "Couldn't create temporary file to preview the XML patch!\nFrom: " + + UtilVago::showAndLogErrorPopUpLogButton("Couldn't create temporary file to preview the XML patch!\nFrom: " + currentFileLocation + "\nTo: " + previewFileLocation ); @@ -203,47 +200,47 @@ bool XmlToolsInterface::validateInput() { if(ui->leInputInputFiles->text().trimmed().isEmpty()){ - Util::showErrorPopUp("You must provide an Input File!"); + Util::Dialogs::showError("You must provide an Input File!"); return false; } if(ui->rbFilterRelativeElements->isChecked() && ui->leFilterElement->text().trimmed().isEmpty()){ - Util::showErrorPopUp("With Relative Elements checked you must provide a Element Name!"); + Util::Dialogs::showError("With Relative Elements checked you must provide a Element Name!"); return false; } if(ui->cbFilterParentElement->isChecked() && ui->leFilterParentElement->text().trimmed().isEmpty()){ - Util::showErrorPopUp("Parent Element is checked but none was provided!"); + Util::Dialogs::showError("Parent Element is checked but none was provided!"); return false; } if(ui->cbFilterAttributeName->isChecked()){ if(ui->leFilterAttributeName->text().trimmed().isEmpty()) { - Util::showErrorPopUp("Attribute Name is checked but none was provided!"); + Util::Dialogs::showError("Attribute Name is checked but none was provided!"); return false; } if(ui->leFilterAttributeValue->text().trimmed().isEmpty()) { - Util::showErrorPopUp("With Attribute Name checked you must provide a Attribute Value!"); + Util::Dialogs::showError("With Attribute Name checked you must provide a Attribute Value!"); return false; } } if(ui->rbFilterXPathExpression->isChecked() && ui->leFilterXPathExpression->text().trimmed().isEmpty()) { - Util::showErrorPopUp("X-Path Expression is checked but none was provided!"); + Util::Dialogs::showError("X-Path Expression is checked but none was provided!"); return false; } if(ui->cbXmlToolsOperation->currentText() == "Add Values" && ui->leInputNewValues->text().isEmpty()){ - Util::showErrorPopUp(R"|(With "Add Values" operation selected you must provide the "New Value(s)" to be added.)|"); + Util::Dialogs::showError(R"|(With "Add Values" operation selected you must provide the "New Value(s)" to be added.)|"); return false; } if(ui->cbXmlToolsOperation->currentText() == "Remove Values" && ui->leInputCurrentValues->text().isEmpty()){ - Util::showErrorPopUp(R"|(With "Remove Value" operation selected you must provide the "Current Value(s)" to be removed.)|"); + Util::Dialogs::showError(R"|(With "Remove Value" operation selected you must provide the "Current Value(s)" to be removed.)|"); return false; } @@ -268,7 +265,7 @@ void XmlToolsInterface::TXmlToolsResult( else if(numErrors == 0){ // if there's a preview in progress don't display the message below if(!this->previewInProgress){ - Util::showPopUp("File(s) processed with sucess!"); + Util::Dialogs::showInfo("File(s) processed with sucess!"); } } @@ -304,44 +301,44 @@ QString XmlToolsInterface::buildCommand( } if(ui->leInputNewValues->isEnabled()){ - currCommand += "--new-val " + Util::insertQuotes(ui->leInputNewValues->text()) + " "; + currCommand += "--new-val " + Util::String::insertQuotes(ui->leInputNewValues->text()) + " "; } if(ui->leInputCurrentValues->isEnabled()){ - currCommand += "--current-val " + Util::insertQuotes(ui->leInputCurrentValues->text()) + " "; + currCommand += "--current-val " + Util::String::insertQuotes(ui->leInputCurrentValues->text()) + " "; } if(ui->leInputPositions->isEnabled() && !ui->leInputPositions->text().trimmed().isEmpty()){ - currCommand += "--positions " + Util::insertQuotes(ui->leInputPositions->text()) + " "; + currCommand += "--positions " + Util::String::insertQuotes(ui->leInputPositions->text()) + " "; } if(ui->leInputDiffOldNewValue->isEnabled()){ - currCommand += "--diff-old-new-val " + Util::insertQuotes(ui->leInputDiffOldNewValue->text()) + " "; + currCommand += "--diff-old-new-val " + Util::String::insertQuotes(ui->leInputDiffOldNewValue->text()) + " "; } if(ui->rbFilterRelativeElements->isChecked()){ if(ui->leFilterElement->isEnabled()){ - currCommand += "--element-name " + Util::insertQuotes(ui->leFilterElement->text()) + " "; + currCommand += "--element-name " + Util::String::insertQuotes(ui->leFilterElement->text()) + " "; } if(ui->leFilterParentElement->isEnabled()){ - currCommand += "--parent-element-name " + Util::insertQuotes(ui->leFilterParentElement->text()) + " "; + currCommand += "--parent-element-name " + Util::String::insertQuotes(ui->leFilterParentElement->text()) + " "; } if(ui->leFilterAttributeName->isEnabled()){ - currCommand += "--attribute-name " + Util::insertQuotes(ui->leFilterAttributeName->text()) + " "; - currCommand += "--attribute-value " + Util::insertQuotes(ui->leFilterAttributeValue->text()) + " "; + currCommand += "--attribute-name " + Util::String::insertQuotes(ui->leFilterAttributeName->text()) + " "; + currCommand += "--attribute-value " + Util::String::insertQuotes(ui->leFilterAttributeValue->text()) + " "; } } else{ if(ui->leFilterXPathExpression->isEnabled()){ - currCommand += "--xpath-expression " + Util::insertQuotes(ui->leFilterXPathExpression->text()) + " "; + currCommand += "--xpath-expression " + Util::String::insertQuotes(ui->leFilterXPathExpression->text()) + " "; } } if(alternativeFileLocation.isEmpty()){ - currCommand += "--files " + Util::insertQuotes(ui->leInputInputFiles->text()); + currCommand += "--files " + Util::String::insertQuotes(ui->leInputInputFiles->text()); } else{ - currCommand += "--files " + Util::insertQuotes(alternativeFileLocation); + currCommand += "--files " + Util::String::insertQuotes(alternativeFileLocation); }