Menu

[c54480]: / xsltproc.cpp  Maximize  Restore  History

Download this file

98 lines (79 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include "xsltproc.h"
#include <iostream>
#include <QDebug>
#include <QMessageBox>
#include "vymprocess.h"
extern bool debug;
XSLTProc::XSLTProc ()
{
xsltprocessor="xsltproc";
showOutput=false;
dia=new ShowTextDialog;
}
XSLTProc::~XSLTProc ()
{
delete (dia);
}
void XSLTProc::addStringParam (const QString & k, const QString &v)
{
stringParamKey.append (k);
stringParamVal.append (v);
}
void XSLTProc::setOutputFile (const QString &s)
{
outputFile=s;
}
void XSLTProc::setXSLFile(const QString &s)
{
xslFile=s;
}
void XSLTProc::setInputFile (const QString &s)
{
inputFile=s;
}
void XSLTProc::addOutput (const QString &s)
{
dia->append (s);
}
void XSLTProc::process()
{
ShowTextDialog dia;
dia.useFixedFont (true);
QStringList args;
VymProcess *xsltProc=new VymProcess ();
QStringList::Iterator itk;
QStringList::Iterator itv=stringParamVal.begin();
for ( itk = stringParamKey.begin(); itk != stringParamKey.end(); ++itk )
{
args << "--stringparam";
args << *itk;
args << *itv;
++itv;
}
args << "--output";
args << outputFile;
args << xslFile;
args << inputFile;
QString com=xsltprocessor+" "+args.join(" ");
if (debug) qDebug() <<"xsltproc executing:\n"<<qPrintable(com);
dia.append ("vym is executing: \n" + com );
xsltProc->start(xsltprocessor,args);
if (!xsltProc->waitForStarted() )
{
QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
QObject::tr("Could not start %1").arg(xsltprocessor) );
} else
{
if (!xsltProc->waitForFinished())
{
QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
QObject::tr("%1 didn't exit normally").arg(xsltprocessor) +
xsltProc->getErrout() );
if (xsltProc->exitStatus()>0) showOutput=true;
}
}
dia.append ("\n");
dia.append (xsltProc->getErrout());
dia.append (xsltProc->getStdout());
if (showOutput) dia.exec();
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.