47 connect(mProcess, SIGNAL(stateChanged(QProcess::ProcessState)),
this, SLOT(processStateChanged(QProcess::ProcessState)));
48 connect(mProcess, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(processError(QProcess::ProcessError)));
49 connect(mProcess, SIGNAL(finished(
int, QProcess::ExitStatus)),
this, SLOT(processFinished(
int, QProcess::ExitStatus)));
50 connect(mProcess, SIGNAL(readyRead()),
this, SLOT(processReadyRead()));
55 disconnect(mProcess, SIGNAL(stateChanged(QProcess::ProcessState)),
this, SLOT(processStateChanged(QProcess::ProcessState)));
56 disconnect(mProcess, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(processError(QProcess::ProcessError)));
57 disconnect(mProcess, SIGNAL(finished(
int, QProcess::ExitStatus)),
this, SLOT(processFinished(
int, QProcess::ExitStatus)));
58 disconnect(mProcess, SIGNAL(readyRead()),
this, SLOT(processReadyRead()));
61 void ProcessReporter::processReadyRead()
63 report(QString(mProcess->readAllStandardOutput()));
66 void ProcessReporter::processStateChanged(QProcess::ProcessState newState)
68 if (newState == QProcess::Running)
70 report(QString(
"%1 started.").arg(mName));
72 if (newState == QProcess::NotRunning)
74 report(QString(
"%1 stopped.").arg(mName));
76 if (newState == QProcess::Starting)
78 report(QString(
"%1 starting.").arg(mName));
82 void ProcessReporter::processError(QProcess::ProcessError error)
85 msg += QString(
"%1 reported an error: ").arg(mName);
89 case QProcess::FailedToStart:
90 msg +=
"Failed to start";
92 case QProcess::Crashed:
95 case QProcess::Timedout:
98 case QProcess::WriteError:
101 case QProcess::ReadError:
104 case QProcess::UnknownError:
105 msg +=
"Unknown Error";
108 msg +=
"Invalid error";
114 void ProcessReporter::processFinished(
int exitCode, QProcess::ExitStatus exitStatus)
116 QString msg = QString(
"%1 exited with exit status %3. (%1 last exit code was %4.)").arg(mName).arg(exitStatus).arg(exitCode);
void reportError(QString msg)
#define CX_ASSERT(statement)
ProcessReporter(QProcess *process, QString name)
void reportSuccess(QString msg)
Namespace for all CustusX production code.