Public Member Functions | |
KLFFilterProcess (const QString &pTitle=QString(), const KLFBackend::klfSettings *settings=NULL, const QString &rundir=QString()) | |
KLFFilterProcess (const QString &pTitle, const KLFBackend::klfSettings *settings, const QString &rundir, bool inheritProcessEnvironment) | |
QString | progTitle () const |
void | setProgTitle (const QString &title) |
QString | programCwd () const |
void | setProgramCwd (const QString &cwd) |
QStringList | execEnviron () const |
void | setExecEnviron (const QStringList &env) |
void | addExecEnviron (const QStringList &env) |
QStringList | argv () const |
void | setArgv (const QStringList &argv) |
void | addArgv (const QStringList &argv) |
void | addArgv (const QString &argv) |
bool | outputStdout () const |
void | setOutputStdout (bool on) |
bool | outputStderr () const |
void | setOutputStderr (bool on) |
void | collectStdoutTo (QByteArray *stdoutstore) |
void | collectStderrTo (QByteArray *stderrstore) |
bool | processAppEvents () |
void | setProcessAppEvents (bool processEvents) |
virtual int | exitStatus () const |
virtual int | exitCode () const |
virtual int | resultStatus () const |
virtual QString | resultErrorString () const |
bool | run (const QString &outFileName, QByteArray *outdata) |
bool | run (const QByteArray &indata, const QString &outFileName, QByteArray *outdata) |
bool | run (const QMap< QString, QByteArray * > outdata) |
bool | run (const QByteArray &indata=QByteArray()) |
bool | run (const QByteArray &indata, const QMap< QString, QByteArray * > outdatalist) |
Protected Member Functions | |
virtual QMap< QString, QString > | interpreters () const |
virtual bool | do_run (const QByteArray &indata, const QMap< QString, QByteArray * > outdatalist) |
Actually run the process. More... | |
QByteArray | collectedStdout () const |
The collected stdout data of the process that just ran. More... | |
QByteArray | collectedStderr () const |
The collected stderr data of the process that just ran. More... | |
Definition at line 47 of file klffilterprocess.h.
|
protected |
The collected stderr data of the process that just ran.
Convenience method for subclasses. Stderr data collection must have been enabled (with setOutputStderr() and collectStderrTo()).
Definition at line 435 of file klffilterprocess.cpp.
Referenced by KLFUserScriptFilterProcess::do_run().
|
protected |
The collected stdout data of the process that just ran.
Convenience method for subclasses. Stdout data collection must have been enabled (with setOutputStdout() and collectStdoutTo()).
Definition at line 428 of file klffilterprocess.cpp.
Referenced by KLFUserScriptFilterProcess::do_run().
void KLFFilterProcess::collectStderrTo | ( | QByteArray * | stderrstore | ) |
Set a QByteArray where all stderr data will be stored
Definition at line 271 of file klffilterprocess.cpp.
References setOutputStderr().
void KLFFilterProcess::collectStdoutTo | ( | QByteArray * | stdoutstore | ) |
Set a QByteArray where all stdout data will be stored
Definition at line 266 of file klffilterprocess.cpp.
References setOutputStdout().
|
protectedvirtual |
Actually run the process.
Each run() overload above internally just redirects to this function.
Subclasses may reimplement if they want to do some bookkeeping, cleaning up, keeping a log, etc.
Reimplemented in KLFUserScriptFilterProcess.
Definition at line 310 of file klffilterprocess.cpp.
References QString::arg(), QMap::begin(), QMap::end(), QFile::exists(), QString::isEmpty(), QByteArray::isEmpty(), QMap::key(), KLF_ASSERT_CONDITION, KLF_ASSERT_NOT_NULL, KLF_DEBUG_BLOCK, KLF_FUNC_NAME, klfDbg, QFile::open(), QIODevice::readAll(), QByteArray::size(), QObject::tr(), and QMap::value().
Referenced by KLFUserScriptFilterProcess::do_run().
|
virtual |
After run(), this is set to the exit code of the process. See QProcess::exitCode()
Definition at line 291 of file klffilterprocess.cpp.
|
virtual |
After run(), this is set to the exit status of the process. See QProcess::exitStatus()
Definition at line 287 of file klffilterprocess.cpp.
bool KLFFilterProcess::processAppEvents | ( | ) |
Definition at line 277 of file klffilterprocess.cpp.
|
virtual |
An explicit error string in case the resultStatus() indicated an error.
Definition at line 300 of file klffilterprocess.cpp.
Referenced by KLFUserScriptFilterProcess::do_run().
|
virtual |
This is one of the KLFFP_* define's, such as KLFFP_NOSTART, or KLFFP_NOERR if all OK.
Definition at line 296 of file klffilterprocess.cpp.
|
inline |
indata | a QByteArray to write into the program's standard input |
outdatalist | a QMap with keys being files that are created by the program. These files are read and their contents stored in the QByteArray's pointed by the corresponding pointer. |
resError | the klfOutput object is initialized to the corresponding error if an error occurred. |
An empty file name in the list means to collect the standard output.
Definition at line 139 of file klffilterprocess.h.
void KLFFilterProcess::setOutputStderr | ( | bool | on | ) |
Set this to true to also read stderr as part of the output. If false (the default), stderr output is only reported in the error message in case nothing came out on stdout.
Definition at line 261 of file klffilterprocess.cpp.
Referenced by collectStderrTo().
void KLFFilterProcess::setOutputStdout | ( | bool | on | ) |
Set this to false to ignore output on stdout of the program.
Definition at line 252 of file klffilterprocess.cpp.
Referenced by collectStdoutTo().
void KLFFilterProcess::setProcessAppEvents | ( | bool | processEvents | ) |
specify whether or not to call regularly qApp->processEvents() while executing. This will prevent the GUI to freeze. Enabled is the default. However you can choose to disable this behavior by passing FALSE here, e.g. if you're not in the GUI thread.
Definition at line 282 of file klffilterprocess.cpp.