application.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef APPLICATION_H
  2. #define APPLICATION_H
  3. #include <QObject>
  4. #include <QProcess>
  5. class Application : public QObject
  6. {
  7. Q_OBJECT
  8. public:
  9. explicit Application(QObject *parent = 0);
  10. Q_PROPERTY( QString appName READ appName WRITE setAppName)
  11. Q_PROPERTY( QString arguments READ arguments WRITE setArguments)
  12. Q_PROPERTY( QString stdERR READ stdERR WRITE setstdERR)
  13. Q_PROPERTY( QString stdOUT READ stdOUT WRITE setstdOUT)
  14. Q_PROPERTY( int exitCode READ exitCode)
  15. int exitCode();
  16. Q_PROPERTY( int exitStatus READ exitStatus)
  17. int exitStatus();
  18. Q_PROPERTY( int exitError READ exitError)
  19. int exitError();
  20. QString appName() const;
  21. void setAppName(const QString &appName);
  22. QString arguments() const;
  23. void setArguments(const QString &arguments);
  24. QString stdERR() const;
  25. void setstdERR(const QString &stdERR);
  26. QString stdOUT() const;
  27. void setstdOUT(const QString &stdOUT);
  28. Q_INVOKABLE void launchScript();
  29. Q_SIGNALS:
  30. void appFinished();
  31. void appStarted();
  32. void appError();
  33. private:
  34. QProcess *m_process;
  35. QString m_AppName;
  36. QString m_Arguments;
  37. QString m_stdERR;
  38. QString m_stdOUT;
  39. int m_exitCode;
  40. int m_exitStatus;
  41. int m_error;
  42. private Q_SLOTS:
  43. void finished(int exitCode, QProcess::ExitStatus status);
  44. void process_started(void);
  45. void process_error(QProcess::ProcessError);
  46. };
  47. #endif //APPLICATION_H