Registry mapping profile path strings to Profile values.
More...
#include <phosphor-animation/include/PhosphorAnimation/PhosphorProfileRegistry.h>
|
| void | profileChanged (const QString &path) |
| | Fired when a profile is registered, replaced, or unregistered.
|
| |
| void | profilesReloaded () |
| | Fired only on wholesale operations (reloadAll, clear).
|
| |
| void | ownerReloaded (const QString &ownerTag) |
| | Fired at the end of a reloadFromOwner/clearOwner batch if any changes occurred.
|
| |
|
| | PhosphorProfileRegistry (QObject *parent=nullptr) |
| |
| | ~PhosphorProfileRegistry () override |
| |
| | PhosphorProfileRegistry (const PhosphorProfileRegistry &)=delete |
| |
| PhosphorProfileRegistry & | operator= (const PhosphorProfileRegistry &)=delete |
| |
| std::optional< Profile > | resolve (const QString &path) const |
| | Resolve path to a Profile if registered.
|
| |
| Profile | resolveWithInheritance (const QString &path) const |
| | Resolve path with parent-chain inheritance.
|
| |
| Profile | resolveWithInheritance (const QString &path, const QString &lowPrecedenceOwnerTag) const |
| |
| void | setLowPrecedenceOwnerTag (const QString &tag) |
| | Configure the owner tag whose entries should be treated as the lowest-precedence layer in resolveWithInheritance.
|
| |
| void | registerProfile (const QString &path, const Profile &profile) |
| | Register or replace the profile at path (direct/untagged owner).
|
| |
| void | registerProfile (const QString &path, const Profile &profile, const QString &ownerTag) |
| | Register or replace at path, stamped with an owner tag.
|
| |
| void | unregisterProfile (const QString &path) |
| | Remove path. Fires profileChanged if it existed.
|
| |
| void | reloadFromOwner (const QString &ownerTag, const QHash< QString, Profile > &profiles) |
| | Replace the subset owned by ownerTag with profiles.
|
| |
| void | clearOwner (const QString &ownerTag) |
| | Remove every entry owned by ownerTag.
|
| |
| void | reloadAll (const QHash< QString, Profile > &profiles) |
| | Wholesale replace the entire registry. TEST-ONLY semantics.
|
| |
| void | clear () |
| | Clear the registry. Fires profilesReloaded().
|
| |
| QString | ownerOf (const QString &path) const |
| | Current owner tag for path, or empty string.
|
| |
| QHash< QString, Profile > | snapshot () const |
| | Thread-safe copy of every registered (path → Profile) pair, owner tags discarded.
|
| |
| int | profileCount () const |
| | Current path count. Thread-safe.
|
| |
| bool | hasProfile (const QString &path) const |
| | Is path registered? Thread-safe.
|
| |
Registry mapping profile path strings to Profile values.
Consumers register profiles here; settings reloads call registerProfile() to publish updates. Thread-safe (internal mutex).
◆ PhosphorProfileRegistry() [1/2]
| PhosphorAnimation::PhosphorProfileRegistry::PhosphorProfileRegistry |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
◆ ~PhosphorProfileRegistry()
| PhosphorAnimation::PhosphorProfileRegistry::~PhosphorProfileRegistry |
( |
| ) |
|
|
override |
◆ PhosphorProfileRegistry() [2/2]
◆ clear()
| void PhosphorAnimation::PhosphorProfileRegistry::clear |
( |
| ) |
|
◆ clearOwner()
| void PhosphorAnimation::PhosphorProfileRegistry::clearOwner |
( |
const QString & |
ownerTag | ) |
|
Remove every entry owned by ownerTag.
◆ defaultRegistry()
Read the process-wide default; nullptr if none published yet.
◆ hasProfile()
| bool PhosphorAnimation::PhosphorProfileRegistry::hasProfile |
( |
const QString & |
path | ) |
const |
Is path registered? Thread-safe.
◆ operator=()
◆ ownerOf()
| QString PhosphorAnimation::PhosphorProfileRegistry::ownerOf |
( |
const QString & |
path | ) |
const |
Current owner tag for path, or empty string.
◆ ownerReloaded
| void PhosphorAnimation::PhosphorProfileRegistry::ownerReloaded |
( |
const QString & |
ownerTag | ) |
|
|
signal |
Fired at the end of a reloadFromOwner/clearOwner batch if any changes occurred.
◆ profileChanged
| void PhosphorAnimation::PhosphorProfileRegistry::profileChanged |
( |
const QString & |
path | ) |
|
|
signal |
Fired when a profile is registered, replaced, or unregistered.
◆ profileCount()
| int PhosphorAnimation::PhosphorProfileRegistry::profileCount |
( |
| ) |
const |
Current path count. Thread-safe.
◆ profilesReloaded
| void PhosphorAnimation::PhosphorProfileRegistry::profilesReloaded |
( |
| ) |
|
|
signal |
Fired only on wholesale operations (reloadAll, clear).
◆ registerProfile() [1/2]
| void PhosphorAnimation::PhosphorProfileRegistry::registerProfile |
( |
const QString & |
path, |
|
|
const Profile & |
profile |
|
) |
| |
Register or replace the profile at path (direct/untagged owner).
◆ registerProfile() [2/2]
| void PhosphorAnimation::PhosphorProfileRegistry::registerProfile |
( |
const QString & |
path, |
|
|
const Profile & |
profile, |
|
|
const QString & |
ownerTag |
|
) |
| |
Register or replace at path, stamped with an owner tag.
◆ reloadAll()
| void PhosphorAnimation::PhosphorProfileRegistry::reloadAll |
( |
const QHash< QString, Profile > & |
profiles | ) |
|
Wholesale replace the entire registry. TEST-ONLY semantics.
◆ reloadFromOwner()
| void PhosphorAnimation::PhosphorProfileRegistry::reloadFromOwner |
( |
const QString & |
ownerTag, |
|
|
const QHash< QString, Profile > & |
profiles |
|
) |
| |
Replace the subset owned by ownerTag with profiles.
Entries owned by other tags are preserved.
◆ resolve()
| std::optional< Profile > PhosphorAnimation::PhosphorProfileRegistry::resolve |
( |
const QString & |
path | ) |
const |
Resolve path to a Profile if registered.
Exact match only — returns nullopt if no entry exists at exactly path. For inheritance-aware resolution that walks the parent chain and overlays each level (the semantics every animation consumer actually wants — a parent-node override at popup SHOULD propagate to popup.layoutPicker.show), use resolveWithInheritance instead.
◆ resolveWithInheritance() [1/2]
| Profile PhosphorAnimation::PhosphorProfileRegistry::resolveWithInheritance |
( |
const QString & |
path | ) |
const |
Resolve path with parent-chain inheritance.
Walks path → parent(path) → ... → "global", starting from a default-constructed Profile, and overlays each registered entry along the chain — every engaged optional field in a deeper entry replaces the shallower one (deeper-leaf-wins), while unset fields inherit from the parent. Falls through to the library defaults via Profile::withDefaults() so the returned value is always fully populated.
Two-layer overlay (when lowPrecedenceOwnerTag is set). The walk runs in TWO passes: pass 1 overlays only entries owned by the low-precedence tag (seed-style defaults); pass 2 overlays everything else (Settings publishes, user JSONs). Pass 2 always wins over pass 1, regardless of depth — so a user edit at the parent path widget (duration=800 ms) still cascades to a leaf like widget.pulse.fast even when the leaf has a seed entry (500 ms cubic-bezier). Without the two-layer model, leaf seeds would silently shadow parent user-overrides via the deeper-wins rule — exactly the bug the bundled-JSON deletion fixed.
When lowPrecedenceOwnerTag is empty, the walk degrades to a single-pass deeper-wins overlay (the original semantics, kept for tests and consumers that don't use seed tagging).
◆ resolveWithInheritance() [2/2]
| Profile PhosphorAnimation::PhosphorProfileRegistry::resolveWithInheritance |
( |
const QString & |
path, |
|
|
const QString & |
lowPrecedenceOwnerTag |
|
) |
| const |
◆ setDefaultRegistry()
Publish registry as the process-wide default for QML resolution.
◆ setLowPrecedenceOwnerTag()
| void PhosphorAnimation::PhosphorProfileRegistry::setLowPrecedenceOwnerTag |
( |
const QString & |
tag | ) |
|
Configure the owner tag whose entries should be treated as the lowest-precedence layer in resolveWithInheritance.
Set once per registry from the composition root (daemon / settings / editor) right after the registry is constructed, using the conventional kShellAnimationFamilySeedsOwnerTag. Empty (default) preserves single-pass walk semantics.
◆ snapshot()
| QHash< QString, Profile > PhosphorAnimation::PhosphorProfileRegistry::snapshot |
( |
| ) |
const |
Thread-safe copy of every registered (path → Profile) pair, owner tags discarded.
Intended for publishers that need to serialize the merged per-event profile set out of process (e.g. the daemon broadcasting a ProfileTree to the kwin-effect over D-Bus). For in-process resolution prefer resolveWithInheritance — it applies the parent-chain overlay the registry cannot encode in a flat snapshot.
◆ unregisterProfile()
| void PhosphorAnimation::PhosphorProfileRegistry::unregisterProfile |
( |
const QString & |
path | ) |
|
Remove path. Fires profileChanged if it existed.
The documentation for this class was generated from the following file: