mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 01:45:36 +00:00
final batch of changing over user settings usage to the new system
This commit is contained in:
parent
44925e9fc8
commit
67cf260144
9 changed files with 16 additions and 65 deletions
|
@ -23,9 +23,6 @@ void CSMDoc::Operation::prepareStages()
|
||||||
{
|
{
|
||||||
iter->second = iter->first->setup();
|
iter->second = iter->first->setup();
|
||||||
mTotalSteps += iter->second;
|
mTotalSteps += iter->second;
|
||||||
|
|
||||||
for (std::map<QString, QStringList>::const_iterator iter2 (mSettings.begin()); iter2!=mSettings.end(); ++iter2)
|
|
||||||
iter->first->updateUserSetting (iter2->first, iter2->second);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +44,7 @@ CSMDoc::Operation::~Operation()
|
||||||
void CSMDoc::Operation::run()
|
void CSMDoc::Operation::run()
|
||||||
{
|
{
|
||||||
mTimer->stop();
|
mTimer->stop();
|
||||||
|
|
||||||
if (!mConnected)
|
if (!mConnected)
|
||||||
{
|
{
|
||||||
connect (mTimer, SIGNAL (timeout()), this, SLOT (executeStage()));
|
connect (mTimer, SIGNAL (timeout()), this, SLOT (executeStage()));
|
||||||
|
@ -64,14 +61,6 @@ void CSMDoc::Operation::appendStage (Stage *stage)
|
||||||
mStages.push_back (std::make_pair (stage, 0));
|
mStages.push_back (std::make_pair (stage, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Operation::configureSettings (const std::vector<QString>& settings)
|
|
||||||
{
|
|
||||||
for (std::vector<QString>::const_iterator iter (settings.begin()); iter!=settings.end(); ++iter)
|
|
||||||
{
|
|
||||||
mSettings.insert (std::make_pair (*iter, CSMSettings::UserSettings::instance().definitions (*iter)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSMDoc::Operation::setDefaultSeverity (Message::Severity severity)
|
void CSMDoc::Operation::setDefaultSeverity (Message::Severity severity)
|
||||||
{
|
{
|
||||||
mDefaultSeverity = severity;
|
mDefaultSeverity = severity;
|
||||||
|
@ -101,14 +90,6 @@ void CSMDoc::Operation::abort()
|
||||||
mCurrentStage = mStages.end();
|
mCurrentStage = mStages.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Operation::updateUserSetting (const QString& name, const QStringList& value)
|
|
||||||
{
|
|
||||||
std::map<QString, QStringList>::iterator iter = mSettings.find (name);
|
|
||||||
|
|
||||||
if (iter!=mSettings.end())
|
|
||||||
iter->second = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSMDoc::Operation::executeStage()
|
void CSMDoc::Operation::executeStage()
|
||||||
{
|
{
|
||||||
if (!mPrepared)
|
if (!mPrepared)
|
||||||
|
@ -116,7 +97,7 @@ void CSMDoc::Operation::executeStage()
|
||||||
prepareStages();
|
prepareStages();
|
||||||
mPrepared = true;
|
mPrepared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages messages (mDefaultSeverity);
|
Messages messages (mDefaultSeverity);
|
||||||
|
|
||||||
while (mCurrentStage!=mStages.end())
|
while (mCurrentStage!=mStages.end())
|
||||||
|
|
|
@ -34,7 +34,6 @@ namespace CSMDoc
|
||||||
bool mError;
|
bool mError;
|
||||||
bool mConnected;
|
bool mConnected;
|
||||||
QTimer *mTimer;
|
QTimer *mTimer;
|
||||||
std::map<QString, QStringList> mSettings;
|
|
||||||
bool mPrepared;
|
bool mPrepared;
|
||||||
Message::Severity mDefaultSeverity;
|
Message::Severity mDefaultSeverity;
|
||||||
|
|
||||||
|
@ -53,11 +52,6 @@ namespace CSMDoc
|
||||||
///
|
///
|
||||||
/// \attention Do no call this function while this Operation is running.
|
/// \attention Do no call this function while this Operation is running.
|
||||||
|
|
||||||
/// Specify settings to be passed on to stages.
|
|
||||||
///
|
|
||||||
/// \attention Do no call this function while this Operation is running.
|
|
||||||
void configureSettings (const std::vector<QString>& settings);
|
|
||||||
|
|
||||||
/// \attention Do no call this function while this Operation is running.
|
/// \attention Do no call this function while this Operation is running.
|
||||||
void setDefaultSeverity (Message::Severity severity);
|
void setDefaultSeverity (Message::Severity severity);
|
||||||
|
|
||||||
|
@ -77,8 +71,6 @@ namespace CSMDoc
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
void updateUserSetting (const QString& name, const QStringList& value);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void executeStage();
|
void executeStage();
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "operationholder.hpp"
|
#include "operationholder.hpp"
|
||||||
|
|
||||||
#include "../settings/usersettings.hpp"
|
|
||||||
|
|
||||||
#include "operation.hpp"
|
#include "operation.hpp"
|
||||||
|
|
||||||
CSMDoc::OperationHolder::OperationHolder (Operation *operation) : mRunning (false)
|
CSMDoc::OperationHolder::OperationHolder (Operation *operation) : mRunning (false)
|
||||||
|
@ -30,9 +28,6 @@ void CSMDoc::OperationHolder::setOperation (Operation *operation)
|
||||||
connect (this, SIGNAL (abortSignal()), mOperation, SLOT (abort()));
|
connect (this, SIGNAL (abortSignal()), mOperation, SLOT (abort()));
|
||||||
|
|
||||||
connect (&mThread, SIGNAL (started()), mOperation, SLOT (run()));
|
connect (&mThread, SIGNAL (started()), mOperation, SLOT (run()));
|
||||||
|
|
||||||
connect (&CSMSettings::UserSettings::instance(), SIGNAL (userSettingUpdated (const QString&, const QStringList&)),
|
|
||||||
mOperation, SLOT (updateUserSetting (const QString&, const QStringList&)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSMDoc::OperationHolder::isRunning() const
|
bool CSMDoc::OperationHolder::isRunning() const
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#include "stage.hpp"
|
#include "stage.hpp"
|
||||||
|
|
||||||
CSMDoc::Stage::~Stage() {}
|
CSMDoc::Stage::~Stage() {}
|
||||||
|
|
||||||
void CSMDoc::Stage::updateUserSetting (const QString& name, const QStringList& value) {}
|
|
||||||
|
|
|
@ -23,11 +23,7 @@ namespace CSMDoc
|
||||||
|
|
||||||
virtual void perform (int stage, Messages& messages) = 0;
|
virtual void perform (int stage, Messages& messages) = 0;
|
||||||
///< Messages resulting from this stage will be appended to \a messages.
|
///< Messages resulting from this stage will be appended to \a messages.
|
||||||
|
|
||||||
/// Default-implementation: ignore
|
|
||||||
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include "../world/data.hpp"
|
#include "../world/data.hpp"
|
||||||
|
|
||||||
|
#include "../prefs/state.hpp"
|
||||||
|
|
||||||
CSMDoc::Message::Severity CSMTools::ScriptCheckStage::getSeverity (Type type)
|
CSMDoc::Message::Severity CSMTools::ScriptCheckStage::getSeverity (Type type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -46,7 +48,7 @@ void CSMTools::ScriptCheckStage::report (const std::string& message, Type type)
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << "script " << mFile << ": " << message;
|
stream << "script " << mFile << ": " << message;
|
||||||
|
|
||||||
mMessages->add (id, stream.str(), "", getSeverity (type));
|
mMessages->add (id, stream.str(), "", getSeverity (type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +64,15 @@ CSMTools::ScriptCheckStage::ScriptCheckStage (const CSMDoc::Document& document)
|
||||||
|
|
||||||
int CSMTools::ScriptCheckStage::setup()
|
int CSMTools::ScriptCheckStage::setup()
|
||||||
{
|
{
|
||||||
|
std::string warnings = CSMPrefs::get()["Scripts"]["warnings"].toString();
|
||||||
|
|
||||||
|
if (warnings=="Ignore")
|
||||||
|
mWarningMode = Mode_Ignore;
|
||||||
|
else if (warnings=="Normal")
|
||||||
|
mWarningMode = Mode_Normal;
|
||||||
|
else if (warnings=="Strict")
|
||||||
|
mWarningMode = Mode_Strict;
|
||||||
|
|
||||||
mContext.clear();
|
mContext.clear();
|
||||||
mMessages = 0;
|
mMessages = 0;
|
||||||
mId.clear();
|
mId.clear();
|
||||||
|
@ -110,22 +121,9 @@ void CSMTools::ScriptCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << "script " << mFile << ": " << error.what();
|
stream << "script " << mFile << ": " << error.what();
|
||||||
|
|
||||||
messages.add (id, stream.str(), "", CSMDoc::Message::Severity_SeriousError);
|
messages.add (id, stream.str(), "", CSMDoc::Message::Severity_SeriousError);
|
||||||
}
|
}
|
||||||
|
|
||||||
mMessages = 0;
|
mMessages = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ScriptCheckStage::updateUserSetting (const QString& name, const QStringList& value)
|
|
||||||
{
|
|
||||||
if (name=="script-editor/warnings" && !value.isEmpty())
|
|
||||||
{
|
|
||||||
if (value.at (0)=="Ignore")
|
|
||||||
mWarningMode = Mode_Ignore;
|
|
||||||
else if (value.at (0)=="Normal")
|
|
||||||
mWarningMode = Mode_Normal;
|
|
||||||
else if (value.at (0)=="Strict")
|
|
||||||
mWarningMode = Mode_Strict;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace CSMTools
|
||||||
WarningMode mWarningMode;
|
WarningMode mWarningMode;
|
||||||
|
|
||||||
CSMDoc::Message::Severity getSeverity (Type type);
|
CSMDoc::Message::Severity getSeverity (Type type);
|
||||||
|
|
||||||
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
|
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
|
||||||
///< Report error to the user.
|
///< Report error to the user.
|
||||||
|
|
||||||
|
@ -50,8 +50,6 @@ namespace CSMTools
|
||||||
|
|
||||||
virtual void perform (int stage, CSMDoc::Messages& messages);
|
virtual void perform (int stage, CSMDoc::Messages& messages);
|
||||||
///< Messages resulting from this tage will be appended to \a messages.
|
///< Messages resulting from this tage will be appended to \a messages.
|
||||||
|
|
||||||
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,6 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()
|
||||||
{
|
{
|
||||||
mVerifierOperation = new CSMDoc::Operation (CSMDoc::State_Verifying, false);
|
mVerifierOperation = new CSMDoc::Operation (CSMDoc::State_Verifying, false);
|
||||||
|
|
||||||
std::vector<QString> settings;
|
|
||||||
settings.push_back ("script-editor/warnings");
|
|
||||||
|
|
||||||
mVerifierOperation->configureSettings (settings);
|
|
||||||
|
|
||||||
connect (&mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int)));
|
connect (&mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int)));
|
||||||
connect (&mVerifier, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool)));
|
connect (&mVerifier, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool)));
|
||||||
connect (&mVerifier, SIGNAL (reportMessage (const CSMDoc::Message&, int)),
|
connect (&mVerifier, SIGNAL (reportMessage (const CSMDoc::Message&, int)),
|
||||||
|
|
|
@ -88,8 +88,6 @@ namespace CSVDoc
|
||||||
|
|
||||||
void exitApplication();
|
void exitApplication();
|
||||||
|
|
||||||
void loadUserSettings();
|
|
||||||
|
|
||||||
/// User preference function
|
/// User preference function
|
||||||
void resizeViewWidth (int width);
|
void resizeViewWidth (int width);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue