2012-12-08 14:25:50 +00:00
|
|
|
#ifndef CSM_TOOLS_OPERATION_H
|
|
|
|
#define CSM_TOOLS_OPERATION_H
|
|
|
|
|
2012-12-08 16:53:45 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2012-12-08 14:25:50 +00:00
|
|
|
#include <QThread>
|
|
|
|
|
|
|
|
namespace CSMTools
|
|
|
|
{
|
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;
|
|
|
|
|
|
|
|
void prepareStages();
|
2012-12-08 14:25:50 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Operation (int type);
|
|
|
|
|
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);
|
|
|
|
|
2012-12-08 17:38:36 +00:00
|
|
|
void reportMessage (const QString& message, int type);
|
|
|
|
|
2012-12-08 14:25:50 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void abort();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
void verify();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|