#include "mergeoperation.hpp" #include "../doc/document.hpp" #include "../doc/state.hpp" #include "mergestages.hpp" CSMTools::MergeOperation::MergeOperation(CSMDoc::Document& document, ToUTF8::FromType encoding) : CSMDoc::Operation(CSMDoc::State_Merging, true) , mState(document) { appendStage(new StartMergeStage(mState)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getGlobals)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getGmsts)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getSkills)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getClasses)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getFactions)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getRaces)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getSounds)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getScripts)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getRegions)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getBirthsigns)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getSpells)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getTopics)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getJournals)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getCells)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getFilters)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getEnchantments)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getBodyParts)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getDebugProfiles)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getSoundGens)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getMagicEffects)); appendStage(new MergeIdCollectionStage(mState, &CSMWorld::Data::getStartScripts)); appendStage(new MergeIdCollectionStage>( mState, &CSMWorld::Data::getPathgrids)); appendStage( new MergeIdCollectionStage(mState, &CSMWorld::Data::getTopicInfos)); appendStage( new MergeIdCollectionStage(mState, &CSMWorld::Data::getJournalInfos)); appendStage(new MergeRefIdsStage(mState)); appendStage(new MergeReferencesStage(mState)); appendStage(new MergeReferencesStage(mState)); appendStage(new PopulateLandTexturesMergeStage(mState)); appendStage(new MergeLandStage(mState)); appendStage(new FixLandsAndLandTexturesMergeStage(mState)); appendStage(new CleanupLandTexturesMergeStage(mState)); appendStage(new FinishMergedDocumentStage(mState, encoding)); } void CSMTools::MergeOperation::setTarget(std::unique_ptr document) { mState.mTarget = std::move(document); } void CSMTools::MergeOperation::operationDone() { CSMDoc::Operation::operationDone(); if (mState.mCompleted) emit mergeDone(mState.mTarget.release()); }