moved Operation and Stage from model/tools to model/doc

This commit is contained in:
Marc Zinnschlag 2013-09-14 14:56:23 +02:00
parent c961abce96
commit 077a157841
18 changed files with 54 additions and 51 deletions

View file

@ -5,11 +5,11 @@ opencs_units (. editor)
set (CMAKE_BUILD_TYPE DEBUG) set (CMAKE_BUILD_TYPE DEBUG)
opencs_units (model/doc opencs_units (model/doc
document document operation
) )
opencs_units_noqt (model/doc opencs_units_noqt (model/doc
documentmanager documentmanager stage
) )
opencs_hdrs_noqt (model/doc opencs_hdrs_noqt (model/doc
@ -33,11 +33,11 @@ opencs_hdrs_noqt (model/world
opencs_units (model/tools opencs_units (model/tools
tools operation reportmodel tools reportmodel
) )
opencs_units_noqt (model/tools opencs_units_noqt (model/tools
stage verifier mandatoryid skillcheck classcheck factioncheck racecheck soundcheck regioncheck verifier mandatoryid skillcheck classcheck factioncheck racecheck soundcheck regioncheck
birthsigncheck spellcheck birthsigncheck spellcheck
) )

View file

@ -6,11 +6,10 @@
#include <QTimer> #include <QTimer>
#include "../doc/state.hpp" #include "state.hpp"
#include "stage.hpp" #include "stage.hpp"
void CSMTools::Operation::prepareStages() void CSMDoc::Operation::prepareStages()
{ {
mCurrentStage = mStages.begin(); mCurrentStage = mStages.begin();
mCurrentStep = 0; mCurrentStep = 0;
@ -24,15 +23,15 @@ void CSMTools::Operation::prepareStages()
} }
} }
CSMTools::Operation::Operation (int type) : mType (type) {} CSMDoc::Operation::Operation (int type) : mType (type) {}
CSMTools::Operation::~Operation() CSMDoc::Operation::~Operation()
{ {
for (std::vector<std::pair<Stage *, int> >::iterator iter (mStages.begin()); iter!=mStages.end(); ++iter) for (std::vector<std::pair<Stage *, int> >::iterator iter (mStages.begin()); iter!=mStages.end(); ++iter)
delete iter->first; delete iter->first;
} }
void CSMTools::Operation::run() void CSMDoc::Operation::run()
{ {
prepareStages(); prepareStages();
@ -45,17 +44,17 @@ void CSMTools::Operation::run()
exec(); exec();
} }
void CSMTools::Operation::appendStage (Stage *stage) void CSMDoc::Operation::appendStage (Stage *stage)
{ {
mStages.push_back (std::make_pair (stage, 0)); mStages.push_back (std::make_pair (stage, 0));
} }
void CSMTools::Operation::abort() void CSMDoc::Operation::abort()
{ {
exit(); exit();
} }
void CSMTools::Operation::verify() void CSMDoc::Operation::verify()
{ {
std::vector<std::string> messages; std::vector<std::string> messages;

View file

@ -1,11 +1,11 @@
#ifndef CSM_TOOLS_OPERATION_H #ifndef CSM_DOC_OPERATION_H
#define CSM_TOOLS_OPERATION_H #define CSM_DOC_OPERATION_H
#include <vector> #include <vector>
#include <QThread> #include <QThread>
namespace CSMTools namespace CSMDoc
{ {
class Stage; class Stage;

View file

@ -0,0 +1,4 @@
#include "stage.hpp"
CSMDoc::Stage::~Stage() {}

View file

@ -1,10 +1,10 @@
#ifndef CSM_TOOLS_STAGE_H #ifndef CSM_DOC_STAGE_H
#define CSM_TOOLS_STAGE_H #define CSM_DOC_STAGE_H
#include <vector> #include <vector>
#include <string> #include <string>
namespace CSMTools namespace CSMDoc
{ {
class Stage class Stage
{ {
@ -16,7 +16,7 @@ namespace CSMTools
///< \return number of steps ///< \return number of steps
virtual void perform (int stage, std::vector<std::string>& messages) = 0; virtual void perform (int stage, std::vector<std::string>& messages) = 0;
///< Messages resulting from this tage will be appended to \a messages. ///< Messages resulting from this stage will be appended to \a messages.
}; };
} }

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that birthsign records are internally consistent /// \brief VerifyStage: make sure that birthsign records are internally consistent
class BirthsignCheckStage : public Stage class BirthsignCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::BirthSign>& mBirthsigns; const CSMWorld::IdCollection<ESM::BirthSign>& mBirthsigns;

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that class records are internally consistent /// \brief VerifyStage: make sure that class records are internally consistent
class ClassCheckStage : public Stage class ClassCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::Class>& mClasses; const CSMWorld::IdCollection<ESM::Class>& mClasses;

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that faction records are internally consistent /// \brief VerifyStage: make sure that faction records are internally consistent
class FactionCheckStage : public Stage class FactionCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::Faction>& mFactions; const CSMWorld::IdCollection<ESM::Faction>& mFactions;

View file

@ -6,7 +6,7 @@
#include "../world/universalid.hpp" #include "../world/universalid.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMWorld namespace CSMWorld
{ {
@ -16,7 +16,7 @@ namespace CSMWorld
namespace CSMTools namespace CSMTools
{ {
/// \brief Verify stage: make sure that records with specific IDs exist. /// \brief Verify stage: make sure that records with specific IDs exist.
class MandatoryIdStage : public Stage class MandatoryIdStage : public CSMDoc::Stage
{ {
const CSMWorld::CollectionBase& mIdCollection; const CSMWorld::CollectionBase& mIdCollection;
CSMWorld::UniversalId mCollectionId; CSMWorld::UniversalId mCollectionId;

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that race records are internally consistent /// \brief VerifyStage: make sure that race records are internally consistent
class RaceCheckStage : public Stage class RaceCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::Race>& mRaces; const CSMWorld::IdCollection<ESM::Race>& mRaces;
bool mPlayable; bool mPlayable;

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that region records are internally consistent /// \brief VerifyStage: make sure that region records are internally consistent
class RegionCheckStage : public Stage class RegionCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::Region>& mRegions; const CSMWorld::IdCollection<ESM::Region>& mRegions;

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that skill records are internally consistent /// \brief VerifyStage: make sure that skill records are internally consistent
class SkillCheckStage : public Stage class SkillCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::Skill>& mSkills; const CSMWorld::IdCollection<ESM::Skill>& mSkills;

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that sound records are internally consistent /// \brief VerifyStage: make sure that sound records are internally consistent
class SoundCheckStage : public Stage class SoundCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::Sound>& mSounds; const CSMWorld::IdCollection<ESM::Sound>& mSounds;

View file

@ -5,12 +5,12 @@
#include "../world/idcollection.hpp" #include "../world/idcollection.hpp"
#include "stage.hpp" #include "../doc/stage.hpp"
namespace CSMTools namespace CSMTools
{ {
/// \brief VerifyStage: make sure that spell records are internally consistent /// \brief VerifyStage: make sure that spell records are internally consistent
class SpellCheckStage : public Stage class SpellCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::IdCollection<ESM::Spell>& mSpells; const CSMWorld::IdCollection<ESM::Spell>& mSpells;

View file

@ -1,4 +0,0 @@
#include "stage.hpp"
CSMTools::Stage::~Stage() {}

View file

@ -21,7 +21,7 @@
#include "birthsigncheck.hpp" #include "birthsigncheck.hpp"
#include "spellcheck.hpp" #include "spellcheck.hpp"
CSMTools::Operation *CSMTools::Tools::get (int type) CSMDoc::Operation *CSMTools::Tools::get (int type)
{ {
switch (type) switch (type)
{ {
@ -31,7 +31,7 @@ CSMTools::Operation *CSMTools::Tools::get (int type)
return 0; return 0;
} }
const CSMTools::Operation *CSMTools::Tools::get (int type) const const CSMDoc::Operation *CSMTools::Tools::get (int type) const
{ {
return const_cast<Tools *> (this)->get (type); return const_cast<Tools *> (this)->get (type);
} }
@ -103,7 +103,7 @@ CSMWorld::UniversalId CSMTools::Tools::runVerifier()
void CSMTools::Tools::abortOperation (int type) void CSMTools::Tools::abortOperation (int type)
{ {
if (Operation *operation = get (type)) if (CSMDoc::Operation *operation = get (type))
operation->abort(); operation->abort();
} }
@ -118,7 +118,7 @@ int CSMTools::Tools::getRunningOperations() const
int result = 0; int result = 0;
for (int i=0; sOperations[i]!=-1; ++i) for (int i=0; sOperations[i]!=-1; ++i)
if (const Operation *operation = get (sOperations[i])) if (const CSMDoc::Operation *operation = get (sOperations[i]))
if (operation->isRunning()) if (operation->isRunning())
result |= sOperations[i]; result |= sOperations[i];

View file

@ -11,10 +11,14 @@ namespace CSMWorld
class UniversalId; class UniversalId;
} }
namespace CSMDoc
{
class Operation;
}
namespace CSMTools namespace CSMTools
{ {
class Verifier; class Verifier;
class Operation;
class ReportModel; class ReportModel;
class Tools : public QObject class Tools : public QObject
@ -33,10 +37,10 @@ namespace CSMTools
Verifier *getVerifier(); Verifier *getVerifier();
Operation *get (int type); CSMDoc::Operation *get (int type);
///< Returns a 0-pointer, if operation hasn't been used yet. ///< Returns a 0-pointer, if operation hasn't been used yet.
const Operation *get (int type) const; const CSMDoc::Operation *get (int type) const;
///< Returns a 0-pointer, if operation hasn't been used yet. ///< Returns a 0-pointer, if operation hasn't been used yet.
public: public:

View file

@ -1,11 +1,11 @@
#ifndef CSM_TOOLS_VERIFIER_H #ifndef CSM_TOOLS_VERIFIER_H
#define CSM_TOOLS_VERIFIER_H #define CSM_TOOLS_VERIFIER_H
#include "operation.hpp" #include "../doc/operation.hpp"
namespace CSMTools namespace CSMTools
{ {
class Verifier : public Operation class Verifier : public CSMDoc::Operation
{ {
public: public: