Refactor Settings DB and Handling (#1786)

* Refactor config API

* Corrections

* Test Qt 6.8

* Revert "Test Qt 6.8"

This reverts commit eceebec49e.

* Corrections 2

* Update Changelog

* Add configFilter element for getconfig call

* Do not create errors for DB updates when in read-only mode

* Have configuration migration and validation before Hyperion starts

* Correct Tests

* Corrections

* Add migration items

* Correct windows build

* Ensure that first instance as default one exists

* Remove dependency between AuthManager and SSDPHandler

* Correct typos

* Address CodeQL findings

* Replace CamkeSettings by Presets and provide debug scenarios
This commit is contained in:
LordGrey
2024-09-30 22:03:13 +02:00
committed by GitHub
parent aed4abc03b
commit ecceb4e7ae
88 changed files with 4407 additions and 2472 deletions

View File

@@ -44,7 +44,7 @@ public:
/// @return The first boolean is true when the arguments is valid according to the schema. The second is true when the schema contains no errors
/// @return TODO: Check the Schema in SetSchema() function and remove the QPair result
///
QPair<bool, bool> validate(const QJsonObject& value, bool ignoreRequired = false);
QPair<bool, bool> validate(const QJsonValue& value, bool ignoreRequired = false);
///
/// @brief Auto correct a JSON structure
@@ -52,7 +52,7 @@ public:
/// @param ignoreRequired Ignore the "required" keyword in hyperion schema. Default is false
/// @return The corrected JSON structure
///
QJsonObject getAutoCorrectedConfig(const QJsonObject& value, bool ignoreRequired = false);
QJsonValue getAutoCorrectedConfig(const QJsonValue& value, bool ignoreRequired = false);
///
/// @return A list of error messages
@@ -207,7 +207,7 @@ private:
/// Auto correction variable
QString _correct;
/// The auto corrected json-configuration
QJsonObject _autoCorrected;
QJsonValue _autoCorrected;
/// The current location into a json-configuration structure being checked
QStringList _currentPath;
/// The result messages collected during the schema verification

View File

@@ -11,7 +11,7 @@ class QJsonUtils
{
public:
static void modify(QJsonObject& value, QStringList path, const QJsonValue& newValue = QJsonValue::Null, QString propertyName = "")
static void modify(QJsonValue& value, QStringList path, const QJsonValue& newValue = QJsonValue::Null, QString propertyName = "")
{
QJsonObject result;
@@ -27,7 +27,7 @@ public:
*it = current.mid(1, current.size()-1);
}
if (!value.isEmpty())
if (! (value.toObject().isEmpty() && value.toArray().isEmpty()) )
modifyValue(value, result, path, newValue, propertyName);
else if (newValue != QJsonValue::Null && !propertyName.isEmpty())
result[propertyName] = newValue;