2012-12-08 10:59:13 +00:00
|
|
|
#ifndef CSM_TOOLS_TOOLS_H
|
|
|
|
#define CSM_TOOLS_TOOLS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
2012-12-11 14:35:47 +00:00
|
|
|
#include <map>
|
|
|
|
|
2015-03-14 11:00:24 +00:00
|
|
|
#include "../doc/operationholder.hpp"
|
|
|
|
|
2012-12-08 22:27:59 +00:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class Data;
|
2012-12-11 14:35:47 +00:00
|
|
|
class UniversalId;
|
2012-12-08 22:27:59 +00:00
|
|
|
}
|
|
|
|
|
2013-09-14 12:56:23 +00:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Operation;
|
2014-07-21 10:15:21 +00:00
|
|
|
class Document;
|
2013-09-14 12:56:23 +00:00
|
|
|
}
|
|
|
|
|
2012-12-08 10:59:13 +00:00
|
|
|
namespace CSMTools
|
|
|
|
{
|
2012-12-11 14:35:47 +00:00
|
|
|
class ReportModel;
|
2012-12-08 10:59:13 +00:00
|
|
|
|
|
|
|
class Tools : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2014-07-21 10:15:21 +00:00
|
|
|
CSMDoc::Document& mDocument;
|
2012-12-08 22:27:59 +00:00
|
|
|
CSMWorld::Data& mData;
|
2015-03-14 11:00:24 +00:00
|
|
|
CSMDoc::Operation *mVerifierOperation;
|
|
|
|
CSMDoc::OperationHolder mVerifier;
|
2012-12-11 14:35:47 +00:00
|
|
|
std::map<int, ReportModel *> mReports;
|
|
|
|
int mNextReportNumber;
|
|
|
|
std::map<int, int> mActiveReports; // type, report number
|
2012-12-08 10:59:13 +00:00
|
|
|
|
|
|
|
// not implemented
|
|
|
|
Tools (const Tools&);
|
|
|
|
Tools& operator= (const Tools&);
|
|
|
|
|
2015-03-14 11:00:24 +00:00
|
|
|
CSMDoc::OperationHolder *getVerifier();
|
2012-12-08 10:59:13 +00:00
|
|
|
|
2015-03-14 11:00:24 +00:00
|
|
|
CSMDoc::OperationHolder *get (int type);
|
2012-12-08 16:00:58 +00:00
|
|
|
///< Returns a 0-pointer, if operation hasn't been used yet.
|
|
|
|
|
2015-03-14 11:00:24 +00:00
|
|
|
const CSMDoc::OperationHolder *get (int type) const;
|
2012-12-08 16:00:58 +00:00
|
|
|
///< Returns a 0-pointer, if operation hasn't been used yet.
|
|
|
|
|
2012-12-08 10:59:13 +00:00
|
|
|
public:
|
|
|
|
|
2014-07-21 10:15:21 +00:00
|
|
|
Tools (CSMDoc::Document& document);
|
2012-12-08 10:59:13 +00:00
|
|
|
|
|
|
|
virtual ~Tools();
|
|
|
|
|
2012-12-11 14:35:47 +00:00
|
|
|
CSMWorld::UniversalId runVerifier();
|
|
|
|
///< \return ID of the report for this verification run
|
2012-12-08 10:59:13 +00:00
|
|
|
|
|
|
|
void abortOperation (int type);
|
|
|
|
///< \attention The operation is not aborted immediately.
|
|
|
|
|
2012-12-08 16:00:58 +00:00
|
|
|
int getRunningOperations() const;
|
|
|
|
|
2012-12-11 14:35:47 +00:00
|
|
|
ReportModel *getReport (const CSMWorld::UniversalId& id);
|
|
|
|
///< The ownership of the returned report is not transferred.
|
|
|
|
|
2012-12-08 10:59:13 +00:00
|
|
|
private slots:
|
|
|
|
|
2014-05-08 10:42:29 +00:00
|
|
|
void verifierMessage (const CSMWorld::UniversalId& id, const std::string& message,
|
2014-12-07 19:53:09 +00:00
|
|
|
const std::string& hint, int type);
|
2012-12-08 17:38:36 +00:00
|
|
|
|
2012-12-08 10:59:13 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void progress (int current, int max, int type);
|
|
|
|
|
2014-09-03 17:14:27 +00:00
|
|
|
void done (int type, bool failed);
|
2012-12-08 10:59:13 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|