77 lines
1.9 KiB
C++
77 lines
1.9 KiB
C++
#ifndef SPARENTPROCESS
|
|
#define SPARENTPROCESS
|
|
#include <QObject>
|
|
#include "sutilclass.h"
|
|
#include <QVector>
|
|
#include <QMap>
|
|
#include <QProcess>
|
|
|
|
class QStringList;
|
|
class QString;
|
|
|
|
|
|
class SParentProcess: public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
enum class E_INNER_RUN_MODE:unsigned short;
|
|
|
|
|
|
public:
|
|
SParentProcess();
|
|
virtual void setList(const QVector<int>& _list) = 0;
|
|
virtual void setList(QVector<int>&& _list) = 0;
|
|
virtual void setList(const QVector<SError>& _list) = 0;
|
|
virtual void setList(QVector<SError>&& _list) = 0;
|
|
virtual void runInit() = 0;
|
|
virtual void runEventCode() = 0;
|
|
virtual void clear();
|
|
QVector<SError> getErrorList() const;
|
|
SReportSummary getReportSummary(int _id) const;
|
|
QMap<int, SReportSummary> getReportSummary() const;
|
|
SError getError() const;
|
|
bool isWaiting() const;
|
|
void setModeWait();
|
|
void runProcess();
|
|
|
|
private:
|
|
void setError(const SError& _error);
|
|
void setError(SError&& _error);
|
|
void setInnerMode(E_INNER_RUN_MODE _mode);
|
|
QStringList getProcessArguments(const SEffectRow& _row) const;
|
|
QStringList getProcessArguments(SEffectRow&& _row) const;
|
|
SError analyzeStdOut(const QString& _str);
|
|
QString makeLog(const SError& _error);
|
|
|
|
|
|
public slots:
|
|
void stop();
|
|
void update();
|
|
void finishedProcess(int exitCode, QProcess::ExitStatus exitStatus);
|
|
|
|
|
|
signals:
|
|
void signalUserAbort();
|
|
void signalTerminateError();
|
|
void signalTerminateNormal();
|
|
void signalTerminate();
|
|
void signalLog(const QString& _log);
|
|
|
|
private:
|
|
QProcess* m_pProcess;
|
|
|
|
E_INNER_RUN_MODE m_eInnerMode;
|
|
SEffectRow m_erCurrentRow;
|
|
QVector<SError> m_vecError;
|
|
bool m_bRunning;
|
|
unsigned int nTime;
|
|
SError m_error;
|
|
bool m_bUserAbort;
|
|
QMap<int, SReportSummary> m_mapReportSummary;
|
|
};
|
|
|
|
|
|
#endif // SPARENTPROCESS
|
|
|