|
@@ -8,6 +8,14 @@ Application::Application(QObject *parent) :
|
|
connect(m_process,
|
|
connect(m_process,
|
|
SIGNAL(finished(int, QProcess::ExitStatus)),
|
|
SIGNAL(finished(int, QProcess::ExitStatus)),
|
|
SLOT(finished(int, QProcess::ExitStatus)));
|
|
SLOT(finished(int, QProcess::ExitStatus)));
|
|
|
|
+
|
|
|
|
+ connect(m_process,
|
|
|
|
+ SIGNAL(started()),
|
|
|
|
+ SLOT(process_started()));
|
|
|
|
+
|
|
|
|
+ connect(m_process,
|
|
|
|
+ SIGNAL(errorOccurred(QProcess::ProcessError)),
|
|
|
|
+ SLOT(process_error(QProcess::ProcessError)));
|
|
}
|
|
}
|
|
|
|
|
|
QString Application::appName() const
|
|
QString Application::appName() const
|
|
@@ -40,6 +48,20 @@ void Application::setstdOUT(const QString &stdOUT)
|
|
m_stdOUT = stdOUT;
|
|
m_stdOUT = stdOUT;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int Application::exitCode()
|
|
|
|
+{
|
|
|
|
+ return m_exitCode;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int Application::exitStatus()
|
|
|
|
+{
|
|
|
|
+ return m_exitStatus;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int Application::exitError()
|
|
|
|
+{
|
|
|
|
+ return m_error;
|
|
|
|
+}
|
|
|
|
|
|
QString Application::arguments() const
|
|
QString Application::arguments() const
|
|
{
|
|
{
|
|
@@ -51,16 +73,37 @@ void Application::setArguments(const QString &arguments)
|
|
m_Arguments = arguments;
|
|
m_Arguments = arguments;
|
|
}
|
|
}
|
|
|
|
|
|
-QString Application::launchScriptGetSTDOUT()
|
|
|
|
|
|
+void Application::launchScript()
|
|
{
|
|
{
|
|
|
|
+ m_stdERR.clear();
|
|
|
|
+ m_stdOUT.clear();
|
|
|
|
+ m_exitCode = -1;
|
|
|
|
+ m_exitStatus = -1;
|
|
|
|
+ m_error = -1;
|
|
|
|
+
|
|
m_process->start(m_AppName + " " + m_Arguments);
|
|
m_process->start(m_AppName + " " + m_Arguments);
|
|
-// m_process->waitForStarted(-1);
|
|
|
|
- return "Start requested";
|
|
|
|
qDebug() << "launching application" << m_AppName << "\n with the Argument of \n" + m_Arguments ;
|
|
qDebug() << "launching application" << m_AppName << "\n with the Argument of \n" + m_Arguments ;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
void Application::finished(int exitCode, QProcess::ExitStatus status)
|
|
void Application::finished(int exitCode, QProcess::ExitStatus status)
|
|
{
|
|
{
|
|
m_stdOUT = QString(m_process->readAllStandardOutput());
|
|
m_stdOUT = QString(m_process->readAllStandardOutput());
|
|
m_stdERR = QString(m_process->readAllStandardError());
|
|
m_stdERR = QString(m_process->readAllStandardError());
|
|
|
|
+ m_exitCode = exitCode;
|
|
|
|
+ m_exitStatus = status;
|
|
|
|
+
|
|
emit this->appFinished();
|
|
emit this->appFinished();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void Application::process_started(void)
|
|
|
|
+{
|
|
|
|
+ emit this->appStarted();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void Application::process_error(QProcess::ProcessError app_error)
|
|
|
|
+{
|
|
|
|
+ m_error = app_error;
|
|
|
|
+ emit this->appError();
|
|
|
|
+}
|