Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorRules::ActionDescriptor Struct Reference

Static metadata describing one registered action type. More...

#include <PhosphorRules/RuleAction.h>

Public Types

using SlotResolver = std::function<QString(const QJsonObject& params)>
 Function shape that resolves the slot for a concrete action's params.
using Validator = std::function<bool(const QJsonObject& params)>

Public Attributes

QString type
 the action type id
SlotResolver slotFor
 Resolves the slot for a concrete action's params.
Validator validate
 Returns true if params is a well-formed payload for this type.
bool terminal = false
 Terminal actions (the Exclude family: Exclude / ExcludePlacement / ExcludeAnimations / ExcludeDecorations) stop evaluation once their rule matches — within the evaluator's terminal-action scope, see RuleEvaluator::setTerminalActionScope.
QStringList allowedKeys {}
 The complete set of param keys this action type accepts.
ActionDomain domain = ActionDomain::Window
 Which evaluation pass the action contributes to — see ActionDomain.
QList< ParamSchema > params {}
 Structural per-param schema consumed by the editor UI.
bool userAuthorable = true
 True when the action should appear in the editor's "add rule" type picker.
QString category {}
 UI grouping category for the action-type picker.
int displayOrder = 0
 Intended sort key within a category (lower = earlier).
QStringList tags {}
 Behavioural tags for consumer-side filtering.

Detailed Description

Static metadata describing one registered action type.

Adding a future rule type is registering one of these — no new matcher, no new file, no new UI page. The descriptor owns:

  • the slotFor resolver (a function so animation actions can scope their slot by an event param),
  • a validate predicate run on load,
  • the set of param keys the action accepts (allowedKeys) — the strict loader rejects any action carrying a key not in this set,
  • whether the action is terminal (an Exclude-family action stops evaluation — see the four Exclude* action types),
  • the structural params schema consumed by the editor UI,
  • the userAuthorable visibility flag used by the action-type picker to filter out actions that are registered for back-compat / loader completeness but should not appear in the new-rule wizard, and
  • category / displayOrder / tags for UI grouping and consumer-side filtering.

Member Typedef Documentation

◆ SlotResolver

using PhosphorRules::ActionDescriptor::SlotResolver = std::function<QString(const QJsonObject& params)>

Function shape that resolves the slot for a concrete action's params.

Hoisted to a type alias so the registry initialiser body stays readable (the std::function template is verbose enough that inlining it at every descriptor pushes the literal off-screen).

◆ Validator

using PhosphorRules::ActionDescriptor::Validator = std::function<bool(const QJsonObject& params)>

Member Data Documentation

◆ allowedKeys

QStringList PhosphorRules::ActionDescriptor::allowedKeys {}

The complete set of param keys this action type accepts.

The strict loader (RuleAction::fromJson) rejects an action whose params carries any key outside this set. An empty set disables the strict-key check — used for free-form / future-extensible action types whose params payload is deliberately open.

◆ category

QString PhosphorRules::ActionDescriptor::category {}

UI grouping category for the action-type picker.

Actions with the same category are clustered together; empty means uncategorized.

◆ displayOrder

int PhosphorRules::ActionDescriptor::displayOrder = 0

Intended sort key within a category (lower = earlier).

Advisory only today: the shipped picker sorts within a category alphabetically by label and no consumer reads this field.

◆ domain

ActionDomain PhosphorRules::ActionDescriptor::domain = ActionDomain::Window

Which evaluation pass the action contributes to — see ActionDomain.

The validator combines this with the rule's match expression to detect rules that silently never fire (a context action against a match that pins window properties).

◆ params

QList<ParamSchema> PhosphorRules::ActionDescriptor::params {}

Structural per-param schema consumed by the editor UI.

Order is the order the editor renders the param widgets in. An action with no params (e.g. Float, Exclude) leaves this empty.

◆ slotFor

SlotResolver PhosphorRules::ActionDescriptor::slotFor

Resolves the slot for a concrete action's params.

Returning an empty string means the action contributes no slot (treated as invalid).

◆ tags

QStringList PhosphorRules::ActionDescriptor::tags {}

Behavioural tags for consumer-side filtering.

Values are from the Tag:: namespace constants. Use ActionRegistry::hasTag() / typesWithTag() for queries.

◆ terminal

bool PhosphorRules::ActionDescriptor::terminal = false

Terminal actions (the Exclude family: Exclude / ExcludePlacement / ExcludeAnimations / ExcludeDecorations) stop evaluation once their rule matches — within the evaluator's terminal-action scope, see RuleEvaluator::setTerminalActionScope.

◆ type

QString PhosphorRules::ActionDescriptor::type

the action type id

◆ userAuthorable

bool PhosphorRules::ActionDescriptor::userAuthorable = true

True when the action should appear in the editor's "add rule" type picker.

Set to false on actions that are registered for loader / back-compat completeness but whose semantics aren't authorable through the standard wizard (e.g. an action whose runtime consumer hasn't shipped yet).

◆ validate

Validator PhosphorRules::ActionDescriptor::validate

Returns true if params is a well-formed payload for this type.


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