|
@@ -0,0 +1,66 @@
|
|
|
+#include "application.h"
|
|
|
+#include <QProcess>
|
|
|
+#include <QDebug>
|
|
|
+Application::Application(QObject *parent) :
|
|
|
+ QObject(parent),
|
|
|
+ m_process(new QProcess(this))
|
|
|
+{
|
|
|
+ connect(m_process,
|
|
|
+ SIGNAL(finished(int, QProcess::ExitStatus)),
|
|
|
+ SLOT(finished(int, QProcess::ExitStatus)));
|
|
|
+}
|
|
|
+
|
|
|
+QString Application::appName() const
|
|
|
+{
|
|
|
+ return m_AppName;
|
|
|
+}
|
|
|
+
|
|
|
+void Application::setAppName(const QString &appName)
|
|
|
+{
|
|
|
+ m_AppName = appName;
|
|
|
+}
|
|
|
+
|
|
|
+QString Application::stdERR() const
|
|
|
+{
|
|
|
+ return m_stdERR;
|
|
|
+}
|
|
|
+
|
|
|
+void Application::setstdERR(const QString &stdERR)
|
|
|
+{
|
|
|
+ m_stdERR = stdERR;
|
|
|
+}
|
|
|
+
|
|
|
+QString Application::stdOUT() const
|
|
|
+{
|
|
|
+ return m_stdOUT;
|
|
|
+}
|
|
|
+
|
|
|
+void Application::setstdOUT(const QString &stdOUT)
|
|
|
+{
|
|
|
+ m_stdOUT = stdOUT;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+QString Application::arguments() const
|
|
|
+{
|
|
|
+ return m_Arguments;
|
|
|
+}
|
|
|
+
|
|
|
+void Application::setArguments(const QString &arguments)
|
|
|
+{
|
|
|
+ m_Arguments = arguments;
|
|
|
+}
|
|
|
+
|
|
|
+QString Application::launchScriptGetSTDOUT()
|
|
|
+{
|
|
|
+ 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 ;
|
|
|
+}
|
|
|
+void Application::finished(int exitCode, QProcess::ExitStatus status)
|
|
|
+{
|
|
|
+ m_stdOUT = QString(m_process->readAllStandardOutput());
|
|
|
+ m_stdERR = QString(m_process->readAllStandardError());
|
|
|
+ emit this->appFinished();
|
|
|
+}
|