Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ShaderProfile.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
6#include <PhosphorAnimation/phosphoranimation_export.h>
7
8#include <QJsonObject>
9#include <QString>
10#include <QVariantMap>
11
12#include <optional>
13
15
38class PHOSPHORANIMATION_EXPORT ShaderProfile
39{
40public:
44 std::optional<QString> effectId;
45
50 std::optional<QVariantMap> parameters;
51
52 // ─────── Effective getters ───────
53
54 QString effectiveEffectId() const
55 {
56 return effectId.value_or(QString());
57 }
58 QVariantMap effectiveParameters() const
59 {
60 return parameters.value_or(QVariantMap());
61 }
62
64
65 // ─────── Serialization ───────
66
67 static constexpr auto JsonFieldEffectId = "effectId";
68 static constexpr auto JsonFieldParameters = "parameters";
69
70 QJsonObject toJson() const;
71 static ShaderProfile fromJson(const QJsonObject& obj);
72
73 // ─────── Overlay ───────
74
77 static void overlay(ShaderProfile& dst, const ShaderProfile& src);
78
79 // ─────── Equality ───────
80
81 bool operator==(const ShaderProfile& other) const;
82 bool operator!=(const ShaderProfile& other) const
83 {
84 return !(*this == other);
85 }
86};
87
88} // namespace PhosphorAnimationShaders
Per-event shader effect selection and configuration.
Definition ShaderProfile.h:39
QString effectiveEffectId() const
Definition ShaderProfile.h:54
static ShaderProfile fromJson(const QJsonObject &obj)
std::optional< QVariantMap > parameters
Per-event parameter overrides for the shader.
Definition ShaderProfile.h:50
bool operator==(const ShaderProfile &other) const
QVariantMap effectiveParameters() const
Definition ShaderProfile.h:58
std::optional< QString > effectId
Which animation shader effect to apply.
Definition ShaderProfile.h:44
static void overlay(ShaderProfile &dst, const ShaderProfile &src)
Overlay src onto dst: every engaged field in src replaces the corresponding field in dst.
bool operator!=(const ShaderProfile &other) const
Definition ShaderProfile.h:82
Definition AnimationAppRule.h:17