Remove ensure JSON helpers

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-11-09 18:30:07 +00:00
parent 7e8cf628e8
commit e42c9d2a1d
38 changed files with 228 additions and 239 deletions

View File

@@ -179,10 +179,10 @@ bool CustomTheme::read(const QString& path, bool& hasCustomLogColors)
const QJsonObject root = doc.object();
m_name = Json::requireString(root, "name", "Theme name");
m_widgets = Json::requireString(root, "widgets", "Qt widget theme");
m_qssFilePath = Json::ensureString(root, "qssFilePath", "themeStyle.css");
m_qssFilePath = root["qssFilePath"].toString("themeStyle.css");
auto readColor = [](const QJsonObject& colors, const QString& colorName) -> QColor {
auto colorValue = Json::ensureString(colors, colorName, QString());
auto colorValue = colors[colorName].toString();
if (!colorValue.isEmpty()) {
QColor color(colorValue);
if (!color.isValid()) {
@@ -222,7 +222,7 @@ bool CustomTheme::read(const QString& path, bool& hasCustomLogColors)
// fade
m_fadeColor = readColor(colorsRoot, "fadeColor");
m_fadeAmount = Json::ensureDouble(colorsRoot, "fadeAmount", 0.5, "fade amount");
m_fadeAmount = colorsRoot["fadeAmount"].toDouble(0.5);
}
if (root.contains("logColors")) {