Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
AnimationShaderRegistry.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
11
12#include <QList>
13#include <QString>
14#include <QStringList>
15#include <QVariantMap>
16
17#include <memory>
18
20
75{
76 Q_OBJECT
77
78public:
79 explicit AnimationShaderRegistry(QObject* parent = nullptr);
81
82 // Lookup -------------------------------------------------------------------
83
84 QList<AnimationShaderEffect> availableEffects() const;
85 AnimationShaderEffect effect(const QString& id) const;
86 bool hasEffect(const QString& id) const;
87 QStringList effectIds() const;
88
127 QVariantMap translateAnimationParams(const QString& effectId, const QVariantMap& friendlyParams) const;
128
133 static QVariantMap translateAnimationParams(const AnimationShaderEffect& effect, const QVariantMap& friendlyParams);
134
135Q_SIGNALS:
137
138protected:
139 void onUserPathChanged(const QString& path) override;
140
141private:
143
156 static std::unique_ptr<PhosphorFsLoader::IScanStrategy> buildScanStrategy(AnimationShaderRegistry* self);
157
158 // Non-owning typed alias for the strategy the base owns. Populated
159 // in the ctor body via dynamic_cast (asserted non-null) so the
160 // invariant fires BEFORE the typed pointer is committed — keeps the
161 // narrow UB window between a hypothetical subclass-mismatch
162 // static_cast and its diagnostic out of the field's lifetime. Named
163 // distinctly from the base's private `m_strategy` to make the
164 // shadowing explicit at the field declaration.
165 ScanStrategy* m_typedStrategy = nullptr;
166};
167
168} // namespace PhosphorAnimationShaders
Registry of available animation shader transition effects.
Definition AnimationShaderRegistry.h:75
void onUserPathChanged(const QString &path) override
Hook invoked from setUserPath when the path actually changes.
QVariantMap translateAnimationParams(const QString &effectId, const QVariantMap &friendlyParams) const
Translate a friendly parameter map into the canonical slot keys consumed by both runtimes that drive ...
QList< AnimationShaderEffect > availableEffects() const
AnimationShaderEffect effect(const QString &id) const
static QVariantMap translateAnimationParams(const AnimationShaderEffect &effect, const QVariantMap &friendlyParams)
Static counterpart for callers that already hold the resolved AnimationShaderEffect (e....
QObject base for registries hosting a MetadataPackScanStrategy<Payload>.
Definition MetadataPackRegistryBase.h:61
Reusable scan strategy for metadata.json-driven subdirectory pack registries.
Definition MetadataPackScanStrategy.h:187
Definition AnimationAppRule.h:17
Metadata for a single animation shader effect (transition).
Definition AnimationShaderEffect.h:45