123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #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();
- }
|