Represents a single zone within a layout. More...
#include <phosphor-zones/include/PhosphorZones/Zone.h>
Signals | |
| void | nameChanged () |
| void | geometryChanged () |
| void | relativeGeometryChanged () |
| void | zoneNumberChanged () |
| void | highlightColorChanged () |
| void | inactiveColorChanged () |
| void | borderColorChanged () |
| void | activeOpacityChanged () |
| void | inactiveOpacityChanged () |
| void | borderWidthChanged () |
| void | borderRadiusChanged () |
| void | highlightedChanged () |
| void | useCustomColorsChanged () |
| void | overlayDisplayModeChanged () |
| void | geometryModeChanged () |
| void | fixedGeometryChanged () |
Public Member Functions | |
| Zone (QObject *parent=nullptr) | |
| Zone (const QRectF &geometry, QObject *parent=nullptr) | |
| ~Zone () override=default | |
| Zone (const Zone &)=delete | |
| Zone & | operator= (const Zone &)=delete |
| Zone * | clone (QObject *parent=nullptr) const |
| Creates a copy of this zone with a new unique ID. | |
| void | copyPropertiesFrom (const Zone &other) |
| Copies properties from another zone (excluding ID) | |
| QUuid | id () const |
| QString | name () const |
| void | setName (const QString &name) |
| QRectF | geometry () const |
| void | setGeometry (const QRectF &geometry) |
| QRectF | relativeGeometry () const |
| void | setRelativeGeometry (const QRectF &relativeGeometry) |
| int | zoneNumber () const |
| void | setZoneNumber (int number) |
| QColor | highlightColor () const |
| void | setHighlightColor (const QColor &color) |
| QColor | inactiveColor () const |
| void | setInactiveColor (const QColor &color) |
| QColor | borderColor () const |
| void | setBorderColor (const QColor &color) |
| qreal | activeOpacity () const |
| void | setActiveOpacity (qreal opacity) |
| qreal | inactiveOpacity () const |
| void | setInactiveOpacity (qreal opacity) |
| int | borderWidth () const |
| void | setBorderWidth (int width) |
| int | borderRadius () const |
| void | setBorderRadius (int radius) |
| bool | isHighlighted () const |
| void | setHighlighted (bool highlighted) |
| bool | useCustomColors () const |
| void | setUseCustomColors (bool useCustom) |
| int | overlayDisplayMode () const |
| void | setOverlayDisplayMode (int mode) |
| ZoneGeometryMode | geometryMode () const |
| int | geometryModeInt () const |
| bool | isFixedGeometry () const |
| void | setGeometryMode (ZoneGeometryMode mode) |
| void | setGeometryModeInt (int mode) |
| QRectF | fixedGeometry () const |
| void | setFixedGeometry (const QRectF &geometry) |
| QRectF | normalizedGeometry (const QRectF &referenceGeometry) const |
| Returns normalized 0-1 coordinates regardless of geometry mode. | |
| bool | containsPoint (const QPointF &point) const |
| qreal | distanceToPoint (const QPointF &point) const |
| QRectF | calculateAbsoluteGeometry (const QRectF &screenGeometry) const |
| QJsonObject | toJson (const QRectF &referenceGeometry=QRectF()) const |
Static Public Member Functions | |
| static QRectF | sanitizeFixedGeometry (const QRectF &geometry) |
| Normalize a fixedGeometry payload arriving from an untrusted boundary. | |
| static QRectF | computeAbsoluteGeometry (ZoneGeometryMode mode, const QRectF &relativeGeometry, const QRectF &fixedGeometry, const QRectF &screenGeometry) |
| Pure helper shared between Zone::calculateAbsoluteGeometry and LayoutWorker (which runs off-thread and cannot touch QObjects). | |
| static Zone * | fromJson (const QJsonObject &json, QObject *parent=nullptr) |
Represents a single zone within a layout.
A zone is a rectangular area on the screen where windows can be snapped. Zones support custom colors, names, and keyboard shortcuts for ricer-friendly customization.
Note: Zone inherits from QObject and follows Qt's object model. QObjects should NOT be copied - use clone() to create duplicates.
|
explicit |
|
explicit |
|
overridedefault |
|
delete |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
signal |
| QRectF PhosphorZones::Zone::calculateAbsoluteGeometry | ( | const QRectF & | screenGeometry | ) | const |
| Zone * PhosphorZones::Zone::clone | ( | QObject * | parent = nullptr | ) | const |
Creates a copy of this zone with a new unique ID.
| parent | Parent object for the new zone |
|
static |
Pure helper shared between Zone::calculateAbsoluteGeometry and LayoutWorker (which runs off-thread and cannot touch QObjects).
Fixed mode: pixel coords relative to screen origin. Relative mode: 0..1 coords multiplied by screen dimensions.
| bool PhosphorZones::Zone::containsPoint | ( | const QPointF & | point | ) | const |
| void PhosphorZones::Zone::copyPropertiesFrom | ( | const Zone & | other | ) |
Copies properties from another zone (excluding ID)
| other | Source zone to copy from |
| qreal PhosphorZones::Zone::distanceToPoint | ( | const QPointF & | point | ) | const |
|
inline |
|
signal |
|
static |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
inline |
|
signal |
|
signal |
|
inline |
|
inline |
|
signal |
|
inline |
|
signal |
|
inline |
|
inline |
|
inline |
|
signal |
| QRectF PhosphorZones::Zone::normalizedGeometry | ( | const QRectF & | referenceGeometry | ) | const |
Returns normalized 0-1 coordinates regardless of geometry mode.
| referenceGeometry | The screen geometry to normalize against |
For Relative mode: returns relativeGeometry() directly. For Fixed mode: converts fixedGeometry pixel coords to 0-1 relative to referenceGeometry dimensions.
|
inline |
|
signal |
|
inline |
|
signal |
|
static |
Normalize a fixedGeometry payload arriving from an untrusted boundary.
X/Y are pixel offsets from the screen origin and MAY be negative — computeAbsoluteGeometry adds them to the origin verbatim, so a negative offset legitimately places a zone off-screen. Width/height are extents and cannot be negative. A non-finite value has no meaningful clamp (it poisons every later comparison and serializes as JSON null) so it drops to 0, which lands the rect in the degenerate bucket below.
The result is empty (QRectF::isEmpty) when the payload cannot describe a zone that renders. Callers must treat that as "no usable fixed payload" and fall back to Relative rather than storing it: a zero-extent fixed zone normalizes to a zero-extent relativeGeometry, which the layout schema rejects with exclusiveMinimum 0 — and it rejects the WHOLE layout, so storing one turns the next save into a file the loader drops.
Shared by every ingress that accepts the key (Zone::fromJson for files, LayoutAdaptor::updateLayout for D-Bus) so they cannot drift apart.
| void PhosphorZones::Zone::setActiveOpacity | ( | qreal | opacity | ) |
| void PhosphorZones::Zone::setBorderColor | ( | const QColor & | color | ) |
| void PhosphorZones::Zone::setBorderRadius | ( | int | radius | ) |
| void PhosphorZones::Zone::setBorderWidth | ( | int | width | ) |
| void PhosphorZones::Zone::setFixedGeometry | ( | const QRectF & | geometry | ) |
| void PhosphorZones::Zone::setGeometry | ( | const QRectF & | geometry | ) |
| void PhosphorZones::Zone::setGeometryMode | ( | ZoneGeometryMode | mode | ) |
| void PhosphorZones::Zone::setGeometryModeInt | ( | int | mode | ) |
| void PhosphorZones::Zone::setHighlightColor | ( | const QColor & | color | ) |
| void PhosphorZones::Zone::setHighlighted | ( | bool | highlighted | ) |
| void PhosphorZones::Zone::setInactiveColor | ( | const QColor & | color | ) |
| void PhosphorZones::Zone::setInactiveOpacity | ( | qreal | opacity | ) |
| void PhosphorZones::Zone::setName | ( | const QString & | name | ) |
| void PhosphorZones::Zone::setOverlayDisplayMode | ( | int | mode | ) |
| void PhosphorZones::Zone::setRelativeGeometry | ( | const QRectF & | relativeGeometry | ) |
| void PhosphorZones::Zone::setUseCustomColors | ( | bool | useCustom | ) |
| void PhosphorZones::Zone::setZoneNumber | ( | int | number | ) |
| QJsonObject PhosphorZones::Zone::toJson | ( | const QRectF & | referenceGeometry = QRectF() | ) | const |
|
inline |
|
signal |
|
inline |
|
signal |