void MainWindow::on_run_QAction_triggered()
{
run_QP.start(CMD1);
connect(&run_QP,
SIGNAL(finished
(int,
QProcess::ExitStatus)),
this,
SLOT(run_HandleFinished
(int,
QProcess::ExitStatus)));
connect(&run_QP, SIGNAL(started()), this, SLOT(run_HandleStarted()));
}
void MainWindow
::run_HandleFinished(int ecode,
QProcess::ExitStatus estat
) {
handleFinished("comp1", ecode, estat);
}
void MainWindow::run_HandleStarted()
{
handleStarted("comp1");
}
void MainWindow
::handleFinished(QString comp,
int exitCode,
QProcess::ExitStatus exitStat
) {
switch (exitStat)
{
print2Output
(tmp.
arg(comp,
"exited normaly with ",
QString::number(exitCode
)));
break;
print2Output
(tmp.
arg(comp,
"crashed with ",
QString::number(exitCode
)));
break;
}
}
void MainWindow
::handleStarted(QString comp
) {
print2Output(comp + " was started");
}
void MainWindow::on_run_QAction_triggered()
{
run_QP.start(CMD1);
connect(&run_QP, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(run_HandleFinished(int, QProcess::ExitStatus)));
connect(&run_QP, SIGNAL(started()), this, SLOT(run_HandleStarted()));
}
void MainWindow::run_HandleFinished(int ecode, QProcess::ExitStatus estat)
{
handleFinished("comp1", ecode, estat);
}
void MainWindow::run_HandleStarted()
{
handleStarted("comp1");
}
void MainWindow::handleFinished(QString comp, int exitCode, QProcess::ExitStatus exitStat)
{
QString tmp = QString("%1 %2 %3.");
switch (exitStat)
{
case QProcess::NormalExit:
print2Output(tmp.arg(comp, "exited normaly with ", QString::number(exitCode)));
break;
case QProcess::CrashExit:
print2Output(tmp.arg(comp, "crashed with ", QString::number(exitCode)));
break;
}
}
void MainWindow::handleStarted(QString comp)
{
print2Output(comp + " was started");
}
To copy to clipboard, switch view to plain text mode
Bookmarks