mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #644 Move the enable of settings save to the same place as the initial settings load.
This commit is contained in:
@@ -150,7 +150,7 @@ namespace BlackCore
|
||||
|
||||
bool s = this->startHookIn();
|
||||
|
||||
// trigger loading of settings in appropriate scenarios
|
||||
// trigger loading and saving of settings in appropriate scenarios
|
||||
if (this->m_coreFacadeConfig.getModeApplication() != CCoreFacadeConfig::Remote)
|
||||
{
|
||||
CStatusMessage m = CSettingsCache::instance()->loadFromStore();
|
||||
@@ -159,6 +159,8 @@ namespace BlackCore
|
||||
m.setCategories(getLogCategories());
|
||||
CLogMessage::preformatted(m);
|
||||
}
|
||||
|
||||
CSettingsCache::instance()->enableLocalSave();
|
||||
}
|
||||
|
||||
if (waitForStart)
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace BlackCore
|
||||
CContextApplication::CContextApplication(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) :
|
||||
IContextApplication(mode, runtime)
|
||||
{
|
||||
connect(CSettingsCache::instance(), &CSettingsCache::valuesSaveRequested, CSettingsCache::instance(), &CSettingsCache::saveToStoreByPacket);
|
||||
}
|
||||
|
||||
CContextApplication *CContextApplication::registerWithDBus(BlackMisc::CDBusServer *server)
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace BlackMisc
|
||||
return saveToFiles(persistentStore(), keyPrefix);
|
||||
}
|
||||
|
||||
void CSettingsCache::enableLocalSave()
|
||||
{
|
||||
connect(CSettingsCache::instance(), &CSettingsCache::valuesSaveRequested, CSettingsCache::instance(), &CSettingsCache::saveToStoreByPacket);
|
||||
}
|
||||
|
||||
void CSettingsCache::saveToStoreByPacket(const CValueCachePacket &values)
|
||||
{
|
||||
CStatusMessage status = saveToFiles(persistentStore(), values.toVariantMap());
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace BlackMisc
|
||||
//! Save core settings to disk.
|
||||
BlackMisc::CStatusMessage saveToStore(const QString &keyPrefix = {});
|
||||
|
||||
//! Save individual settings to disk.
|
||||
//! Core application context connects this slot to the valuesSaveRequested signal.
|
||||
void saveToStoreByPacket(const CValueCachePacket &values);
|
||||
//! Connects signal CValueCache::valuesSaveRequested to a private slot that saves the values.
|
||||
//! In a dbus distributed scenario, only call this method in the core process.
|
||||
void enableLocalSave();
|
||||
|
||||
//! Load core settings from disk.
|
||||
BlackMisc::CStatusMessage loadFromStore();
|
||||
@@ -49,6 +49,7 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
CSettingsCache();
|
||||
void saveToStoreByPacket(const CValueCachePacket &values);
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user