source: s10k/Vago/xmlprocessor.cpp@ 1096

Last change on this file since 1096 was 1093, checked in by s10k, 7 years ago

Vago 1.4

File size: 1.3 KB
RevLine 
[771]1#include "xmlprocessor.h"
2
[1093]3XmlProcessor::XmlProcessor(QString AppDir, QStringList *commands)
[771]4{
[815]5 this->AppDir=AppDir;
[771]6 this->commands=commands;
7}
8
9void XmlProcessor::run()
10{
[1047]11 QProcess myProcess;
[771]12 QString result = QString();
13 QString errorMessage = "";
14 int numErrors=0;
15
[1047]16 myProcess.setWorkingDirectory(this->AppDir);
[815]17
[771]18 for(int i=0; i<this->commands->size(); i++){
19
[1052]20 myProcess.start(UtilVago::getXmlToolsExecutable() +" "+this->commands->at(i));
[1047]21 myProcess.waitForFinished(-1);
22 result=myProcess.readAllStandardError();
[771]23
24 if(!result.isEmpty()){
25 //catch exception
[1093]26 LOG_ERROR << "Xml Tools Error: \n" + this->commands->at(i) + "\n"+result;
[771]27 errorMessage=result;
28 numErrors++;
29 }
30
31 }
32
33 this->commands->clear(); //clean list
34
35 //let's cut it a bit, complete error is in log file.
36 if(errorMessage.size()>600){
37 //limit it at 400 characters (not counting the warning at the begin)
38 errorMessage.remove(299,errorMessage.size()-600);
39 errorMessage.insert(299,"\n \t ... \n");
40 errorMessage.insert(0,"This error was been shortened. \nSee the complete error at Vago log file.\n\n");
41 }
42
43 emit resultConversion(errorMessage,numErrors);
44}
45
Note: See TracBrowser for help on using the repository browser.