7#include <phosphorzones_export.h>
43class PHOSPHORZONES_EXPORT
Zone :
public QObject
47 Q_PROPERTY(QUuid
id READ
id CONSTANT)
48 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
49 Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged)
50 Q_PROPERTY(QRectF relativeGeometry READ relativeGeometry WRITE setRelativeGeometry NOTIFY relativeGeometryChanged)
51 Q_PROPERTY(
int zoneNumber READ zoneNumber WRITE setZoneNumber NOTIFY zoneNumberChanged)
52 Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor NOTIFY highlightColorChanged)
53 Q_PROPERTY(QColor inactiveColor READ inactiveColor WRITE setInactiveColor NOTIFY inactiveColorChanged)
54 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
55 Q_PROPERTY(qreal activeOpacity READ activeOpacity WRITE setActiveOpacity NOTIFY activeOpacityChanged)
56 Q_PROPERTY(qreal inactiveOpacity READ inactiveOpacity WRITE setInactiveOpacity NOTIFY inactiveOpacityChanged)
57 Q_PROPERTY(
int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
58 Q_PROPERTY(
int borderRadius READ borderRadius WRITE setBorderRadius NOTIFY borderRadiusChanged)
59 Q_PROPERTY(
bool isHighlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged)
60 Q_PROPERTY(
bool useCustomColors READ useCustomColors WRITE setUseCustomColors NOTIFY useCustomColorsChanged)
62 int overlayDisplayMode READ overlayDisplayMode WRITE setOverlayDisplayMode NOTIFY overlayDisplayModeChanged)
63 Q_PROPERTY(
int geometryMode READ geometryModeInt WRITE setGeometryModeInt NOTIFY geometryModeChanged)
64 Q_PROPERTY(QRectF fixedGeometry READ fixedGeometry WRITE setFixedGeometry NOTIFY fixedGeometryChanged)
67 explicit Zone(QObject* parent =
nullptr);
68 explicit Zone(
const QRectF& geometry, QObject* parent =
nullptr);
80 Q_INVOKABLE
Zone*
clone(QObject* parent =
nullptr)
const;
109 return m_relativeGeometry;
123 return m_highlightColor;
129 return m_inactiveColor;
135 return m_borderColor;
141 return m_activeOpacity;
147 return m_inactiveOpacity;
153 return m_borderWidth;
159 return m_borderRadius;
165 return m_isHighlighted;
171 return m_useCustomColors;
177 return m_overlayDisplayMode;
184 return m_geometryMode;
188 return static_cast<int>(m_geometryMode);
192 return m_geometryMode == ZoneGeometryMode::Fixed;
199 return m_fixedGeometry;
227 const QRectF& fixedGeometry,
const QRectF& screenGeometry);
230 QJsonObject
toJson(
const QRectF& referenceGeometry = QRectF())
const;
231 static Zone*
fromJson(
const QJsonObject& json, QObject* parent =
nullptr);
255 QRectF m_relativeGeometry;
256 int m_zoneNumber = 0;
266 bool m_isHighlighted =
false;
267 bool m_useCustomColors =
false;
268 int m_overlayDisplayMode = -1;
272 QRectF m_fixedGeometry;
Represents a single zone within a layout.
Definition Zone.h:44
QRectF fixedGeometry() const
Definition Zone.h:197
void setRelativeGeometry(const QRectF &relativeGeometry)
bool useCustomColors() const
Definition Zone.h:169
void setGeometry(const QRectF &geometry)
void setActiveOpacity(qreal opacity)
QColor highlightColor() const
Definition Zone.h:121
void geometryModeChanged()
QColor inactiveColor() const
Definition Zone.h:127
void setInactiveColor(const QColor &color)
Zone(const QRectF &geometry, QObject *parent=nullptr)
void inactiveOpacityChanged()
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 an...
ZoneGeometryMode geometryMode() const
Definition Zone.h:182
int overlayDisplayMode() const
Definition Zone.h:175
qreal distanceToPoint(const QPointF &point) const
int zoneNumber() const
Definition Zone.h:114
QRectF calculateAbsoluteGeometry(const QRectF &screenGeometry) const
void setGeometryMode(ZoneGeometryMode mode)
QRectF relativeGeometry() const
Definition Zone.h:107
void borderColorChanged()
QRectF normalizedGeometry(const QRectF &referenceGeometry) const
Returns normalized 0-1 coordinates regardless of geometry mode.
void setBorderColor(const QColor &color)
int geometryModeInt() const
Definition Zone.h:186
int borderRadius() const
Definition Zone.h:157
QString name() const
Definition Zone.h:93
void borderRadiusChanged()
Zone(const Zone &)=delete
void relativeGeometryChanged()
void setZoneNumber(int number)
void useCustomColorsChanged()
bool isHighlighted() const
Definition Zone.h:163
void inactiveColorChanged()
int borderWidth() const
Definition Zone.h:151
Zone & operator=(const Zone &)=delete
void copyPropertiesFrom(const Zone &other)
Copies properties from another zone (excluding ID)
void setName(const QString &name)
QRectF applyPadding(int padding) const
bool containsPoint(const QPointF &point) const
void setHighlightColor(const QColor &color)
Zone(QObject *parent=nullptr)
void setGeometryModeInt(int mode)
static Zone * fromJson(const QJsonObject &json, QObject *parent=nullptr)
void setBorderWidth(int width)
void overlayDisplayModeChanged()
void setFixedGeometry(const QRectF &geometry)
void highlightColorChanged()
void borderWidthChanged()
bool isFixedGeometry() const
Definition Zone.h:190
QColor borderColor() const
Definition Zone.h:133
void setHighlighted(bool highlighted)
void setBorderRadius(int radius)
QUuid id() const
Definition Zone.h:89
QRectF geometry() const
Definition Zone.h:100
QJsonObject toJson(const QRectF &referenceGeometry=QRectF()) const
void highlightedChanged()
void setOverlayDisplayMode(int mode)
void setUseCustomColors(bool useCustom)
void activeOpacityChanged()
Zone * clone(QObject *parent=nullptr) const
Creates a copy of this zone with a new unique ID.
void fixedGeometryChanged()
qreal activeOpacity() const
Definition Zone.h:139
void setInactiveOpacity(qreal opacity)
qreal inactiveOpacity() const
Definition Zone.h:145
const QColor HighlightColor
Windows blue.
Definition ZoneDefaults.h:29
constexpr int BorderRadius
Definition ZoneDefaults.h:38
const QColor InactiveColor
Definition ZoneDefaults.h:30
constexpr qreal Opacity
Definition ZoneDefaults.h:35
constexpr int BorderWidth
Definition ZoneDefaults.h:37
constexpr qreal InactiveOpacity
Definition ZoneDefaults.h:36
const QColor BorderColor
Definition ZoneDefaults.h:31
Definition IWindowTrackingService.h:22
ZoneGeometryMode
Geometry mode for individual zones.
Definition Zone.h:28