98 lines
2.1 KiB
C++
98 lines
2.1 KiB
C++
#ifndef SRUNPROCESS
|
|
#define SRUNPROCESS
|
|
|
|
#include <QObject>
|
|
#include <memory>
|
|
#include <QVector>
|
|
#include "sutilclass.h"
|
|
|
|
class QTimer;
|
|
class QProcess;
|
|
|
|
//enum class E_RUN_MODE;
|
|
|
|
|
|
class SRunProcess:public QObject
|
|
{
|
|
Q_OBJECT
|
|
enum class E_LIST_MODE:unsigned short
|
|
{
|
|
MODE_COMPANY = 0,
|
|
MODE_ERROR
|
|
};
|
|
enum class E_INNER_RUN_MODE:unsigned short;
|
|
|
|
|
|
public:
|
|
explicit SRunProcess();
|
|
~SRunProcess();
|
|
void setList(const QVector<int>& _runList);
|
|
void setList(QVector<int>&& _runList);
|
|
void setList(const QVector<SError>& _errorList);
|
|
void setList(QVector<SError>&& _errorList);
|
|
bool isRunning();
|
|
SRunProcess& operator=(const SRunProcess& other) = delete;
|
|
SRunProcess(const SRunProcess& other) = delete;
|
|
template <typename T>
|
|
void start(QVector<T>&& _list);
|
|
SError gerError();
|
|
|
|
|
|
public slots:
|
|
void stop();
|
|
void start();
|
|
SReportSummary getReportSummary();
|
|
QVector<SError> getErrorList();
|
|
|
|
|
|
private slots:
|
|
void update();
|
|
|
|
|
|
signals:
|
|
void signalTerminateAllCompany();
|
|
void signalTerminateCompany();
|
|
void signalTerminateError();
|
|
void signalTerminateAllError();
|
|
void signalUserAbort();
|
|
void signalError();
|
|
|
|
|
|
private:
|
|
void init();
|
|
void initDatabase();
|
|
void run();
|
|
void updateCompany();
|
|
void updateError();
|
|
|
|
void processError(SError&& _error);
|
|
void processError(const SError& _error);
|
|
void runInitCompany();
|
|
void runInitError();
|
|
void runEventcodeCompany();
|
|
void runEventcodeError();
|
|
void runFinishEventcode();
|
|
|
|
void userAbort();
|
|
void setInnerMode(E_INNER_RUN_MODE _inner_mode);
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<QTimer> m_pTimer;
|
|
std::unique_ptr<QProcess> m_pProcess;
|
|
QVector<int> m_vecRunList;
|
|
QVector<SError> m_vecErrorList;
|
|
QVector<int> m_vecRunOrderList;
|
|
QMap<int, QVector<SEffectRow>> m_mapEffectRow;
|
|
E_RUN_MODE m_eRunMode;
|
|
E_LIST_MODE m_eListMode;
|
|
E_INNER_RUN_MODE m_eInnerRunMode;
|
|
SError m_errError;
|
|
bool m_bRun;
|
|
};
|
|
|
|
|
|
#endif // SRUNPROCESS
|
|
|