From 734e52d1c82e2f2a250c3a11fbaecd53592ee27f Mon Sep 17 00:00:00 2001 From: cc9cii Date: Fri, 29 May 2015 06:40:40 +1000 Subject: [PATCH] Move the user preference check to the preparation step before the running of the operation. --- apps/opencs/model/tools/pathgridcheck.cpp | 13 +++++-------- apps/opencs/model/tools/pathgridcheck.hpp | 15 ++++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apps/opencs/model/tools/pathgridcheck.cpp b/apps/opencs/model/tools/pathgridcheck.cpp index c436cfe04..58fdbeb2d 100644 --- a/apps/opencs/model/tools/pathgridcheck.cpp +++ b/apps/opencs/model/tools/pathgridcheck.cpp @@ -16,17 +16,14 @@ CSMTools::PathgridCheckStage::PathgridCheckStage (const CSMWorld::SubCellCollect int CSMTools::PathgridCheckStage::setup() { + CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance(); + mExtraCheck = userSettings.setting ("verifier/pathgrid-extra-check", QString ("false"))=="true"; + return mPathgrids.getSize(); } void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& messages) { - // NOTE: This is horribly inefficient but in order to use signals the entire Stage class - // hierarchy needs to be braught under Qt which seems like an overkill for a small - // performance gain during verify operations - CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance(); - bool extraCheck = userSettings.setting ("verifier/pathgrid-extra-check", QString ("false"))=="true"; - const CSMWorld::Record& record = mPathgrids.getRecord (stage); if (record.isDeleted()) @@ -113,7 +110,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message } } - if (!extraCheck) + if (!mExtraCheck) continue; // check duplicate points @@ -144,7 +141,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message } } - if (!extraCheck) + if (!mExtraCheck) return; // check pathgrid points that are not connected to anything diff --git a/apps/opencs/model/tools/pathgridcheck.hpp b/apps/opencs/model/tools/pathgridcheck.hpp index 603235552..86ace6af2 100644 --- a/apps/opencs/model/tools/pathgridcheck.hpp +++ b/apps/opencs/model/tools/pathgridcheck.hpp @@ -24,17 +24,18 @@ namespace CSMTools class PathgridCheckStage : public CSMDoc::Stage { - const CSMWorld::SubCellCollection >& mPathgrids; + bool mExtraCheck; + const CSMWorld::SubCellCollection >& mPathgrids; - public: + public: - PathgridCheckStage (const CSMWorld::SubCellCollection >& pathgrids); + PathgridCheckStage (const CSMWorld::SubCellCollection >& pathgrids); - virtual int setup(); + virtual int setup(); - virtual void perform (int stage, CSMDoc::Messages& messages); + virtual void perform (int stage, CSMDoc::Messages& messages); }; }