config: Refactor class member vars (#10124)

* Refactor config classes vars

* Fix clang format errors
This commit is contained in:
davc0n 2025-04-20 20:39:33 +02:00 committed by GitHub
parent 9b4060f09b
commit 4d14bcb02f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 343 additions and 343 deletions

View file

@ -22,7 +22,7 @@ class CGradientValueData : public ICustomConfigValueData {
public:
CGradientValueData() = default;
CGradientValueData(CHyprColor col) {
m_vColors.push_back(col);
m_colors.push_back(col);
updateColorsOk();
};
virtual ~CGradientValueData() = default;
@ -32,39 +32,39 @@ class CGradientValueData : public ICustomConfigValueData {
}
void reset(CHyprColor col) {
m_vColors.clear();
m_vColors.emplace_back(col);
m_fAngle = 0;
m_colors.clear();
m_colors.emplace_back(col);
m_angle = 0;
updateColorsOk();
}
void updateColorsOk() {
m_vColorsOkLabA.clear();
for (auto& c : m_vColors) {
m_colorsOkLabA.clear();
for (auto& c : m_colors) {
const auto OKLAB = c.asOkLab();
m_vColorsOkLabA.emplace_back(OKLAB.l);
m_vColorsOkLabA.emplace_back(OKLAB.a);
m_vColorsOkLabA.emplace_back(OKLAB.b);
m_vColorsOkLabA.emplace_back(c.a);
m_colorsOkLabA.emplace_back(OKLAB.l);
m_colorsOkLabA.emplace_back(OKLAB.a);
m_colorsOkLabA.emplace_back(OKLAB.b);
m_colorsOkLabA.emplace_back(c.a);
}
}
/* Vector containing the colors */
std::vector<CHyprColor> m_vColors;
std::vector<CHyprColor> m_colors;
/* Vector containing pure colors for shoving into opengl */
std::vector<float> m_vColorsOkLabA;
std::vector<float> m_colorsOkLabA;
/* Float corresponding to the angle (rad) */
float m_fAngle = 0;
float m_angle = 0;
//
bool operator==(const CGradientValueData& other) const {
if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle)
if (other.m_colors.size() != m_colors.size() || m_angle != other.m_angle)
return false;
for (size_t i = 0; i < m_vColors.size(); ++i)
if (m_vColors[i] != other.m_vColors[i])
for (size_t i = 0; i < m_colors.size(); ++i)
if (m_colors[i] != other.m_colors[i])
return false;
return true;
@ -72,28 +72,28 @@ class CGradientValueData : public ICustomConfigValueData {
virtual std::string toString() {
std::string result;
for (auto& c : m_vColors) {
for (auto& c : m_colors) {
result += std::format("{:x} ", c.getAsHex());
}
result += std::format("{}deg", (int)(m_fAngle * 180.0 / M_PI));
result += std::format("{}deg", (int)(m_angle * 180.0 / M_PI));
return result;
}
};
class CCssGapData : public ICustomConfigValueData {
public:
CCssGapData() : top(0), right(0), bottom(0), left(0) {};
CCssGapData(int64_t global) : top(global), right(global), bottom(global), left(global) {};
CCssGapData(int64_t vertical, int64_t horizontal) : top(vertical), right(horizontal), bottom(vertical), left(horizontal) {};
CCssGapData(int64_t top, int64_t horizontal, int64_t bottom) : top(top), right(horizontal), bottom(bottom), left(horizontal) {};
CCssGapData(int64_t top, int64_t right, int64_t bottom, int64_t left) : top(top), right(right), bottom(bottom), left(left) {};
CCssGapData() : m_top(0), m_right(0), m_bottom(0), m_left(0) {};
CCssGapData(int64_t global) : m_top(global), m_right(global), m_bottom(global), m_left(global) {};
CCssGapData(int64_t vertical, int64_t horizontal) : m_top(vertical), m_right(horizontal), m_bottom(vertical), m_left(horizontal) {};
CCssGapData(int64_t top, int64_t horizontal, int64_t bottom) : m_top(top), m_right(horizontal), m_bottom(bottom), m_left(horizontal) {};
CCssGapData(int64_t top, int64_t right, int64_t bottom, int64_t left) : m_top(top), m_right(right), m_bottom(bottom), m_left(left) {};
/* Css like directions */
int64_t top;
int64_t right;
int64_t bottom;
int64_t left;
int64_t m_top;
int64_t m_right;
int64_t m_bottom;
int64_t m_left;
void parseGapData(CVarList varlist) {
switch (varlist.size()) {
@ -122,10 +122,10 @@ class CCssGapData : public ICustomConfigValueData {
}
void reset(int64_t global) {
top = global;
right = global;
bottom = global;
left = global;
m_top = global;
m_right = global;
m_bottom = global;
m_left = global;
}
virtual eConfigValueDataTypes getDataType() {
@ -133,6 +133,6 @@ class CCssGapData : public ICustomConfigValueData {
}
virtual std::string toString() {
return std::format("{} {} {} {}", top, right, bottom, left);
return std::format("{} {} {} {}", m_top, m_right, m_bottom, m_left);
}
};

File diff suppressed because it is too large Load diff

View file

@ -246,47 +246,47 @@ class CConfigManager {
std::optional<std::string> handlePlugin(const std::string&, const std::string&);
std::optional<std::string> handlePermission(const std::string&, const std::string&);
std::string configCurrentPath;
std::string m_configCurrentPath;
bool m_bWantsMonitorReload = false;
bool m_bNoMonitorReload = false;
bool isLaunchingExecOnce = false; // For exec-once to skip initial ws tracking
bool m_bLastConfigVerificationWasSuccessful = true;
bool m_wantsMonitorReload = false;
bool m_noMonitorReload = false;
bool m_isLaunchingExecOnce = false; // For exec-once to skip initial ws tracking
bool m_lastConfigVerificationWasSuccessful = true;
void storeFloatingSize(PHLWINDOW window, const Vector2D& size);
std::optional<Vector2D> getStoredFloatingSize(PHLWINDOW window);
private:
UP<Hyprlang::CConfig> m_pConfig;
UP<Hyprlang::CConfig> m_config;
std::vector<std::string> m_configPaths;
Hyprutils::Animation::CAnimationConfigTree m_AnimationTree;
Hyprutils::Animation::CAnimationConfigTree m_animationTree;
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
std::string m_currentSubmap = ""; // For storing the current keybind submap
std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty
std::vector<SExecRequestedRule> m_execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty
std::vector<std::string> m_vDeclaredPlugins;
std::vector<SPluginKeyword> pluginKeywords;
std::vector<SPluginVariable> pluginVariables;
std::vector<std::string> m_declaredPlugins;
std::vector<SPluginKeyword> m_pluginKeywords;
std::vector<SPluginVariable> m_pluginVariables;
bool isFirstLaunch = true; // For exec-once
bool m_isFirstLaunch = true; // For exec-once
std::vector<SMonitorRule> m_vMonitorRules;
std::vector<SWorkspaceRule> m_vWorkspaceRules;
std::vector<SP<CWindowRule>> m_vWindowRules;
std::vector<SP<CLayerRule>> m_vLayerRules;
std::vector<std::string> m_dBlurLSNamespaces;
std::vector<SMonitorRule> m_monitorRules;
std::vector<SWorkspaceRule> m_workspaceRules;
std::vector<SP<CWindowRule>> m_windowRules;
std::vector<SP<CLayerRule>> m_layerRules;
std::vector<std::string> m_blurLSNamespaces;
bool firstExecDispatched = false;
bool m_bManualCrashInitiated = false;
bool m_firstExecDispatched = false;
bool m_manualCrashInitiated = false;
std::vector<SFirstExecRequest> firstExecRequests; // bool is for if with rules
std::vector<std::string> finalExecRequests;
std::vector<SFirstExecRequest> m_firstExecRequests; // bool is for if with rules
std::vector<std::string> m_finalExecRequests;
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
std::string m_szConfigErrors = "";
std::vector<std::pair<std::string, std::string>> m_failedPluginConfigValues; // for plugin values of unloaded plugins
std::string m_configErrors = "";
uint32_t m_configValueNumber = 0;