1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-24 06:23:54 +00:00
openmw/apps/opencs/model/doc/operationholder.hpp

51 lines
894 B
C++
Raw Normal View History

#ifndef CSM_DOC_OPERATIONHOLDER_H
#define CSM_DOC_OPERATIONHOLDER_H
#include <QObject>
#include <QThread>
namespace CSMDoc
{
class Operation;
2022-10-19 17:02:00 +00:00
struct Message;
class OperationHolder : public QObject
{
2022-09-22 18:26:05 +00:00
Q_OBJECT
2022-09-22 18:26:05 +00:00
QThread mThread;
Operation* mOperation;
bool mRunning;
2022-09-22 18:26:05 +00:00
public:
OperationHolder(Operation* operation = nullptr);
2022-09-22 18:26:05 +00:00
void setOperation(Operation* operation);
2022-09-22 18:26:05 +00:00
bool isRunning() const;
2022-09-22 18:26:05 +00:00
void start();
2022-09-22 18:26:05 +00:00
void abort();
2022-09-22 18:26:05 +00:00
// Abort and wait until thread has finished.
void abortAndWait();
2022-09-22 18:26:05 +00:00
private slots:
2022-09-22 18:26:05 +00:00
void doneSlot(int type, bool failed);
2022-09-22 18:26:05 +00:00
signals:
2022-09-22 18:26:05 +00:00
void progress(int current, int max, int type);
2022-09-22 18:26:05 +00:00
void reportMessage(const CSMDoc::Message& message, int type);
2022-09-22 18:26:05 +00:00
void done(int type, bool failed);
void abortSignal();
};
}
#endif