Fix #1131 - Global (Grabber) setting are not correctly read by non-default instances (#1186)

This commit is contained in:
LordGrey 2021-02-11 19:45:22 +01:00 committed by GitHub
parent ac88fdd80f
commit 77262adf3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -42,7 +42,7 @@ public:
/// @brief get the full settings object of this instance (with global settings) /// @brief get the full settings object of this instance (with global settings)
/// @return The requested json /// @return The requested json
/// ///
const QJsonObject & getSettings() const { return _qconfig; } QJsonObject getSettings() const;
signals: signals:
/// ///

View File

@ -114,6 +114,17 @@ QJsonDocument SettingsManager::getSetting(settings::type type) const
return _sTable->getSettingsRecord(settings::typeToString(type)); return _sTable->getSettingsRecord(settings::typeToString(type));
} }
QJsonObject SettingsManager::getSettings() const
{
QJsonObject config;
for(const auto & key : _qconfig.keys())
{
//Read all records from database to ensure that global settings are read across instances
config.insert(key, _sTable->getSettingsRecord(key).object());
}
return config;
}
bool SettingsManager::saveSettings(QJsonObject config, bool correct) bool SettingsManager::saveSettings(QJsonObject config, bool correct)
{ {
// optional data upgrades e.g. imported legacy/older configs // optional data upgrades e.g. imported legacy/older configs