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

Structural schema for one action param. More...

#include <PhosphorRules/RuleAction.h>

Public Attributes

QString key {}
 wire param key in RuleAction::params
QString kind {}
 UI kind hint — see struct doc.
std::optional< double > min {}
 inclusive lower bound, in display units
std::optional< double > max {}
 inclusive upper bound, in display units
std::optional< double > scale {}
 stored = display * scale; nullopt for unscaled kinds
std::optional< double > defaultDisplay {}
 Initial display-unit value for the editor when a fresh rule is created.
QStringList enumWireValues {}
 wire values for kind == "enum"; empty otherwise

Detailed Description

Structural schema for one action param.

The schema carries enough information for the editor UI to render an input widget without the UI layer hand-maintaining a parallel per-type switch. kind is a UI-side hint string (the canonical kinds are string, number, percent, enum, bool, color, plus the picker-aware kinds snappingLayout, tilingAlgorithm, scrollingTemplate, animationEvent, shaderEffect, shaderPreset, overlayShader, overlayLayout, zoneOrdinals, zoneNames, curveEditor, screenId, virtualDesktop, workspaceName, decorationChain); QML loaders dispatch on it. Labels stay in the GPL settings layer because they need translation through PhosphorI18n::tr — the lib only owns the structural part of the schema.

The optional fields are populated by kind:

  • number / percent may carry min / max (display-unit bounds) and scale (stored = display * scale; e.g. percent uses 0.01).
  • enum carries enumWireValues — the wire strings the picker offers; labels for each are translated upstream.
  • bool is a toggle (wire value is a JSON bool); may carry defaultDisplay (1.0 → seed true, 0.0 → seed false).
  • string may carry max as a CHARACTER cap on the trimmed value (not a display-unit bound): the editor's text field reads it as maximumLength and the validator rejects longer values at load.
  • color is a #AARRGGBB hex string (alpha-first, matching QColor::HexArgb); seeded by the settings layer's defaultPayloadFor "color" branch (defaultDisplay is a double, so it cannot carry a colour seed). Shorter #RGB/#RRGGBB shapes still load for hand-edited values.
  • picker-aware kinds normally carry no schema state — the QML loader knows to swap in the catalogue-driven ComboBox — though one MAY carry advisory bounds the editor reads from the schema: an ordinal range (RouteToDesktop's virtualDesktop declares min/max, zoneOrdinals a max) or a per-character max on a name-like kind (zoneNames, workspaceName). The loader dispatches on kind alone either way.

Member Data Documentation

◆ defaultDisplay

std::optional<double> PhosphorRules::ParamSchema::defaultDisplay {}

Initial display-unit value for the editor when a fresh rule is created.

Falls back to min when unset. Needed for kinds whose min is a valid but undesirable starting value — e.g. SetOpacity's min = 0 means a fresh rule would seed at 0% (invisible window) and saveable as-is; the descriptor instead declares defaultDisplay = 100.0 so the user starts at "no visible change" and must deliberately lower it.

◆ enumWireValues

QStringList PhosphorRules::ParamSchema::enumWireValues {}

wire values for kind == "enum"; empty otherwise

◆ key

QString PhosphorRules::ParamSchema::key {}

wire param key in RuleAction::params

◆ kind

QString PhosphorRules::ParamSchema::kind {}

UI kind hint — see struct doc.

◆ max

std::optional<double> PhosphorRules::ParamSchema::max {}

inclusive upper bound, in display units

◆ min

std::optional<double> PhosphorRules::ParamSchema::min {}

inclusive lower bound, in display units

◆ scale

std::optional<double> PhosphorRules::ParamSchema::scale {}

stored = display * scale; nullopt for unscaled kinds


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