Configuration for a single animation event. More...
#include <phosphor-animation/include/PhosphorAnimation/Profile.h>
Public Member Functions | |
| Profile ()=default | |
| Profile (const Profile &)=default | |
| Profile & | operator= (const Profile &)=default |
| Profile (Profile &&)=default | |
| Profile & | operator= (Profile &&)=default |
| qreal | effectiveDuration () const |
| int | effectiveMinDistance () const |
| SequenceMode | effectiveSequenceMode () const |
| int | effectiveStaggerInterval () const |
| Profile | withDefaults () const |
Copy with every unset field filled from library defaults — curve is backfilled with a default-constructed Easing (OutCubic) when null, and duration / minDistance / sequenceMode / staggerInterval take their Default* constants. | |
| QJsonObject | toJson () const |
| Serialize to JSON. Only set fields are emitted. | |
| bool | operator== (const Profile &other) const |
| bool | operator!= (const Profile &other) const |
Static Public Member Functions | |
| static Profile | fromJson (const QJsonObject &obj, const CurveRegistry ®istry) |
| Parse from JSON. | |
Public Attributes | |
| std::shared_ptr< const Curve > | curve |
| nullptr = inherit from parent / library default (outCubic bezier). | |
| std::optional< qreal > | duration |
| Animation length in ms. Spring curves derive their own settle time. | |
| std::optional< int > | minDistance |
| Skip threshold in px — animation skipped if distance < this and no size change. | |
| std::optional< SequenceMode > | sequenceMode |
| std::optional< int > | staggerInterval |
| Milliseconds between cascade starts. | |
| std::optional< QString > | presetName |
| Optional user-assigned preset name. Purely decorative for UI. | |
Static Public Attributes | |
| static constexpr qreal | DefaultDuration = 150.0 |
| static constexpr int | DefaultMinDistance = 0 |
| static constexpr SequenceMode | DefaultSequenceMode = SequenceMode::AllAtOnce |
| static constexpr int | DefaultStaggerInterval = 30 |
| static constexpr qreal | MaxDurationMs = 60.0 * 60.0 * 1000.0 |
| static constexpr int | MaxStaggerIntervalMs = 60 * 60 * 1000 |
| static constexpr int | MaxMinDistancePx = 100000 |
Upper bound on minDistance, in pixels. | |
| static constexpr auto | JsonFieldCurve = "curve" |
| static constexpr auto | JsonFieldDuration = "duration" |
| static constexpr auto | JsonFieldMinDistance = "minDistance" |
| static constexpr auto | JsonFieldSequenceMode = "sequenceMode" |
| static constexpr auto | JsonFieldStaggerInterval = "staggerInterval" |
| static constexpr auto | JsonFieldPresetName = "presetName" |
Configuration for a single animation event.
Fields are std::optional so ProfileTree inheritance can distinguish "inherit from parent" (nullopt) from "explicitly set" (engaged). Use effective*() getters or withDefaults() for runtime values with library defaults filled in.
|
default |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
Parse from JSON.
Missing keys produce unset fields. Curve resolved via registry. duration / minDistance / staggerInterval that are out of range, OR that hold something which is not a JSON number, are rejected: logged and left unset, so the field inherits from a parent profile or falls back to the library default. The type check is not redundant — QJsonValue::toDouble(default) hands back the default for any non-number, and every library default passes the range checks, so without it a malformed value would land ENGAGED and block inheritance.
curve resolves through registry and is left NULL when the key is absent or names no registered curve, so an unknown curve inherits rather than pinning the library default. presetName takes any string as-is (it is decorative, so there is nothing to range-check), but a NON-string value is rejected, warned about, and leaves the field unset like the others.
Every diagnostic mentioned here is RATE-LIMITED to once per (field, reason) per process. Settings::animationProfile() parses through here with no cache and the daemon republishes on a settings slider's drag path, so an unlimited warning would emit tens of times a second for the length of a drag. A user debugging a hand-edited profile therefore sees the warning on the first parse only.
sequenceMode is the one exception. A value that is out of range or not a known enumerator is logged and replaced with DefaultSequenceMode ENGAGED, which blocks inheritance rather than allowing it. Leaving it unset would let a parent's Cascade through on a leaf whose own file says otherwise, which reads as the override having silently done nothing.
|
inline |
|
default |
|
default |
| bool PhosphorAnimation::Profile::operator== | ( | const Profile & | other | ) | const |
| QJsonObject PhosphorAnimation::Profile::toJson | ( | ) | const |
Serialize to JSON. Only set fields are emitted.
| Profile PhosphorAnimation::Profile::withDefaults | ( | ) | const |
Copy with every unset field filled from library defaults — curve is backfilled with a default-constructed Easing (OutCubic) when null, and duration / minDistance / sequenceMode / staggerInterval take their Default* constants.
presetName is the ONE exception: it has no library default and stays disengaged, so callers must still treat it as optional (value_or), never dereference it blind.
nullptr = inherit from parent / library default (outCubic bezier).
|
staticconstexpr |
| std::optional<qreal> PhosphorAnimation::Profile::duration |
Animation length in ms. Spring curves derive their own settle time.
|
staticconstexpr |
Upper bound on minDistance, in pixels.
Sized well past any real display diagonal, so it never rejects a value a user could mean, while giving the validator a DOMAIN bound like its two siblings above rather than the int range: a minDistance of two billion pixels is not a large threshold, it is "never animate anything", which is exactly what these caps exist to refuse.
| std::optional<int> PhosphorAnimation::Profile::minDistance |
Skip threshold in px — animation skipped if distance < this and no size change.
| std::optional<QString> PhosphorAnimation::Profile::presetName |
Optional user-assigned preset name. Purely decorative for UI.
| std::optional<SequenceMode> PhosphorAnimation::Profile::sequenceMode |
| std::optional<int> PhosphorAnimation::Profile::staggerInterval |
Milliseconds between cascade starts.