From 5ba33f846129f3e6c0505b19f94634b24505e828 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 26 Apr 2026 15:16:36 +0100 Subject: config/lua: init lua config manager, use lua if available (#13817) Adds a new lua config manager, which will automatically be used if there is a lua config present. --- src/config/shared/complex/ComplexDataType.hpp | 2 +- src/config/shared/complex/ComplexDataTypes.hpp | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/config/shared/complex') diff --git a/src/config/shared/complex/ComplexDataType.hpp b/src/config/shared/complex/ComplexDataType.hpp index 84b4c503..cc83bee9 100644 --- a/src/config/shared/complex/ComplexDataType.hpp +++ b/src/config/shared/complex/ComplexDataType.hpp @@ -17,6 +17,6 @@ namespace Config { virtual eConfigValueDataTypes getDataType() = 0; - virtual std::string toString() = 0; + virtual std::string toString() const = 0; }; } \ No newline at end of file diff --git a/src/config/shared/complex/ComplexDataTypes.hpp b/src/config/shared/complex/ComplexDataTypes.hpp index 536b0433..35cfd493 100644 --- a/src/config/shared/complex/ComplexDataTypes.hpp +++ b/src/config/shared/complex/ComplexDataTypes.hpp @@ -66,7 +66,7 @@ namespace Config { return true; } - virtual std::string toString() { + virtual std::string toString() const { std::string result; for (auto& c : m_colors) { result += std::format("{:x} ", c.getAsHex()); @@ -130,7 +130,7 @@ namespace Config { return CVD_TYPE_CSS_VALUE; } - virtual std::string toString() { + virtual std::string toString() const { return std::format("{} {} {} {}", m_top, m_right, m_bottom, m_left); } }; @@ -141,6 +141,9 @@ namespace Config { CFontWeightConfigValueData(const char* weight) { parseWeight(weight); } + CFontWeightConfigValueData(int64_t def) : m_value(def) { + ; + } int64_t m_value = 400; // default to normal weight @@ -148,20 +151,19 @@ namespace Config { return CVD_TYPE_FONT_WEIGHT; } - virtual std::string toString() { + virtual std::string toString() const { return std::format("{}", m_value); } + inline static const auto WEIGHTS = std::map{ + {"thin", 100}, {"ultralight", 200}, {"light", 300}, {"semilight", 350}, {"book", 380}, {"normal", 400}, + {"medium", 500}, {"semibold", 600}, {"bold", 700}, {"ultrabold", 800}, {"heavy", 900}, {"ultraheavy", 1000}, + }; + void parseWeight(const std::string& strWeight) { auto lcWeight{strWeight}; std::ranges::transform(strWeight, lcWeight.begin(), ::tolower); - // values taken from Pango weight enums - const auto WEIGHTS = std::map{ - {"thin", 100}, {"ultralight", 200}, {"light", 300}, {"semilight", 350}, {"book", 380}, {"normal", 400}, - {"medium", 500}, {"semibold", 600}, {"bold", 700}, {"ultrabold", 800}, {"heavy", 900}, {"ultraheavy", 1000}, - }; - auto weight = WEIGHTS.find(lcWeight); if (weight != WEIGHTS.end()) m_value = weight->second; -- cgit v1.2.3