Represents a collection of zones that form a layout. More...
#include <phosphor-zones/include/PhosphorZones/Layout.h>
Public Types | |
| using | ScreenIdResolver = std::function< QString(const QString &)> |
| Screen-id resolver. | |
Signals | |
| void | nameChanged () |
| void | descriptionChanged () |
| void | zonePaddingChanged () |
| void | outerGapChanged () |
| void | showZoneNumbersChanged () |
| void | overlayDisplayModeChanged () |
| void | sourcePathChanged () |
| void | shaderIdChanged () |
| void | shaderParamsChanged () |
| void | aspectRatioClassChanged () |
| void | hiddenFromSelectorChanged () |
| void | allowedScreensChanged () |
| void | allowedDesktopsChanged () |
| void | allowedActivitiesChanged () |
| void | appRulesChanged () |
| void | autoAssignChanged () |
| void | useFullScreenGeometryChanged () |
| void | zonesChanged () |
| void | zoneAdded (Zone *zone) |
| void | zoneRemoved (Zone *zone) |
| void | layoutModified () |
Public Member Functions | |
| Layout (QObject *parent=nullptr) | |
| Layout (const QString &name, QObject *parent=nullptr) | |
| Layout (const Layout &other) | |
| ~Layout () override | |
| Layout & | operator= (const Layout &other) |
| QUuid | id () const |
| QString | name () const |
| void | setName (const QString &name) |
| QString | description () const |
| void | setDescription (const QString &description) |
| int | zonePadding () const |
| void | setZonePadding (int padding) |
| bool | hasZonePaddingOverride () const |
| void | clearZonePaddingOverride () |
| int | outerGap () const |
| void | setOuterGap (int gap) |
| bool | hasOuterGapOverride () const |
| void | clearOuterGapOverride () |
| bool | usePerSideOuterGap () const |
| void | setUsePerSideOuterGap (bool enabled) |
| int | outerGapTop () const |
| void | setOuterGapTop (int gap) |
| int | outerGapBottom () const |
| void | setOuterGapBottom (int gap) |
| int | outerGapLeft () const |
| void | setOuterGapLeft (int gap) |
| int | outerGapRight () const |
| void | setOuterGapRight (int gap) |
| bool | hasPerSideOuterGapOverride () const |
| ::PhosphorLayout::EdgeGaps | rawOuterGaps () const |
| Raw per-side gap overrides. | |
| bool | showZoneNumbers () const |
| void | setShowZoneNumbers (bool show) |
| int | overlayDisplayMode () const |
| void | setOverlayDisplayMode (int mode) |
| bool | hasOverlayDisplayModeOverride () const |
| void | clearOverlayDisplayModeOverride () |
| QString | sourcePath () const |
| void | setSourcePath (const QString &path) |
| bool | isSystemLayout () const |
| QString | systemSourcePath () const |
| void | setSystemSourcePath (const QString &path) |
| bool | hasSystemOrigin () const |
| QString | shaderId () const |
| void | setShaderId (const QString &id) |
| QVariantMap | shaderParams () const |
| void | setShaderParams (const QVariantMap ¶ms) |
| ::PhosphorLayout::AspectRatioClass | aspectRatioClass () const |
| void | setAspectRatioClass (::PhosphorLayout::AspectRatioClass cls) |
| int | aspectRatioClassInt () const |
| void | setAspectRatioClassInt (int cls) |
| qreal | minAspectRatio () const |
| void | setMinAspectRatio (qreal ratio) |
| qreal | maxAspectRatio () const |
| void | setMaxAspectRatio (qreal ratio) |
| bool | matchesAspectRatio (qreal screenAspectRatio) const |
| Check if this layout is suitable for a screen with the given aspect ratio. | |
| bool | hiddenFromSelector () const |
| void | setHiddenFromSelector (bool hidden) |
| QStringList | allowedScreens () const |
| void | setAllowedScreens (const QStringList &screens) |
| QList< int > | allowedDesktops () const |
| void | setAllowedDesktops (const QList< int > &desktops) |
| QStringList | allowedActivities () const |
| void | setAllowedActivities (const QStringList &activities) |
| QVector< AppRule > | appRules () const |
| void | setAppRules (const QVector< AppRule > &rules) |
| QVariantList | appRulesVariant () const |
| void | setAppRulesVariant (const QVariantList &rules) |
| AppRuleMatch | matchAppRule (const QString &windowClass) const |
| bool | autoAssign () const |
| void | setAutoAssign (bool enabled) |
| bool | useFullScreenGeometry () const |
| void | setUseFullScreenGeometry (bool enabled) |
| bool | hasFixedGeometryZones () const |
| Returns true if any zone uses fixed (pixel) geometry mode. | |
| QRectF | fixedZoneBoundingBox () const |
| Bounding box of all fixed-geometry zones in pixel coordinates, anchored at (0, 0). | |
| QRectF | fixedZoneReferenceGeometry () const |
| Reference geometry suitable for normalizing fixed-pixel zones to 0–1 relative coordinates. | |
| int | defaultOrder () const |
| void | setDefaultOrder (int order) |
| int | zoneCount () const |
| QVector< Zone * > | zones () const |
| Zone * | zone (int index) const |
| Zone * | zoneById (const QUuid &id) const |
| Zone * | zoneByNumber (int number) const |
| void | addZone (Zone *zone) |
| void | removeZone (Zone *zone) |
| void | removeZoneAt (int index) |
| void | clearZones () |
| void | moveZone (int fromIndex, int toIndex) |
| Zone * | zoneAtPoint (const QPointF &point) const |
| Zone * | nearestZone (const QPointF &point, qreal maxDistance=-1) const |
| QVector< Zone * > | zonesInRect (const QRectF &rect) const |
| QVector< Zone * > | adjacentZones (const QPointF &point, qreal threshold=20) const |
| void | renumberZones () |
| QRectF | lastRecalcGeometry () const |
| void | setLastRecalcGeometry (const QRectF &geom) |
| QJsonObject | toJson () const |
| bool | isDirty () const |
| void | markDirty () |
| void | clearDirty () |
| void | beginBatchModify () |
| void | endBatchModify () |
| void | recalculateZoneGeometries (const QRectF &screenGeometry) |
Recalculate every zone's absolute geometry against screenGeometry. | |
Static Public Member Functions | |
| static Layout * | fromJson (const QJsonObject &json, QObject *parent=nullptr) |
| static void | setScreenIdResolver (ScreenIdResolver resolver) |
| static ScreenIdResolver | screenIdResolver () |
| Returns a copy of the currently-installed resolver (empty if none). | |
| static Layout * | createColumnsLayout (int columns, QObject *parent=nullptr) |
| static Layout * | createRowsLayout (int rows, QObject *parent=nullptr) |
| static Layout * | createGridLayout (int columns, int rows, QObject *parent=nullptr) |
| static Layout * | createPriorityGridLayout (QObject *parent=nullptr) |
| static Layout * | createFocusLayout (QObject *parent=nullptr) |
Represents a collection of zones that form a layout.
Layouts can be assigned to specific monitors, virtual desktops, and activities. Supports both predefined templates and custom canvas-style layouts.
| using PhosphorZones::Layout::ScreenIdResolver = std::function<QString(const QString&)> |
Screen-id resolver.
Install a callback that maps a legacy connector name (e.g. "DP-2") to the application's stable screen identifier (EDID-based, "LG:Model:Serial"). The library calls it for every entry in allowedScreens during fromJson so in-memory layouts hold normalized IDs regardless of what the file stores.
The callback typically requires a live QGuiApplication (to enumerate connected QScreens). Install from the daemon / editor / settings processes only; leave unset for headless / test code, in which case strings are stored verbatim.
Passing a default-constructed function clears the resolver.
|
explicit |
|
explicit |
| PhosphorZones::Layout::Layout | ( | const Layout & | other | ) |
|
override |
| void PhosphorZones::Layout::addZone | ( | Zone * | zone | ) |
| QVector< Zone * > PhosphorZones::Layout::adjacentZones | ( | const QPointF & | point, |
| qreal | threshold = 20 |
||
| ) | const |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
signal |
| QVariantList PhosphorZones::Layout::appRulesVariant | ( | ) | const |
|
inline |
|
signal |
|
inline |
|
inline |
|
signal |
| void PhosphorZones::Layout::beginBatchModify | ( | ) |
|
inline |
| void PhosphorZones::Layout::clearOuterGapOverride | ( | ) |
| void PhosphorZones::Layout::clearOverlayDisplayModeOverride | ( | ) |
| void PhosphorZones::Layout::clearZonePaddingOverride | ( | ) |
| void PhosphorZones::Layout::clearZones | ( | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inline |
|
inline |
|
signal |
| void PhosphorZones::Layout::endBatchModify | ( | ) |
| QRectF PhosphorZones::Layout::fixedZoneBoundingBox | ( | ) | const |
Bounding box of all fixed-geometry zones in pixel coordinates, anchored at (0, 0).
Empty rect if no fixed-geometry zones exist.
| QRectF PhosphorZones::Layout::fixedZoneReferenceGeometry | ( | ) | const |
Reference geometry suitable for normalizing fixed-pixel zones to 0–1 relative coordinates.
Returns lastRecalcGeometry() when it accommodates fixedZoneBoundingBox(); falls back to the bounding box itself when the recalc cache is stale (e.g. layout was recalced against a different screen's orientation, leaving normalized coords
1 or a square reference frame). Empty rect when the layout has
no fixed-geometry zones.
|
static |
| bool PhosphorZones::Layout::hasFixedGeometryZones | ( | ) | const |
Returns true if any zone uses fixed (pixel) geometry mode.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
signal |
|
inline |
|
inline |
| bool PhosphorZones::Layout::isSystemLayout | ( | ) | const |
|
inline |
|
signal |
|
inline |
| AppRuleMatch PhosphorZones::Layout::matchAppRule | ( | const QString & | windowClass | ) | const |
| bool PhosphorZones::Layout::matchesAspectRatio | ( | qreal | screenAspectRatio | ) | const |
Check if this layout is suitable for a screen with the given aspect ratio.
Uses explicit min/max bounds if set, otherwise falls back to class matching.
|
inline |
|
inline |
| void PhosphorZones::Layout::moveZone | ( | int | fromIndex, |
| int | toIndex | ||
| ) |
|
inline |
|
signal |
| Zone * PhosphorZones::Layout::nearestZone | ( | const QPointF & | point, |
| qreal | maxDistance = -1 |
||
| ) | const |
|
inline |
|
inline |
|
signal |
|
inline |
|
inline |
|
inline |
|
inline |
|
signal |
|
inline |
Raw per-side gap overrides.
Values may be -1 (use global). Callers should use GeometryUtils::getEffectiveOuterGaps() instead for resolved pixel values.
| void PhosphorZones::Layout::recalculateZoneGeometries | ( | const QRectF & | screenGeometry | ) |
Recalculate every zone's absolute geometry against screenGeometry.
The PlasmaZones application enforces its own "only LayoutComputeService calls this" coalescing discipline via its type system — that restriction is an application-layer concern, not a library one, so the method is public here. Direct callers bypass the service's coalescing / threading contract and should only do so when they know they're running on the main thread with no pending compute requests.
| void PhosphorZones::Layout::removeZone | ( | Zone * | zone | ) |
| void PhosphorZones::Layout::removeZoneAt | ( | int | index | ) |
| void PhosphorZones::Layout::renumberZones | ( | ) |
|
static |
Returns a copy of the currently-installed resolver (empty if none).
Returning a copy rather than a reference keeps readers race-free against a concurrent setScreenIdResolver on another thread — the resolver itself is guarded internally, and the returned copy can be invoked without holding the lock.
| void PhosphorZones::Layout::setAllowedActivities | ( | const QStringList & | activities | ) |
| void PhosphorZones::Layout::setAllowedDesktops | ( | const QList< int > & | desktops | ) |
| void PhosphorZones::Layout::setAllowedScreens | ( | const QStringList & | screens | ) |
| void PhosphorZones::Layout::setAppRules | ( | const QVector< AppRule > & | rules | ) |
| void PhosphorZones::Layout::setAppRulesVariant | ( | const QVariantList & | rules | ) |
| void PhosphorZones::Layout::setAspectRatioClass | ( | ::PhosphorLayout::AspectRatioClass | cls | ) |
| void PhosphorZones::Layout::setAspectRatioClassInt | ( | int | cls | ) |
| void PhosphorZones::Layout::setAutoAssign | ( | bool | enabled | ) |
|
inline |
| void PhosphorZones::Layout::setDescription | ( | const QString & | description | ) |
| void PhosphorZones::Layout::setHiddenFromSelector | ( | bool | hidden | ) |
|
inline |
| void PhosphorZones::Layout::setMaxAspectRatio | ( | qreal | ratio | ) |
| void PhosphorZones::Layout::setMinAspectRatio | ( | qreal | ratio | ) |
| void PhosphorZones::Layout::setName | ( | const QString & | name | ) |
| void PhosphorZones::Layout::setOuterGap | ( | int | gap | ) |
| void PhosphorZones::Layout::setOuterGapBottom | ( | int | gap | ) |
| void PhosphorZones::Layout::setOuterGapLeft | ( | int | gap | ) |
| void PhosphorZones::Layout::setOuterGapRight | ( | int | gap | ) |
| void PhosphorZones::Layout::setOuterGapTop | ( | int | gap | ) |
| void PhosphorZones::Layout::setOverlayDisplayMode | ( | int | mode | ) |
|
static |
| void PhosphorZones::Layout::setShaderId | ( | const QString & | id | ) |
| void PhosphorZones::Layout::setShaderParams | ( | const QVariantMap & | params | ) |
| void PhosphorZones::Layout::setShowZoneNumbers | ( | bool | show | ) |
| void PhosphorZones::Layout::setSourcePath | ( | const QString & | path | ) |
|
inline |
| void PhosphorZones::Layout::setUseFullScreenGeometry | ( | bool | enabled | ) |
| void PhosphorZones::Layout::setUsePerSideOuterGap | ( | bool | enabled | ) |
| void PhosphorZones::Layout::setZonePadding | ( | int | padding | ) |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
| QJsonObject PhosphorZones::Layout::toJson | ( | ) | const |
|
inline |
|
signal |
|
inline |
| Zone * PhosphorZones::Layout::zone | ( | int | index | ) | const |
|
signal |
| Zone * PhosphorZones::Layout::zoneAtPoint | ( | const QPointF & | point | ) | const |
| Zone * PhosphorZones::Layout::zoneById | ( | const QUuid & | id | ) | const |
| Zone * PhosphorZones::Layout::zoneByNumber | ( | int | number | ) | const |
|
inline |
|
inline |
|
signal |
|
signal |
|
inline |
|
signal |
| QVector< Zone * > PhosphorZones::Layout::zonesInRect | ( | const QRectF & | rect | ) | const |