|
Canorus 0.0
|
Start a program as extern background process. More...
#include <externprogram.h>

Signals | |
| void | nextOutput (const QByteArray &roData) |
| void | programExited (int iExitCode) |
Public Member Functions | |
| CAExternProgram (bool bRcvStdErr=true, bool bRcvStdOut=true) | |
| ~CAExternProgram () | |
| void | setProgramName (const QString &roProgram) |
| void | setProgramPath (const QString &roPath) |
| void | setParameters (const QStringList &roParams) |
| void | setParamDelimiter (QString oDelimiter=" ") |
| const QStringList & | getParameters () |
| bool | getRunning () |
| const QString & | getParamDelimiter () |
| int | getExitState () |
| void | addParameter (const QString &roParam, bool bAddDelimiter=true) |
| void | clearParameters () |
| bool | execProgram (const QString &roCwd=".") |
| bool | waitForFinished (int iMSecs) |
Protected Slots | |
| void | rcvProgramStdOut () |
| void | rcvProgramStdErr () |
| void | programError (QProcess::ProcessError) |
| void | programFinished (int, QProcess::ExitStatus) |
Protected Member Functions | |
| void | rcvProgramOutput (const QByteArray &roData) |
| void | programExited () |
Protected Attributes | |
| QProcess * | _poExternProgram |
| QString | _oProgramName |
| QString | _oProgramPath |
| QStringList | _oParameters |
| QString | _oParamDelimiter |
| bool | _bRcvStdErr |
Start a program as extern background process.
Copyright (c) 2006-2008, Reinhard Katzmann, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.
Licensed under the GNU GENERAL PUBLIC LICENSE. See COPYING for details.
Copyright (c) 2006-2008, Reinhard Katzmann, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.
Licensed under the GNU GENERAL PUBLIC LICENSE. See COPYING for details.
This class is used to start an extern program as background process. Parameters are the program name and it's parameters The output of the program can be fetched via signal/slots Another signal is sent when the program finished including it's state
Constructor: If the stderr output should not be shown, bRcvStdErr has has to be set to false.
| CAExternProgram::CAExternProgram | ( | bool | bRcvStdErr = true, |
| bool | bRcvStdOut = true |
||
| ) |
References _bRcvStdErr, _oParamDelimiter, _poExternProgram, programError(), programFinished(), rcvProgramStdErr(), and rcvProgramStdOut().

| CAExternProgram::~CAExternProgram | ( | ) |
References _poExternProgram.
| void CAExternProgram::addParameter | ( | const QString & | roParam, |
| bool | bAddDelimiter = true |
||
| ) |
Adds a new parameter to the list of parameters
This method allows a fine grain control of the parameters being added to the program. Beside the oParam the delimiter is automatically add inserted if you don't set bAddDelimiter to false (the delimiter defaults to a single space character)
References _oParamDelimiter, and _oParameters.
Referenced by CATypesetCtl::exportDocument(), CATypesetCtl::exportSheet(), CATypesetCtl::runTypesetter(), and CATypesetCtl::setTSetOption().

|
inline |
References _oParameters.
Referenced by CATypesetCtl::exportDocument(), and CATypesetCtl::exportSheet().

| bool CAExternProgram::execProgram | ( | const QString & | roCwd = "." | ) |
Runs the program in the specified oCwd (working directory)
This method tries to start the specified program using the specified parameters. If a working directory is specified the it is applied to the process before the program starts. Errors on start are immediately reported to the error console.
References _oParameters, _oProgramName, _oProgramPath, and _poExternProgram.
Referenced by CATypesetCtl::createPDF(), and CATypesetCtl::runTypesetter().

| int CAExternProgram::getExitState | ( | ) |
Returns the exit status of the finished program
Returns "-1" if the program is still running, else the exist status of the process
References _poExternProgram, and getRunning().

|
inline |
References _oParamDelimiter.
|
inline |
References _oParameters.
|
inline |
References _poExternProgram.
Referenced by getExitState(), and programExited().

|
signal |
|
inlineprotectedslot |
References programExited().
Referenced by CAExternProgram().


|
protected |
This slot sends a signal when the extern program is finished or reports an error
To get acknowledged by the program end and when an error occurs connect to the signal programExited. Only errors leading to a program crash are reported this way others are only put out to the console
References _oProgramName, _poExternProgram, getRunning(), and programExited().
Referenced by programError(), programExited(), and programFinished().


|
signal |
|
inlineprotectedslot |
References programExited().
Referenced by CAExternProgram().


|
protected |
This method sends a signal when data is received by the extern program
To receive data from the extern program create a signal/slot connection to the nextOutput signal. This class does not cache any data! The \o roData contains the data received by the process output to either stdout or stderr. Use the constructor to define if you don't wish to either receive standartd output or standard error.
References nextOutput().
Referenced by rcvProgramStdErr(), and rcvProgramStdOut().

|
inlineprotectedslot |
References _poExternProgram, and rcvProgramOutput().
Referenced by CAExternProgram().


|
inlineprotectedslot |
References _poExternProgram, and rcvProgramOutput().
Referenced by CAExternProgram().


|
inline |
References _oParamDelimiter.
| void CAExternProgram::setParameters | ( | const QStringList & | roParams | ) |
Defines the parameters of the program to be run This method let's you define all the \a oParams being added to the executable name at once. It removed all existant parameters.
If you need a finer parameter control you can use this method to just define the first parameter if you need to change them.
\sa addParameter( QString oParam, bool bAddSpaces = true ) \sa setProgramName( QString oProgram )
References _oParameters.
Referenced by CATypesetCtl::setPS2PDF().

| void CAExternProgram::setProgramName | ( | const QString & | roProgram | ) |
Defines the program executable name to be run
This method let's you define the oProgramm executable name. If the program cannot be found in the PATH then you either need to add it to the program name or define it separately via setProgramPath
References _oProgramName.
Referenced by CATypesetCtl::setPS2PDF(), and CATypesetCtl::setTypesetter().

| void CAExternProgram::setProgramPath | ( | const QString & | roPath | ) |
Defines the program path of the program executable
This method let's you define the oPath name where the executable name can be found. You only need to set it if the program executable name cannot be found in the PATH.
References _oProgramPath.
Referenced by CATypesetCtl::setPS2PDF(), and CATypesetCtl::setTypesetter().

|
inline |
References _poExternProgram.
Referenced by CATypesetCtl::waitForFinished().

|
protected |
Referenced by CAExternProgram().
|
protected |
Referenced by addParameter(), CAExternProgram(), getParamDelimiter(), and setParamDelimiter().
|
protected |
Referenced by addParameter(), clearParameters(), execProgram(), getParameters(), and setParameters().
|
protected |
Referenced by execProgram(), programExited(), and setProgramName().
|
protected |
Referenced by execProgram(), and setProgramPath().
|
protected |