diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-26 15:16:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-26 15:16:36 +0100 |
| commit | 5ba33f846129f3e6c0505b19f94634b24505e828 (patch) | |
| tree | aaacabe678006040c342935481a86607c66607fd /src/config/shared/complex | |
| parent | 329b2b356dd92ac07f4e2aa69cbce82ee9ba9d19 (diff) | |
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.
Diffstat (limited to 'src/config/shared/complex')
| -rw-r--r-- | src/config/shared/complex/ComplexDataType.hpp | 2 | ||||
| -rw-r--r-- | src/config/shared/complex/ComplexDataTypes.hpp | 20 |
2 files changed, 12 insertions, 10 deletions
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<std::string, int>{ + {"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<std::string, int>{ - {"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; |
