7#include "phosphorzones_export.h"
46class PHOSPHORZONES_EXPORT
Zone :
public QObject
50 Q_PROPERTY(QUuid
id READ
id CONSTANT)
70 explicit Zone(QObject* parent =
nullptr);
83 Q_INVOKABLE
Zone*
clone(QObject* parent =
nullptr)
const;
112 return m_relativeGeometry;
126 return m_highlightColor;
132 return m_inactiveColor;
138 return m_borderColor;
144 return m_activeOpacity;
150 return m_inactiveOpacity;
156 return m_borderWidth;
162 return m_borderRadius;
168 return m_isHighlighted;
174 return m_useCustomColors;
180 return m_overlayDisplayMode;
187 return m_geometryMode;
191 return static_cast<int>(m_geometryMode);
202 return m_fixedGeometry;
243 Q_INVOKABLE QRectF
normalizedGeometry(
const QRectF& referenceGeometry, qreal screenScale = 0.0)
const;
277 qreal fixedDivisor = 1.0);
280 QJsonObject
toJson(
const QRectF& referenceGeometry = QRectF())
const;
281 static Zone*
fromJson(
const QJsonObject& json, QObject* parent =
nullptr);
305 QRectF m_relativeGeometry;
306 int m_zoneNumber = 0;
316 bool m_isHighlighted =
false;
317 bool m_useCustomColors =
false;
318 int m_overlayDisplayMode = -1;
322 QRectF m_fixedGeometry;
QRectF fixedGeometry() const
Definition Zone.h:200
void setRelativeGeometry(const QRectF &relativeGeometry)
bool useCustomColors() const
Definition Zone.h:172
void setGeometry(const QRectF &geometry)
static QRectF fixedGeometryToLogical(const QRectF &fixedGeometry, qreal divisor)
fixedGeometry in logical units: every component divided by divisor, a non-positive one reading as 1....
void setActiveOpacity(qreal opacity)
static QRectF sanitizeFixedGeometry(const QRectF &geometry)
Normalize a fixedGeometry payload arriving from an untrusted boundary.
QColor highlightColor() const
Definition Zone.h:124
void geometryModeChanged()
QColor inactiveColor() const
Definition Zone.h:130
void setInactiveColor(const QColor &color)
Zone(const QRectF &geometry, QObject *parent=nullptr)
void inactiveOpacityChanged()
ZoneGeometryMode geometryMode() const
Definition Zone.h:185
int overlayDisplayMode() const
Definition Zone.h:178
static QRectF computeAbsoluteGeometry(ZoneGeometryMode mode, const QRectF &relativeGeometry, const QRectF &fixedGeometry, const QRectF &screenGeometry, qreal fixedDivisor=1.0)
Pure helper shared between Zone::calculateAbsoluteGeometry and LayoutWorker (which runs off-thread an...
qreal distanceToPoint(const QPointF &point) const
int zoneNumber() const
Definition Zone.h:117
void setGeometryMode(ZoneGeometryMode mode)
QRectF relativeGeometry() const
Definition Zone.h:110
void borderColorChanged()
void setBorderColor(const QColor &color)
int geometryModeInt() const
Definition Zone.h:189
int borderRadius() const
Definition Zone.h:160
QString name() const
Definition Zone.h:96
void borderRadiusChanged()
Zone(const Zone &)=delete
void relativeGeometryChanged()
void setZoneNumber(int number)
void useCustomColorsChanged()
bool isHighlighted() const
Definition Zone.h:166
void inactiveColorChanged()
int borderWidth() const
Definition Zone.h:154
Zone & operator=(const Zone &)=delete
void copyPropertiesFrom(const Zone &other)
Copies properties from another zone (excluding ID).
void setName(const QString &name)
QRectF calculateAbsoluteGeometry(const QRectF &screenGeometry, qreal screenScale=0.0) const
screenScale as normalizedGeometry() takes it.
bool containsPoint(const QPointF &point) const
void setHighlightColor(const QColor &color)
Zone(QObject *parent=nullptr)
qreal fixedGeometryDivisor(qreal screenScale) const
What this zone's fixed geometry is divided by on an output of logical scale screenScale: its layout's...
void setGeometryModeInt(int mode)
static Zone * fromJson(const QJsonObject &json, QObject *parent=nullptr)
void setBorderWidth(int width)
QRectF normalizedGeometry(const QRectF &referenceGeometry, qreal screenScale=0.0) const
Returns normalized 0-1 coordinates regardless of geometry mode.
void overlayDisplayModeChanged()
void setFixedGeometry(const QRectF &geometry)
void highlightColorChanged()
void borderWidthChanged()
bool isFixedGeometry() const
Definition Zone.h:193
QColor borderColor() const
Definition Zone.h:136
void setHighlighted(bool highlighted)
void setBorderRadius(int radius)
QUuid id() const
Definition Zone.h:92
QRectF geometry() const
Definition Zone.h:103
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:142
void setInactiveOpacity(qreal opacity)
qreal inactiveOpacity() const
Definition Zone.h:148
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:24
ZoneGeometryMode
Geometry mode for individual zones.
Definition Zone.h:31
@ Relative
Definition Zone.h:32
@ Fixed
Definition Zone.h:33