Revert user preference setting checks until a thread safe method is worked out. The OSX namespace issue is retained.

c++11
cc9cii 10 years ago
parent 01eba7b721
commit c4aa3d3ee3

@ -34,7 +34,7 @@ opencs_hdrs_noqt (model/world
opencs_units (model/tools
tools reportmodel signalhandler
tools reportmodel
)
opencs_units_noqt (model/tools

@ -264,13 +264,6 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
monoFont->setToolTip ("Whether to use monospaced fonts on script edit subview.");
}
declareSection ("verifier", "Verifier");
{
Setting *extraPathgrid = createSetting (Type_CheckBox, "pathgrid-extra-check", "Pathgrid: Extra Check");
extraPathgrid->setDefaultValue ("false");
extraPathgrid->setToolTip ("Additional checks for orphaned or duplicated pathgrid points");
}
{
/******************************************************************
* There are three types of values:

@ -8,24 +8,12 @@
#include "../world/subcellcollection.hpp"
#include "../world/pathgrid.hpp"
#include "../settings/usersettings.hpp"
#include "signalhandler.hpp"
CSMTools::PathgridCheckStage::PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids,
CSMTools::SignalHandler *signalHandler)
: mPathgrids (pathgrids), mSigHandler(signalHandler)
CSMTools::PathgridCheckStage::PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids)
: mPathgrids (pathgrids)
{}
CSMTools::PathgridCheckStage::~PathgridCheckStage ()
{
delete mSigHandler;
}
int CSMTools::PathgridCheckStage::setup()
{
mExtraCheck = mSigHandler->extraCheck();
return mPathgrids.getSize();
}
@ -117,9 +105,6 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
}
}
if (!mExtraCheck)
continue;
// check duplicate points
// FIXME: how to do this efficiently?
for (unsigned int j = 0; j < pathgrid.mPoints.size(); ++j)
@ -148,9 +133,6 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
}
}
if (!mExtraCheck)
return;
// check pathgrid points that are not connected to anything
for (unsigned int i = 0; i < pointList.size(); ++i)
{

@ -14,8 +14,6 @@ namespace CSMWorld
namespace CSMTools
{
class SignalHandler;
struct Point
{
unsigned char mConnectionNum;
@ -25,18 +23,13 @@ namespace CSMTools
class PathgridCheckStage : public CSMDoc::Stage
{
bool mExtraCheck;
CSMTools::SignalHandler *mSigHandler;
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& mPathgrids;
public:
PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& pathgrids, CSMTools::SignalHandler *signallHandler);
~PathgridCheckStage ();
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& pathgrids);
virtual int setup();

@ -1,41 +0,0 @@
#include "signalhandler.hpp"
#include <QMetaObject>
#include <QThread>
#include "../settings/usersettings.hpp"
CSMTools::SignalHandler::SignalHandler(bool extraCheck)
: mExtraCheck(extraCheck)
{
connect (&CSMSettings::UserSettings::instance(),
SIGNAL (userSettingUpdated(const QString &, const QStringList &)),
this,
SLOT (updateUserSetting (const QString &, const QStringList &)));
}
// called from the main thread
void CSMTools::SignalHandler::updateUserSetting (const QString &name, const QStringList &list)
{
if (name=="verifier/pathgrid-extra-check" && !list.empty())
QMetaObject::invokeMethod(this, "updateExtraCheck", Qt::AutoConnection, Q_ARG(bool, list.at(0) == "true"));
}
// should be in the operations thread via an event message queue
void CSMTools::SignalHandler::updateExtraCheck (bool extraCheck)
{
if (thread()!=QThread::currentThread())
{
QMetaObject::invokeMethod(this,"updateExtraCheck", Qt::QueuedConnection, Q_ARG(bool, extraCheck));
return;
}
// extra safety
mExtraCheck = extraCheck;
}
// called from the operations thread
bool CSMTools::SignalHandler::extraCheck ()
{
return mExtraCheck;
}

@ -1,30 +0,0 @@
#ifndef CSM_TOOLS_SIGNALHANDLER_H
#define CSM_TOOLS_SIGNALHANDLER_H
#include <QObject>
namespace CSMTools
{
class SignalHandler : public QObject
{
Q_OBJECT
bool mExtraCheck;
public:
SignalHandler (bool extraCheck);
bool extraCheck ();
public slots:
void updateUserSetting (const QString &name, const QStringList &list);
private slots:
void updateExtraCheck (bool extraCheck);
};
}
#endif

@ -10,8 +10,6 @@
#include "../world/data.hpp"
#include "../world/universalid.hpp"
#include "../settings/usersettings.hpp"
#include "reportmodel.hpp"
#include "mandatoryid.hpp"
#include "skillcheck.hpp"
@ -29,7 +27,6 @@
#include "startscriptcheck.hpp"
#include "searchoperation.hpp"
#include "pathgridcheck.hpp"
#include "signalhandler.hpp"
CSMDoc::OperationHolder *CSMTools::Tools::get (int type)
{
@ -59,8 +56,6 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()
SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)),
this, SLOT (verifierMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)));
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
std::vector<std::string> mandatoryIds; // I want C++11, damn it!
mandatoryIds.push_back ("Day");
mandatoryIds.push_back ("DaysPassed");
@ -102,8 +97,7 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()
CSMWorld::UniversalId( CSMWorld::UniversalId::Type_Meshes )),
mData.getRaces() ));
mVerifierOperation->appendStage (new PathgridCheckStage (mData.getPathgrids(),
new SignalHandler(userSettings.setting ("verifier/pathgrid-extra-check", QString ("false"))=="true")));
mVerifierOperation->appendStage (new PathgridCheckStage (mData.getPathgrids()));
mVerifier.setOperation (mVerifierOperation);
}
@ -219,3 +213,4 @@ void CSMTools::Tools::verifierMessage (const CSMWorld::UniversalId& id, const st
if (iter!=mActiveReports.end())
mReports[iter->second]->add (id, message, hint);
}

@ -64,7 +64,7 @@ namespace CSMTools
CSMWorld::UniversalId newSearch();
void runSearch (const CSMWorld::UniversalId& searchId, const Search& search);
void abortOperation (int type);
///< \attention The operation is not aborted immediately.

Loading…
Cancel
Save