1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/opencs/model/doc/operation.hpp

56 lines
1.2 KiB
C++
Raw Normal View History

#ifndef CSM_DOC_OPERATION_H
#define CSM_DOC_OPERATION_H
2012-12-08 14:25:50 +00:00
2012-12-08 16:53:45 +00:00
#include <vector>
2012-12-08 14:25:50 +00:00
#include <QThread>
namespace CSMDoc
2012-12-08 14:25:50 +00:00
{
2012-12-08 16:53:45 +00:00
class Stage;
2012-12-08 14:25:50 +00:00
class Operation : public QThread
{
Q_OBJECT
int mType;
2012-12-08 16:53:45 +00:00
std::vector<std::pair<Stage *, int> > mStages; // stage, number of steps
std::vector<std::pair<Stage *, int> >::iterator mCurrentStage;
int mCurrentStep;
int mCurrentStepTotal;
int mTotalSteps;
int mOrdered;
2012-12-08 16:53:45 +00:00
void prepareStages();
2012-12-08 14:25:50 +00:00
public:
Operation (int type, bool ordered);
///< \param parallel Stages must be executed in the given order.
2012-12-08 14:25:50 +00:00
2012-12-08 16:53:45 +00:00
virtual ~Operation();
2012-12-08 14:25:50 +00:00
virtual void run();
2012-12-08 16:53:45 +00:00
void appendStage (Stage *stage);
///< The ownership of \a stage is transferred to *this.
///
/// \attention Do no call this function while this Operation is running.
2012-12-08 14:25:50 +00:00
signals:
void progress (int current, int max, int type);
void reportMessage (const QString& message, int type);
2012-12-08 14:25:50 +00:00
public slots:
void abort();
private slots:
2013-09-15 07:32:20 +00:00
void executeStage();
2012-12-08 14:25:50 +00:00
};
}
#endif