Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
ProfileTree.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
10
11#include <QJsonObject>
12#include <QString>
13#include <QStringList>
14
15namespace PhosphorAnimation {
16
17class CurveRegistry;
18
25class PHOSPHORANIMATION_EXPORT ProfileTree
26{
27public:
28 ProfileTree() = default;
29
30 ProfileTree(const ProfileTree&) = default;
31 ProfileTree& operator=(const ProfileTree&) = default;
34
39 Profile resolve(const QString& path) const;
40
62 Profile overlayChainOnto(const QString& path, Profile base) const;
63
66 Profile directOverride(const QString& path) const;
67
68 bool hasOverride(const QString& path) const;
69
71 QStringList overriddenPaths() const;
72
80 bool hasAnyOverride() const;
81
83 void setOverride(const QString& path, const Profile& profile);
84
86 bool clearOverride(const QString& path);
87
89
92 {
93 return m_store.baseline();
94 }
95 void setBaseline(const Profile& profile);
96
99 QJsonObject toJson() const;
100
103 static ProfileTree fromJson(const QJsonObject& obj, const CurveRegistry& registry);
104
105 bool operator==(const ProfileTree& other) const;
106 bool operator!=(const ProfileTree& other) const
107 {
108 return !(*this == other);
109 }
110
111private:
112 static void overlay(Profile& dst, const Profile& src);
113
119 Profile overlayChain(const QString& path, Profile seed) const;
120
130};
131
132} // namespace PhosphorAnimation
String-id <-> curve factory registry.
Definition CurveRegistry.h:26
bool operator==(const ProfileTree &other) const
static ProfileTree fromJson(const QJsonObject &obj, const CurveRegistry &registry)
Parse from JSON.
bool operator!=(const ProfileTree &other) const
Definition ProfileTree.h:106
ProfileTree & operator=(ProfileTree &&)=default
Profile directOverride(const QString &path) const
Direct override at path without walking parents.
ProfileTree & operator=(const ProfileTree &)=default
QStringList overriddenPaths() const
Every path with a direct override, in insertion order.
Profile resolve(const QString &path) const
Resolve effective Profile for path (walks parents, fills defaults).
bool hasOverride(const QString &path) const
ProfileTree(const ProfileTree &)=default
QJsonObject toJson() const
Serialize the entire tree.
bool clearOverride(const QString &path)
Remove the override at path. Returns true if one was removed.
void setOverride(const QString &path, const Profile &profile)
Install an explicit override. Empty path is rejected (no-op).
bool hasAnyOverride() const
True when no path in the tree carries an override.
Profile baseline() const
The baseline "global" profile — always participates in resolution.
Definition ProfileTree.h:91
ProfileTree(ProfileTree &&)=default
Profile overlayChainOnto(const QString &path, Profile base) const
Overlay ONLY this tree's override chain for path onto base — the tree's own baseline is ignored and n...
void setBaseline(const Profile &profile)
Configuration for a single animation event.
Definition Profile.h:33
A baseline payload plus keyed overrides, in insertion order.
Definition PathKeyedOverrides.h:56
Definition AnimatedValue.h:32