mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Revert user preference setting checks until a thread safe method is worked out. The OSX namespace issue is retained.
This commit is contained in:
parent
01eba7b721
commit
c4aa3d3ee3
8 changed files with 7 additions and 115 deletions
|
@ -34,7 +34,7 @@ opencs_hdrs_noqt (model/world
|
||||||
|
|
||||||
|
|
||||||
opencs_units (model/tools
|
opencs_units (model/tools
|
||||||
tools reportmodel signalhandler
|
tools reportmodel
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_units_noqt (model/tools
|
opencs_units_noqt (model/tools
|
||||||
|
|
|
@ -264,13 +264,6 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
||||||
monoFont->setToolTip ("Whether to use monospaced fonts on script edit subview.");
|
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:
|
* There are three types of values:
|
||||||
|
|
|
@ -8,24 +8,12 @@
|
||||||
#include "../world/subcellcollection.hpp"
|
#include "../world/subcellcollection.hpp"
|
||||||
#include "../world/pathgrid.hpp"
|
#include "../world/pathgrid.hpp"
|
||||||
|
|
||||||
#include "../settings/usersettings.hpp"
|
CSMTools::PathgridCheckStage::PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids)
|
||||||
|
: mPathgrids (pathgrids)
|
||||||
#include "signalhandler.hpp"
|
|
||||||
|
|
||||||
CSMTools::PathgridCheckStage::PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids,
|
|
||||||
CSMTools::SignalHandler *signalHandler)
|
|
||||||
: mPathgrids (pathgrids), mSigHandler(signalHandler)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CSMTools::PathgridCheckStage::~PathgridCheckStage ()
|
|
||||||
{
|
|
||||||
delete mSigHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CSMTools::PathgridCheckStage::setup()
|
int CSMTools::PathgridCheckStage::setup()
|
||||||
{
|
{
|
||||||
mExtraCheck = mSigHandler->extraCheck();
|
|
||||||
|
|
||||||
return mPathgrids.getSize();
|
return mPathgrids.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,9 +105,6 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mExtraCheck)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// check duplicate points
|
// check duplicate points
|
||||||
// FIXME: how to do this efficiently?
|
// FIXME: how to do this efficiently?
|
||||||
for (unsigned int j = 0; j < pathgrid.mPoints.size(); ++j)
|
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
|
// check pathgrid points that are not connected to anything
|
||||||
for (unsigned int i = 0; i < pointList.size(); ++i)
|
for (unsigned int i = 0; i < pointList.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,8 +14,6 @@ namespace CSMWorld
|
||||||
|
|
||||||
namespace CSMTools
|
namespace CSMTools
|
||||||
{
|
{
|
||||||
class SignalHandler;
|
|
||||||
|
|
||||||
struct Point
|
struct Point
|
||||||
{
|
{
|
||||||
unsigned char mConnectionNum;
|
unsigned char mConnectionNum;
|
||||||
|
@ -25,18 +23,13 @@ namespace CSMTools
|
||||||
|
|
||||||
class PathgridCheckStage : public CSMDoc::Stage
|
class PathgridCheckStage : public CSMDoc::Stage
|
||||||
{
|
{
|
||||||
bool mExtraCheck;
|
|
||||||
CSMTools::SignalHandler *mSigHandler;
|
|
||||||
|
|
||||||
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
|
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
|
||||||
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& mPathgrids;
|
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& mPathgrids;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
|
PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
|
||||||
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& pathgrids, CSMTools::SignalHandler *signallHandler);
|
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& pathgrids);
|
||||||
|
|
||||||
~PathgridCheckStage ();
|
|
||||||
|
|
||||||
virtual int setup();
|
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/data.hpp"
|
||||||
#include "../world/universalid.hpp"
|
#include "../world/universalid.hpp"
|
||||||
|
|
||||||
#include "../settings/usersettings.hpp"
|
|
||||||
|
|
||||||
#include "reportmodel.hpp"
|
#include "reportmodel.hpp"
|
||||||
#include "mandatoryid.hpp"
|
#include "mandatoryid.hpp"
|
||||||
#include "skillcheck.hpp"
|
#include "skillcheck.hpp"
|
||||||
|
@ -29,7 +27,6 @@
|
||||||
#include "startscriptcheck.hpp"
|
#include "startscriptcheck.hpp"
|
||||||
#include "searchoperation.hpp"
|
#include "searchoperation.hpp"
|
||||||
#include "pathgridcheck.hpp"
|
#include "pathgridcheck.hpp"
|
||||||
#include "signalhandler.hpp"
|
|
||||||
|
|
||||||
CSMDoc::OperationHolder *CSMTools::Tools::get (int type)
|
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)),
|
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)));
|
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!
|
std::vector<std::string> mandatoryIds; // I want C++11, damn it!
|
||||||
mandatoryIds.push_back ("Day");
|
mandatoryIds.push_back ("Day");
|
||||||
mandatoryIds.push_back ("DaysPassed");
|
mandatoryIds.push_back ("DaysPassed");
|
||||||
|
@ -102,8 +97,7 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()
|
||||||
CSMWorld::UniversalId( CSMWorld::UniversalId::Type_Meshes )),
|
CSMWorld::UniversalId( CSMWorld::UniversalId::Type_Meshes )),
|
||||||
mData.getRaces() ));
|
mData.getRaces() ));
|
||||||
|
|
||||||
mVerifierOperation->appendStage (new PathgridCheckStage (mData.getPathgrids(),
|
mVerifierOperation->appendStage (new PathgridCheckStage (mData.getPathgrids()));
|
||||||
new SignalHandler(userSettings.setting ("verifier/pathgrid-extra-check", QString ("false"))=="true")));
|
|
||||||
|
|
||||||
mVerifier.setOperation (mVerifierOperation);
|
mVerifier.setOperation (mVerifierOperation);
|
||||||
}
|
}
|
||||||
|
@ -219,3 +213,4 @@ void CSMTools::Tools::verifierMessage (const CSMWorld::UniversalId& id, const st
|
||||||
if (iter!=mActiveReports.end())
|
if (iter!=mActiveReports.end())
|
||||||
mReports[iter->second]->add (id, message, hint);
|
mReports[iter->second]->add (id, message, hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace CSMTools
|
||||||
CSMWorld::UniversalId newSearch();
|
CSMWorld::UniversalId newSearch();
|
||||||
|
|
||||||
void runSearch (const CSMWorld::UniversalId& searchId, const Search& search);
|
void runSearch (const CSMWorld::UniversalId& searchId, const Search& search);
|
||||||
|
|
||||||
void abortOperation (int type);
|
void abortOperation (int type);
|
||||||
///< \attention The operation is not aborted immediately.
|
///< \attention The operation is not aborted immediately.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue