mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +08:00
refs #450 When GUI connects to core, it needs to have all current core settings inserted into its core settings cache.
This commit is contained in:
@@ -104,6 +104,12 @@ namespace BlackCore
|
|||||||
//! \note This is the function which relays cache changes via DBus.
|
//! \note This is the function which relays cache changes via DBus.
|
||||||
virtual void changeSettings(const BlackMisc::CVariantMap &settings, const BlackMisc::CIdentifier &origin);
|
virtual void changeSettings(const BlackMisc::CVariantMap &settings, const BlackMisc::CIdentifier &origin);
|
||||||
|
|
||||||
|
//! Get all settings currently in core settings cache
|
||||||
|
virtual BlackMisc::CVariantMap getAllSettings() const = 0;
|
||||||
|
|
||||||
|
//! Update local settings with settings from core
|
||||||
|
virtual void synchronizeLocalSettings() = 0;
|
||||||
|
|
||||||
//! Save core settings to disk
|
//! Save core settings to disk
|
||||||
virtual BlackMisc::CStatusMessage saveSettings(const QString &keyPrefix = {}) = 0;
|
virtual BlackMisc::CStatusMessage saveSettings(const QString &keyPrefix = {}) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,17 @@ namespace BlackCore
|
|||||||
emit this->settingsChanged(settings, origin);
|
emit this->settingsChanged(settings, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlackMisc::CVariantMap CContextApplication::getAllSettings() const
|
||||||
|
{
|
||||||
|
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
|
return CSettingsCache::instance()->getAllValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CContextApplication::synchronizeLocalSettings()
|
||||||
|
{
|
||||||
|
// no-op: proxy implements this method by calling getAllSettings
|
||||||
|
}
|
||||||
|
|
||||||
BlackMisc::CStatusMessage CContextApplication::saveSettings(const QString &keyPrefix)
|
BlackMisc::CStatusMessage CContextApplication::saveSettings(const QString &keyPrefix)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << keyPrefix; }
|
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << keyPrefix; }
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextApplication::changeSettings
|
//! \copydoc IContextApplication::changeSettings
|
||||||
virtual void changeSettings(const BlackMisc::CVariantMap &settings, const BlackMisc::CIdentifier &origin) override;
|
virtual void changeSettings(const BlackMisc::CVariantMap &settings, const BlackMisc::CIdentifier &origin) override;
|
||||||
|
|
||||||
|
//! \copydoc IContextApplication::getAllSettings
|
||||||
|
virtual BlackMisc::CVariantMap getAllSettings() const override;
|
||||||
|
|
||||||
|
//! \copydoc IContextApplication::synchronizeLocalSettings
|
||||||
|
virtual void synchronizeLocalSettings() override;
|
||||||
|
|
||||||
//! \copydoc IContextApplication::saveSettings
|
//! \copydoc IContextApplication::saveSettings
|
||||||
virtual BlackMisc::CStatusMessage saveSettings(const QString &keyPrefix = {}) override;
|
virtual BlackMisc::CStatusMessage saveSettings(const QString &keyPrefix = {}) override;
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,17 @@ namespace BlackCore
|
|||||||
this->m_dBusInterface->callDBus(QLatin1Literal("changeSettings"), settings, origin);
|
this->m_dBusInterface->callDBus(QLatin1Literal("changeSettings"), settings, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlackMisc::CVariantMap CContextApplicationProxy::getAllSettings() const
|
||||||
|
{
|
||||||
|
return this->m_dBusInterface->callDBusRet<BlackMisc::CVariantMap>(QLatin1Literal("getAllSettings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CContextApplicationProxy::synchronizeLocalSettings()
|
||||||
|
{
|
||||||
|
// note this proxy method does not call synchronizeLocalSettings in core
|
||||||
|
CSettingsCache::instance()->insertValues(this->getAllSettings());
|
||||||
|
}
|
||||||
|
|
||||||
BlackMisc::CStatusMessage CContextApplicationProxy::saveSettings(const QString &keyPrefix)
|
BlackMisc::CStatusMessage CContextApplicationProxy::saveSettings(const QString &keyPrefix)
|
||||||
{
|
{
|
||||||
return this->m_dBusInterface->callDBusRet<BlackMisc::CStatusMessage>(QLatin1Literal("saveSettings"), keyPrefix);
|
return this->m_dBusInterface->callDBusRet<BlackMisc::CStatusMessage>(QLatin1Literal("saveSettings"), keyPrefix);
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextApplication::changeSettings
|
//! \copydoc IContextApplication::changeSettings
|
||||||
virtual void changeSettings(const BlackMisc::CVariantMap &settings, const BlackMisc::CIdentifier &origin) override;
|
virtual void changeSettings(const BlackMisc::CVariantMap &settings, const BlackMisc::CIdentifier &origin) override;
|
||||||
|
|
||||||
|
//! \copydoc IContextApplication::getAllSettings
|
||||||
|
virtual BlackMisc::CVariantMap getAllSettings() const override;
|
||||||
|
|
||||||
|
//! \copydoc IContextApplication::synchronizeLocalSettings
|
||||||
|
virtual void synchronizeLocalSettings() override;
|
||||||
|
|
||||||
//! \copydoc IContextApplication::saveSettings
|
//! \copydoc IContextApplication::saveSettings
|
||||||
virtual BlackMisc::CStatusMessage saveSettings(const QString &keyPrefix = {}) override;
|
virtual BlackMisc::CStatusMessage saveSettings(const QString &keyPrefix = {}) override;
|
||||||
|
|
||||||
|
|||||||
@@ -211,6 +211,8 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
|
|
||||||
void SwiftGuiStd::initialDataReads()
|
void SwiftGuiStd::initialDataReads()
|
||||||
{
|
{
|
||||||
|
this->getIContextApplication()->synchronizeLocalSettings();
|
||||||
|
|
||||||
this->setContextAvailability();
|
this->setContextAvailability();
|
||||||
if (!this->m_coreAvailable)
|
if (!this->m_coreAvailable)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user