refs #297 Added CSettingsCache singleton derived class of CValueCache

for core settings, with context signal and slot for relay.
This commit is contained in:
Mathew Sutcliffe
2015-06-28 17:00:04 +01:00
parent 31c081c14d
commit dace9e4da5
10 changed files with 174 additions and 1 deletions

View File

@@ -12,6 +12,7 @@
#include "blackcore/context_application_proxy.h"
#include "blackcore/context_settings.h"
#include "blackcore/input_manager.h"
#include "blackcore/settingscache.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/loghandler.h"
#include <QCoreApplication>
@@ -46,9 +47,26 @@ namespace BlackCore
this->logMessage(message, {});
});
connect(CSettingsCache::instance(), &CSettingsCache::valuesChangedByLocal, [this](const CVariantMap &settings)
{
this->changeSettings(settings, {});
});
connect(this, &IContextApplication::settingsChanged, [](const CVariantMap &settings, const CIdentifier &origin)
{
// Intentionally don't check for round trip here
CSettingsCache::instance()->changeValuesFromRemote(settings, origin);
});
changeSettings(IContextSettings::SettingsHotKeys);
}
void IContextApplication::changeSettings(const CVariantMap &settings, const CIdentifier &origin)
{
Q_UNUSED(settings);
Q_UNUSED(origin);
qFatal("Not implemented"); // avoid losing a change during context interface construction
}
void IContextApplication::changeSettings(uint typeValue)
{
auto type = static_cast<IContextSettings::SettingsType>(typeValue);