Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorLayout::LayoutId Namespace Reference

LayoutPreview::id namespace utilities. More...

Functions

bool isAutotile (const QString &id)
 
bool isScrolling (const QString &id)
 
QString extractAlgorithmId (const QString &id)
 Extract the algorithm id portion from an autotile preview id.
 
QString makeAutotileId (const QString &algorithmId)
 
bool isScrollingFamily (const QString &id)
 Prefix test over the whole scrolling family: the bare sentinel AND the prefixed template stamp.
 
QString makeScrollingId (const QString &templateLayoutId)
 Build the rules-visible template stamp.
 
QString extractTemplateId (const QString &id)
 Extract the template layout UUID from a scrolling-family id.
 

Variables

constexpr QLatin1String AutotilePrefix {"autotile:"}
 
constexpr QLatin1String ScrollingId {"scrolling:"}
 Scrolling has no layout entity, so its whole id is the bare sentinel — it exists so a mode-only Scrolling assignment carries a NON-EMPTY activeLayoutId() and survives the assignment cascade's non-empty-id visitors (exactly like the bare "autotile:" shape the KCM writes).
 

Detailed Description

LayoutPreview::id namespace utilities.

There are three id forms sharing a single namespace at the consumer level. Manual zone layouts use UUID strings. Autotile-algorithm previews use the prefixed form "autotile:<algorithmId>". Scrolling has no layout entity of its own, so its ASSIGNMENT id is the bare payload-free sentinel "scrolling:" (see ScrollingId below for why it is compared exactly, not by prefix); a fourth, rules-query-only form "scrolling:<templateUuid>" exists solely as the rules-visible ActiveLayout stamp (see the scrolling FAMILY block below). Everyone who needs to build, parse, or classify a LayoutPreview id goes through the helpers here — no inline "autotile:" or "scrolling:" literals outside this namespace.

Lives in phosphor-layout-api because both phosphor-zones and phosphor-tiles produce LayoutPreview values with these IDs, and every consumer of ILayoutSource must be able to classify an id without pulling in either library-specific header.

Function Documentation

◆ extractAlgorithmId()

QString PhosphorLayout::LayoutId::extractAlgorithmId ( const QString &  id)
inline

Extract the algorithm id portion from an autotile preview id.

(The misuse warning below is a bare qWarning by design: PhosphorLayoutApi declares no logging category of its own — it is a contract library, and the few .cpp files it does build carry only interface glue, no logging. The message is a programmer-error flag, not runtime noise worth filtering. These helpers are inline and header-resident so a consumer can classify an id without linking anything.) Callers are expected to check isAutotile first — passing a non-autotile id here is a contract violation. We warn and return an empty string so the misuse is loud rather than silent, but remain graceful in release (no assert — the empty return gives callers a testable signal).

◆ extractTemplateId()

QString PhosphorLayout::LayoutId::extractTemplateId ( const QString &  id)
inline

Extract the template layout UUID from a scrolling-family id.

Mirrors extractAlgorithmId's contract: callers check isScrollingFamily first; a non-family id warns and returns empty, the bare sentinel returns empty silently.

◆ isAutotile()

bool PhosphorLayout::LayoutId::isAutotile ( const QString &  id)
inline

◆ isScrolling()

bool PhosphorLayout::LayoutId::isScrolling ( const QString &  id)
inline

◆ isScrollingFamily()

bool PhosphorLayout::LayoutId::isScrollingFamily ( const QString &  id)
inline

Prefix test over the whole scrolling family: the bare sentinel AND the prefixed template stamp.

This is the RULES-SIDE classifier; assignment classification stays with the exact-compare isScrolling above.

◆ makeAutotileId()

QString PhosphorLayout::LayoutId::makeAutotileId ( const QString &  algorithmId)
inline

◆ makeScrollingId()

QString PhosphorLayout::LayoutId::makeScrollingId ( const QString &  templateLayoutId)
inline

Build the rules-visible template stamp.

An empty templateLayoutId round-trips to the bare sentinel, mirroring makeAutotileId's empty-payload contract.

Variable Documentation

◆ AutotilePrefix

constexpr QLatin1String PhosphorLayout::LayoutId::AutotilePrefix {"autotile:"}
inlineconstexpr

◆ ScrollingId

constexpr QLatin1String PhosphorLayout::LayoutId::ScrollingId {"scrolling:"}
inlineconstexpr

Scrolling has no layout entity, so its whole id is the bare sentinel — it exists so a mode-only Scrolling assignment carries a NON-EMPTY activeLayoutId() and survives the assignment cascade's non-empty-id visitors (exactly like the bare "autotile:" shape the KCM writes).