1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 18:32:36 +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 19:02:00 +02:00
struct Message;
class OperationHolder : public QObject
{
2022-09-22 21:26:05 +03:00
Q_OBJECT
2022-09-22 21:26:05 +03:00
QThread mThread;
Operation* mOperation;
bool mRunning;
2022-09-22 21:26:05 +03:00
public:
OperationHolder(Operation* operation = nullptr);
2022-09-22 21:26:05 +03:00
void setOperation(Operation* operation);
2022-09-22 21:26:05 +03:00
bool isRunning() const;
2022-09-22 21:26:05 +03:00
void start();
2022-09-22 21:26:05 +03:00
void abort();
2022-09-22 21:26:05 +03:00
// Abort and wait until thread has finished.
void abortAndWait();
2022-09-22 21:26:05 +03:00
private slots:
2022-09-22 21:26:05 +03:00
void doneSlot(int type, bool failed);
2022-09-22 21:26:05 +03:00
signals:
2022-09-22 21:26:05 +03:00
void progress(int current, int max, int type);
2022-09-22 21:26:05 +03:00
void reportMessage(const CSMDoc::Message& message, int type);
2022-09-22 21:26:05 +03:00
void done(int type, bool failed);
void abortSignal();
};
}
#endif