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
39class PHOSPHORANIMATION_EXPORT ShaderProfileTree
40{
41public:
42 ShaderProfileTree() = default;
43
48
49 // ─────── Lookup ───────
50
51 ShaderProfile resolve(const QString& path) const;
52 ShaderProfile directOverride(const QString& path) const;
53 bool hasOverride(const QString& path) const;
54 QStringList overriddenPaths() const;
55
56 // ─────── Mutation ───────
57
58 void setOverride(const QString& path, const ShaderProfile& profile);
59 bool clearOverride(const QString& path);
61
62 // ─────── Baseline ───────
63
65 {
66 return m_baseline;
67 }
68 void setBaseline(const ShaderProfile& profile);
69
70 // ─────── Serialization ───────
71
72 QJsonObject toJson() const;
73 static ShaderProfileTree fromJson(const QJsonObject& obj);
74
75 // ─────── Equality ───────
76
77 bool operator==(const ShaderProfileTree& other) const;
78 bool operator!=(const ShaderProfileTree& other) const
79 {
80 return !(*this == other);
81 }
82
83private:
84 ShaderProfile m_baseline;
85 QHash<QString, ShaderProfile> m_overrides;
86 QStringList m_insertionOrder;
87};
88
89} // namespace PhosphorAnimationShaders
Hierarchical ShaderProfile storage with walk-up inheritance.
Definition ShaderProfileTree.h:40
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:64
ShaderProfile directOverride(const QString &path) const
bool operator!=(const ShaderProfileTree &other) const
Definition ShaderProfileTree.h:78
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 AnimationAppRule.h:17