refs #273, added settings for simulator

* added class
* adjusted settings context
* adjusted "global" methods as register metadata
* improved settings utility
* renamed "settingsallclasses" as settings can also be in other namespaces, settingsallclasses now in core
This commit is contained in:
Klaus Basan
2014-06-25 19:12:00 +02:00
parent abd2d6d86d
commit 42db1fe9ae
15 changed files with 360 additions and 34 deletions

View File

@@ -15,6 +15,7 @@ using namespace BlackMisc;
using namespace BlackMisc::Settings;
using namespace BlackMisc::Network;
using namespace BlackMisc::Hardware;
using namespace BlackSim::Settings;
namespace BlackCore
{
@@ -62,7 +63,7 @@ namespace BlackCore
if (jsonObject.contains(IContextSettings::PathAudioSettings()))
{
this->m_settingsAudio.fromJson(
jsonObject.value(IContextSettings::PathNetworkSettings()).toObject()
jsonObject.value(IContextSettings::PathAudioSettings()).toObject()
);
}
else
@@ -70,6 +71,18 @@ namespace BlackCore
this->m_settingsAudio.initDefaultValues();
}
// init simulator
if (jsonObject.contains(IContextSettings::PathSimulatorSettings()))
{
this->m_settingsSimulator.fromJson(
jsonObject.value(IContextSettings::PathSimulatorSettings()).toObject()
);
}
else
{
this->m_settingsSimulator.initDefaultValues();
}
// init own members
if (jsonObject.contains(IContextSettings::PathHotkeys()))
{
@@ -129,6 +142,7 @@ namespace BlackCore
this->m_hotkeys.initAsHotkeyList(true);
this->m_settingsNetwork.initDefaultValues();
this->m_settingsAudio.initDefaultValues();
this->m_settingsSimulator.initDefaultValues();
this->emitCompletelyChanged();
if (write)
return this->write();
@@ -152,6 +166,7 @@ namespace BlackCore
QJsonObject jsonObject;
jsonObject.insert(IContextSettings::PathNetworkSettings(), this->m_settingsNetwork.toJson());
jsonObject.insert(IContextSettings::PathAudioSettings(), this->m_settingsAudio.toJson());
jsonObject.insert(IContextSettings::PathSimulatorSettings(), this->m_settingsSimulator.toJson());
jsonObject.insert(IContextSettings::PathHotkeys(), this->m_hotkeys.toJson());
QJsonDocument doc(jsonObject);
return doc;
@@ -165,6 +180,7 @@ namespace BlackCore
emit this->changedSettings(IContextSettings::SettingsHotKeys);
emit this->changedSettings(IContextSettings::SettingsNetwork);
emit this->changedSettings(IContextSettings::SettingsAudio);
emit this->changedSettings(IContextSettings::SettingsSimulator);
}
/*
@@ -191,6 +207,14 @@ namespace BlackCore
return this->m_settingsAudio;
}
/*
* Simulator settings
*/
CSettingsSimulator CContextSettings::getSimulatorSettings() const
{
return this->m_settingsSimulator;
}
/*
* Pass value
*/