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
9#include <QHash>
10#include <QJsonObject>
11#include <QString>
12#include <QStringList>
13
14namespace PhosphorAnimation {
15
16class CurveRegistry;
17
24class PHOSPHORANIMATION_EXPORT ProfileTree
25{
26public:
27 ProfileTree() = default;
28
29 ProfileTree(const ProfileTree&) = default;
30 ProfileTree& operator=(const ProfileTree&) = default;
33
36 Profile resolve(const QString& path) const;
37
40 Profile directOverride(const QString& path) const;
41
42 bool hasOverride(const QString& path) const;
43
45 QStringList overriddenPaths() const;
46
48 void setOverride(const QString& path, const Profile& profile);
49
51 bool clearOverride(const QString& path);
52
54
57 {
58 return m_baseline;
59 }
60 void setBaseline(const Profile& profile);
61
64 QJsonObject toJson() const;
65
68 static ProfileTree fromJson(const QJsonObject& obj, const CurveRegistry& registry);
69
70 bool operator==(const ProfileTree& other) const;
71 bool operator!=(const ProfileTree& other) const
72 {
73 return !(*this == other);
74 }
75
76private:
77 static void overlay(Profile& dst, const Profile& src);
78
79 Profile m_baseline;
80 QHash<QString, Profile> m_overrides;
81 QStringList m_insertionOrder;
82};
83
84} // namespace PhosphorAnimation
String-id <-> curve factory registry.
Definition CurveRegistry.h:22
Hierarchical profile storage with walk-up inheritance.
Definition ProfileTree.h:25
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:71
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).
Profile baseline() const
The baseline "global" profile — always participates in resolution.
Definition ProfileTree.h:56
ProfileTree(ProfileTree &&)=default
void setBaseline(const Profile &profile)
Configuration for a single animation event.
Definition Profile.h:33
Definition AnimatedValue.h:31