2015-03-14 11:00:24 +00:00
|
|
|
#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;
|
2015-03-14 11:00:24 +00:00
|
|
|
|
|
|
|
class OperationHolder : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
QThread mThread;
|
|
|
|
Operation* mOperation;
|
|
|
|
bool mRunning;
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
2020-11-13 07:39:47 +00:00
|
|
|
OperationHolder(Operation* operation = nullptr);
|
2015-03-14 11:00:24 +00:00
|
|
|
|
|
|
|
void setOperation(Operation* operation);
|
|
|
|
|
|
|
|
bool isRunning() const;
|
|
|
|
|
|
|
|
void start();
|
|
|
|
|
|
|
|
void abort();
|
|
|
|
|
|
|
|
// Abort and wait until thread has finished.
|
|
|
|
void abortAndWait();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
void doneSlot(int type, bool failed);
|
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
signals:
|
2015-03-14 11:00:24 +00:00
|
|
|
|
2015-06-20 15:56:42 +00:00
|
|
|
void progress(int current, int max, int type);
|
2015-03-14 11:00:24 +00:00
|
|
|
|
|
|
|
void reportMessage(const CSMDoc::Message& message, int type);
|
|
|
|
|
|
|
|
void done(int type, bool failed);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-03-14 11:00:24 +00:00
|
|
|
void abortSignal();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|