From 77262adf3be14fda34435661a34a45ebf203ca23 Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Thu, 11 Feb 2021 19:45:22 +0100 Subject: [PATCH] Fix #1131 - Global (Grabber) setting are not correctly read by non-default instances (#1186) --- include/hyperion/SettingsManager.h | 2 +- libsrc/hyperion/SettingsManager.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/hyperion/SettingsManager.h b/include/hyperion/SettingsManager.h index 954c0eb5..027d0ece 100644 --- a/include/hyperion/SettingsManager.h +++ b/include/hyperion/SettingsManager.h @@ -42,7 +42,7 @@ public: /// @brief get the full settings object of this instance (with global settings) /// @return The requested json /// - const QJsonObject & getSettings() const { return _qconfig; } + QJsonObject getSettings() const; signals: /// diff --git a/libsrc/hyperion/SettingsManager.cpp b/libsrc/hyperion/SettingsManager.cpp index 8a5b4a2b..7922f777 100644 --- a/libsrc/hyperion/SettingsManager.cpp +++ b/libsrc/hyperion/SettingsManager.cpp @@ -114,6 +114,17 @@ QJsonDocument SettingsManager::getSetting(settings::type type) const 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) { // optional data upgrades e.g. imported legacy/older configs