Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ShaderProfileTree.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
7#include <PhosphorAnimation/phosphoranimation_export.h>
8
9#include <QHash>
10#include <QJsonObject>
11#include <QString>
12#include <QStringList>
13
15
73class PHOSPHORANIMATION_EXPORT ShaderProfileTree
74{
75public:
76 ShaderProfileTree() = default;
77
82
83 // ─────── Lookup ───────
84
85 ShaderProfile resolve(const QString& path) const;
86 ShaderProfile directOverride(const QString& path) const;
87 bool hasOverride(const QString& path) const;
88 QStringList overriddenPaths() const;
89
90 // ─────── Mutation ───────
91
92 void setOverride(const QString& path, const ShaderProfile& profile);
93 bool clearOverride(const QString& path);
95
96 // ─────── Baseline ───────
97
99 {
100 return m_baseline;
101 }
102 void setBaseline(const ShaderProfile& profile);
103
104 // ─────── Serialization ───────
105
106 QJsonObject toJson() const;
107 static ShaderProfileTree fromJson(const QJsonObject& obj);
108
109 // ─────── Equality ───────
110
111 bool operator==(const ShaderProfileTree& other) const;
112 bool operator!=(const ShaderProfileTree& other) const
113 {
114 return !(*this == other);
115 }
116
117private:
118 ShaderProfile m_baseline;
119 QHash<QString, ShaderProfile> m_overrides;
120 QStringList m_insertionOrder;
121};
122
132PHOSPHORANIMATION_EXPORT bool shaderPathResolvesInIsolation(const QString& path);
133
158PHOSPHORANIMATION_EXPORT QString shaderPathIsolationRoot(const QString& path);
159
170PHOSPHORANIMATION_EXPORT ShaderProfile resolveShaderWithDefault(const ShaderProfileTree& tree, const QString& path);
171
172} // namespace PhosphorAnimationShaders
Hierarchical ShaderProfile storage with walk-up inheritance.
Definition ShaderProfileTree.h:74
void setOverride(const QString &path, const ShaderProfile &profile)
ShaderProfileTree & operator=(const ShaderProfileTree &)=default
void setBaseline(const ShaderProfile &profile)
bool hasOverride(const QString &path) const
ShaderProfile baseline() const
Definition ShaderProfileTree.h:98
ShaderProfile directOverride(const QString &path) const
bool operator!=(const ShaderProfileTree &other) const
Definition ShaderProfileTree.h:112
bool clearOverride(const QString &path)
ShaderProfileTree(ShaderProfileTree &&)=default
ShaderProfile resolve(const QString &path) const
static ShaderProfileTree fromJson(const QJsonObject &obj)
ShaderProfileTree(const ShaderProfileTree &)=default
ShaderProfileTree & operator=(ShaderProfileTree &&)=default
bool operator==(const ShaderProfileTree &other) const
Per-event shader effect selection and configuration.
Definition ShaderProfile.h:39
Definition AnimationShaderContract.h:10
PHOSPHORANIMATION_EXPORT ShaderProfile resolveShaderWithDefault(const ShaderProfileTree &tree, const QString &path)
Resolve path against tree, applying the built-in per-event default shader (ProfilePaths::defaultShade...
PHOSPHORANIMATION_EXPORT bool shaderPathResolvesInIsolation(const QString &path)
True when path resolves its shader in ISOLATION: ShaderProfileTree:: resolve reads only the direct ov...
PHOSPHORANIMATION_EXPORT QString shaderPathIsolationRoot(const QString &path)
The subtree root path resolves WITHIN, or an empty string when it resolves the ordinary way (from the...