2015-05-29 09:28:25 +00:00
|
|
|
#include "signalhandler.hpp"
|
|
|
|
|
2015-05-30 08:58:33 +00:00
|
|
|
#include <QMetaObject>
|
2015-05-30 09:17:42 +00:00
|
|
|
#include <QThread>
|
2015-05-30 08:58:33 +00:00
|
|
|
|
2015-05-29 09:28:25 +00:00
|
|
|
#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 &)));
|
|
|
|
}
|
|
|
|
|
2015-05-30 08:58:33 +00:00
|
|
|
// called from the main thread
|
2015-05-29 09:28:25 +00:00
|
|
|
void CSMTools::SignalHandler::updateUserSetting (const QString &name, const QStringList &list)
|
|
|
|
{
|
2015-05-30 08:58:33 +00:00
|
|
|
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)
|
|
|
|
{
|
2015-05-30 09:17:42 +00:00
|
|
|
if (thread()!=QThread::currentThread())
|
|
|
|
{
|
|
|
|
QMetaObject::invokeMethod(this,"updateExtraCheck", Qt::QueuedConnection, Q_ARG(bool, extraCheck));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// extra safety
|
2015-05-30 08:58:33 +00:00
|
|
|
mExtraCheck = extraCheck;
|
2015-05-29 09:28:25 +00:00
|
|
|
}
|
|
|
|
|
2015-05-30 08:58:33 +00:00
|
|
|
// called from the operations thread
|
2015-05-29 09:28:25 +00:00
|
|
|
bool CSMTools::SignalHandler::extraCheck ()
|
|
|
|
{
|
|
|
|
return mExtraCheck;
|
|
|
|
}
|