Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorAnimation::PhosphorProfile Class Reference

QML value-type wrapper around PhosphorAnimation::Profile. More...

#include <phosphor-animation/include/PhosphorAnimation/PhosphorProfile.h>

Public Types

enum class  SequenceMode : int { AllAtOnce = int(PhosphorAnimation::SequenceMode::AllAtOnce) , Cascade = int(PhosphorAnimation::SequenceMode::Cascade) }
 

Public Member Functions

 PhosphorProfile ()=default
 
 PhosphorProfile (const Profile &value)
 Implicit-conversion ctor from core-library value.
 
const Profilevalue () const
 Read-only access to the underlying value.
 
PhosphorCurve curve () const
 
void setCurve (const PhosphorCurve &c)
 
qreal duration () const
 
void setDuration (qreal ms)
 
int minDistance () const
 
void setMinDistance (int px)
 
SequenceMode sequenceMode () const
 
void setSequenceMode (SequenceMode mode)
 
int staggerInterval () const
 
void setStaggerInterval (int ms)
 
QString presetName () const
 
void setPresetName (const QString &name)
 
QJsonObject toJson () const
 Serialize to a JSON object via Profile::toJson.
 
bool operator== (const PhosphorProfile &other) const
 
bool operator!= (const PhosphorProfile &other) const
 

Static Public Member Functions

static PhosphorProfile fromJson (const QJsonObject &obj)
 Parse from a JSON object.
 

Detailed Description

QML value-type wrapper around PhosphorAnimation::Profile.

Q_GADGET per Phase 4 decision O — compile-time snapshot shape for PhosphorMotionAnimation.profile: PhosphorProfile { … } (decision R's value-binding branch). The path-string branch goes through PhosphorProfileRegistry and lands in a later sub-commit.

Optional-field treatment in QML

Profile's fields are std::optional<T> so ProfileTree inheritance can distinguish "unset, inherit" from "explicitly set to library default" (see Profile.h's class doc). QML cannot represent std::optional<T> directly, so the wrapper collapses the distinction at the QML boundary:

  • Reading a property returns the effective value (Profile:: effective*). Unset fields read back as their library default.
  • Writing a property engages the optional — the field becomes "explicitly set". There is no QML-reachable way to reset a field back to unset (call Profile::*.reset() from C++ if needed).

This matches how plugin authors typically use PhosphorProfile: construct a compile-time literal with every field they care about, hand it to PhosphorMotionAnimation.profile, and treat it as immutable. ProfileTree inheritance is a C++-side concern accessed through the core ProfileTree API, not through this wrapper.

Member Enumeration Documentation

◆ SequenceMode

Enumerator
AllAtOnce 
Cascade 

Constructor & Destructor Documentation

◆ PhosphorProfile() [1/2]

PhosphorAnimation::PhosphorProfile::PhosphorProfile ( )
default

◆ PhosphorProfile() [2/2]

PhosphorAnimation::PhosphorProfile::PhosphorProfile ( const Profile value)
inlineexplicit

Implicit-conversion ctor from core-library value.

Member Function Documentation

◆ curve()

PhosphorCurve PhosphorAnimation::PhosphorProfile::curve ( ) const
inline

◆ duration()

qreal PhosphorAnimation::PhosphorProfile::duration ( ) const
inline

◆ fromJson()

static PhosphorProfile PhosphorAnimation::PhosphorProfile::fromJson ( const QJsonObject obj)
inlinestatic

Parse from a JSON object.

Missing keys become unset fields (read back as library defaults via effective*).

Uses the process-wide CurveRegistry installed via PhosphorCurve::setDefaultRegistry when available so user-authored curves registered by CurveLoader are visible to this parse path. Falls back to a function-local static registry (built-ins only) when no default registry has been installed — this covers startup-before-composition-root and test harness paths where the daemon hasn't published a user-curve-aware registry yet. Consulting the published registry first matches the convention used by PhosphorCurve::fromString.

◆ minDistance()

int PhosphorAnimation::PhosphorProfile::minDistance ( ) const
inline

◆ operator!=()

◆ operator==()

◆ presetName()

QString PhosphorAnimation::PhosphorProfile::presetName ( ) const
inline

◆ sequenceMode()

SequenceMode PhosphorAnimation::PhosphorProfile::sequenceMode ( ) const
inline

◆ setCurve()

void PhosphorAnimation::PhosphorProfile::setCurve ( const PhosphorCurve c)
inline

◆ setDuration()

void PhosphorAnimation::PhosphorProfile::setDuration ( qreal  ms)
inline

◆ setMinDistance()

void PhosphorAnimation::PhosphorProfile::setMinDistance ( int  px)
inline

◆ setPresetName()

void PhosphorAnimation::PhosphorProfile::setPresetName ( const QString name)
inline

◆ setSequenceMode()

void PhosphorAnimation::PhosphorProfile::setSequenceMode ( SequenceMode  mode)
inline

◆ setStaggerInterval()

void PhosphorAnimation::PhosphorProfile::setStaggerInterval ( int  ms)
inline

◆ staggerInterval()

int PhosphorAnimation::PhosphorProfile::staggerInterval ( ) const
inline

◆ toJson()

QJsonObject PhosphorAnimation::PhosphorProfile::toJson ( ) const
inline

Serialize to a JSON object via Profile::toJson.

Only engaged fields are written, matching the inheritance-preserving JSON shape the C++ side produces.

◆ value()

const Profile & PhosphorAnimation::PhosphorProfile::value ( ) const
inline

Read-only access to the underlying value.

The non-const overload was deliberately removed: a mutable handle from QML let scripts bypass the setter clamps below by writing directly into the engaged-optional fields. Core-library mutators construct a fresh Profile and assign through the implicit-conversion ctor instead.


The documentation for this class was generated from the following file: