Renderer-ready snapshot of one layout entry (manual zone layout OR autotile algorithm result). More...
#include <phosphor-layout-api/include/PhosphorLayoutApi/LayoutPreview.h>
Public Member Functions | |
| bool | isAutotile () const noexcept |
True when this preview backs an autotile algorithm (equivalent to algorithm.has_value()). | |
| bool | isValid () const noexcept |
| Structural consistency check. | |
Public Attributes | |
| QString | id |
| Stable identifier for this layout entry. | |
| QString | displayName |
| Human-readable name for the picker UI (i18n'd by the source). | |
| QString | description |
| Optional longer description shown in tooltips / detail views. | |
| QVector< QRectF > | zones |
| Zone rectangles in 0.0–1.0 relative coordinates. | |
| QVector< int > | zoneNumbers |
| Per-zone display label. | |
| int | zoneCount = 0 |
| Number of zones in the preview. | |
| bool | recommended = true |
| True when the layout matches the rendering canvas's aspect ratio well enough to be a "recommended" pick. | |
| qreal | referenceAspectRatio = 0.0 |
| For fixed-geometry manual layouts: the reference aspect ratio the zones were authored for. | |
| AspectRatioClass | aspectRatioClass = AspectRatioClass::Any |
| Aspect-ratio class hint propagated up from the layout source. | |
| QString | sectionKey |
| Section-grouping metadata for the picker UI. | |
| QString | sectionLabel |
| int | sectionOrder = 0 |
| bool | autoAssign = false |
| True when new windows should auto-fill the first empty zone (manual layouts only — the autotile equivalent is implicit). | |
| bool | isSystem = false |
| True when the layout is "system-owned" and should render with a lock badge in the picker. | |
| bool | isScrollingTemplate = false |
| True when this preview backs a native scrolling TEMPLATE (the third card family beside manual layouts and autotile algorithms). | |
| std::optional< AlgorithmMetadata > | algorithm |
| Optional autotile algorithm metadata. | |
| int | masterCount = 1 |
The master-window count zones was actually computed with. | |
Static Public Attributes | |
| static constexpr int | UnlimitedZoneCount = 0 |
Sentinel for zoneCount meaning "no hard limit on window count" (typical for unlimited autotile algorithms). | |
Renderer-ready snapshot of one layout entry (manual zone layout OR autotile algorithm result).
Plain data — no Qt object lifecycle, no signals.
Both phosphor-zones (manual Layout -> preview) and the future phosphor-tile-algo (autotile algorithm @ N windows -> preview) produce values of this type. Editor / settings / overlay code consumes LayoutPreview uniformly without branching on the underlying source — the only renderer-relevant difference between manual and autotile is whether isAutotile is set (used for badge / icon styling).
Coordinate system: every QRectF in zones is in 0.0–1.0 relative space, ready to be scaled into any pixel rectangle. For autotile entries the "preview" geometry is computed for some specific window count (see ILayoutSource::previewAt) — different counts yield different previews from the same algorithm.
zoneCount carries a logical "this layout supports N windows" value that's distinct from zones.size(). The sentinel UnlimitedZoneCount (== 0) means "no hard limit" and is used by unlimited autotile algorithms whose rendered preview still contains a fixed example geometry. Consumers validate the shape via isValid().
|
inlinenoexcept |
True when this preview backs an autotile algorithm (equivalent to algorithm.has_value()).
Consumers branch on this to toggle UI affordances like the system-vs-user badge and algorithm-specific parameter editors. The invariant isAutotile() == algorithm.has_value() holds by construction — the flag is computed, not stored.
|
inlinenoexcept |
Structural consistency check.
Returns true when:
zoneCount is UnlimitedZoneCount, or matches zones.size() (a bounded-count preview renders exactly as many rects as it claims to support);zoneNumbers is either empty (unnumbered — typical for autotile algorithms that only emit a count) or exactly matches zones.size() (1:1 parallel arrays).Empty previews (default-constructed, used by ILayoutSource to signal "id not mine") are valid — zones is empty, zoneCount is 0, and zoneNumbers is empty.
| std::optional<AlgorithmMetadata> PhosphorLayout::LayoutPreview::algorithm |
Optional autotile algorithm metadata.
Presence is the sole signal that this preview backs an autotile algorithm rather than a static manual layout — isAutotile() reads the optional's has_value(). Picker reads the metadata for capability flags (supports master count / split ratio editors, lock badge, etc.).
| AspectRatioClass PhosphorLayout::LayoutPreview::aspectRatioClass = AspectRatioClass::Any |
Aspect-ratio class hint propagated up from the layout source.
Picker uses this for section grouping; renderer ignores. Manual layouts source this from Layout::aspectRatioClass; autotile entries leave it at the default (AspectRatioClass::Any).
| bool PhosphorLayout::LayoutPreview::autoAssign = false |
True when new windows should auto-fill the first empty zone (manual layouts only — the autotile equivalent is implicit).
Drives auto-snap behaviour at the daemon side; renderer ignores.
| QString PhosphorLayout::LayoutPreview::description |
Optional longer description shown in tooltips / detail views.
| QString PhosphorLayout::LayoutPreview::displayName |
Human-readable name for the picker UI (i18n'd by the source).
| QString PhosphorLayout::LayoutPreview::id |
Stable identifier for this layout entry.
For manual layouts this is the layout's UUID string (with braces); for autotile entries it's the prefixed form "autotile:<algorithmId>" so manual + autotile IDs share a single namespace at the consumer level. Native scrolling templates are UUID-shaped too, so the id alone does not tell the two UUID families apart — isScrollingTemplate is what distinguishes them.
| bool PhosphorLayout::LayoutPreview::isScrollingTemplate = false |
True when this preview backs a native scrolling TEMPLATE (the third card family beside manual layouts and autotile algorithms).
Template ids are UUID-shaped like manual layouts, so this flag — not the id form — is the family discriminator; zones carry the blueprint's column bands for the shared thumbnail renderer.
| bool PhosphorLayout::LayoutPreview::isSystem = false |
True when the layout is "system-owned" and should render with a lock badge in the picker.
For manual layouts this reflects whether the layout file came from the system install (vs. a user-created copy). For autotile layouts the source computes this from !algorithm->isScripted || !algorithm->isUserScript — i.e. built-in C++ algorithms and system-installed scripts are system entries; user scripts are not.
Sources (ZonesLayoutSource, AutotileLayoutSource) are the sole populators. Consumers treat this as authoritative — do not recompute from algorithm flags; that's the source's job.
| int PhosphorLayout::LayoutPreview::masterCount = 1 |
The master-window count zones was actually computed with.
This is a resolved value, not a capability — the source seeds it from the user's configured / saved per-algorithm tuning, which is why it lives here rather than in AlgorithmMetadata (see that struct's note on tuning parameters). Renderers mark this many leading zones as masters, so the value must stay in step with the geometry it describes. Only meaningful when algorithm is set and reports supportsMasterCount; manual layouts leave the default.
| bool PhosphorLayout::LayoutPreview::recommended = true |
True when the layout matches the rendering canvas's aspect ratio well enough to be a "recommended" pick.
False entries can still render (they just appear in a collapsed "Other" section in the picker). Sources fill this when called with an aspect-ratio hint; otherwise leave the default (true) so unranked previews show normally.
| qreal PhosphorLayout::LayoutPreview::referenceAspectRatio = 0.0 |
For fixed-geometry manual layouts: the reference aspect ratio the zones were authored for.
Renderer uses this so the preview tile shows the layout in its native aspect rather than stretched. Zero when the layout has no fixed-geometry zones (relative layouts adapt to any aspect).
| QString PhosphorLayout::LayoutPreview::sectionKey |
Section-grouping metadata for the picker UI.
Sources fill these to drive grouped headers ("Built-in", "Custom", "Standard 16:9", etc.). All optional; empty values mean "no section header".
| QString PhosphorLayout::LayoutPreview::sectionLabel |
| int PhosphorLayout::LayoutPreview::sectionOrder = 0 |
|
staticconstexpr |
Sentinel for zoneCount meaning "no hard limit on window count" (typical for unlimited autotile algorithms).
Distinct from a partially-populated preview — isValid checks the relationship between zoneCount and zones.size() rather than the sentinel itself.
| int PhosphorLayout::LayoutPreview::zoneCount = 0 |
Number of zones in the preview.
Identical to zones.size() for finished previews — kept as an explicit field because some autotile algorithms expose a logical "this layout supports N windows" value distinct from the number of preview rectangles (e.g. unlimited algorithms use a sentinel here while zones renders a fixed example geometry).
| QVector<int> PhosphorLayout::LayoutPreview::zoneNumbers |
Per-zone display label.
Same length as zones (or empty when the source doesn't number its zones — autotile algorithms often emit just the count). Numbering is 1-based; consumer renders the literal integer.
| QVector<QRectF> PhosphorLayout::LayoutPreview::zones |
Zone rectangles in 0.0–1.0 relative coordinates.
Renderer scales these into the preview canvas. Order matches zoneNumbers.