48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#ifndef MONITOR_H
|
|
#define MONITOR_H
|
|
|
|
#include <QString>
|
|
#include <QFileInfo>
|
|
#include "QObject"
|
|
#include "IProcessMonitor.h"
|
|
#include <QMap>
|
|
|
|
class Monitor : public QObject, public IProccessMonitor
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
void setListFiles(const QStringList &list) override final {
|
|
listFilesToSet = list;
|
|
}
|
|
|
|
const QStringList &getListFiles() override final {
|
|
return listFilesToSet;
|
|
};
|
|
std::string getLogFileName(){return std::to_string((long long)this)+".log" ;}
|
|
double getPercentComplete() const override final;
|
|
void setPercentComplete(double) override final;
|
|
static QMap<QString,Monitor *>& getMonitorList() {return monitoringList;}
|
|
std::list<int> listAllowedRetCodes={0};
|
|
void setRetCode(int retCode) override {
|
|
returnCode = retCode;
|
|
}
|
|
|
|
bool isSuccessFinished() const{
|
|
if (std::find(listAllowedRetCodes.begin(),listAllowedRetCodes.end(),returnCode) != listAllowedRetCodes.end()){
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
signals:
|
|
void percentCompleteChange(double percent);
|
|
|
|
private:
|
|
QStringList listFilesToSet;
|
|
int returnCode = -1;
|
|
double currentPercent = 0;
|
|
static QMap<QString,Monitor*> monitoringList;
|
|
};
|
|
#endif // MONITOR_H
|