Hyelicht 2.0
Controller application for the Hyelicht shelf. Paint on the shelf with colors, turn on the fireplace mode, and more.
Loading...
Searching...
No Matches
remoteshelfmodel.h
1/*
2 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
3 * SPDX-FileCopyrightText: 2021-2024 Eike Hein <sho@eikehein.com>
4 */
5
6#pragma once
7
8#include <QIdentityProxyModel>
9#include <QQmlParserStatus>
10#include <QUrl>
11
12class RemoteShelfModelIfaceReplica;
13
14class QAbstractItemModelReplica;
15class QRemoteObjectNode;
16
18
37class RemoteShelfModel : public QIdentityProxyModel, public QQmlParserStatus
38{
39 Q_OBJECT
40 Q_INTERFACES(QQmlParserStatus)
41
42
52
54
58 Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
59
61 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
62
64 Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
66 Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
68 Q_PROPERTY(int density READ density WRITE setDensity NOTIFY densityChanged)
71
73 Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
77
79 Q_PROPERTY(QColor averageColor READ averageColor WRITE setAverageColor NOTIFY averageColorChanged)
83
86
88 Q_PROPERTY(bool animating READ animating WRITE setAnimating NOTIFY animatingChanged)
89
90 public:
92
95 explicit RemoteShelfModel(QObject *parent = nullptr);
96 ~RemoteShelfModel() override;
97
99
105 QUrl serverAddress() const;
106
108
113 void setServerAddress(const QUrl &url);
114
116
120 bool ready() const;
121
123 bool enabled() const;
125 void setEnabled(bool enabled);
126
128 int rows() const;
130 void setRows(int rows);
131
133 int columns() const;
135 void setColumns(int columns);
136
138 int density() const;
139
141 void setDensity(int density);
142
144 int wallThickness() const;
146 void setWallThickness(int thickness);
147
149 qreal brightness() const;
151 void setBrightness(qreal brightness);
153 bool animateBrightnessTransitions() const;
155 void setAnimateBrightnessTransitions(bool animate);
156
158 QColor averageColor() const;
160 void setAverageColor(const QColor &color);
164 void setAnimateAverageColorTransitions(bool animate);
165
167 int transitionDuration() const;
169 void setTransitionDuration(int duration);
170
172 bool animating() const;
174 void setAnimating(bool animating);
175
177 void classBegin() override;
179 void componentComplete() override;
180
181 Q_SIGNALS:
183
186 void readyChanged() const;
187
189
194
196 void enabledChanged() const;
197
199 void rowsChanged() const;
201 void columnsChanged() const;
203 void densityChanged() const;
206
208 void shelfRowsChanged() const;
211
213 void brightnessChanged() const;
216
221
224
226 void animatingChanged() const;
227
228 private:
229 void updateSource();
230
231 bool m_enabled;
232
233 QUrl m_serverAddress;
234 QRemoteObjectNode *m_remotingServer;
235 QAbstractItemModelReplica *m_remoteModel;
236 RemoteShelfModelIfaceReplica *m_remoteModelIface;
237
238 bool m_createdByQml;
239 bool m_complete;
240};
Client for the remoting server provided by ShelfModel.
Definition remoteshelfmodel.h:38
void setBrightness(qreal brightness)
Definition remoteshelfmodel.cpp:157
void componentComplete() override
Implements the QQmlParserStatus interface.
Definition remoteshelfmodel.cpp:261
bool ready
Whether the connection is healthy and remote data is available.
Definition remoteshelfmodel.h:58
void setEnabled(bool enabled)
Definition remoteshelfmodel.cpp:67
void transitionDurationChanged() const
void setAverageColor(const QColor &color)
Definition remoteshelfmodel.cpp:193
void rowsChanged() const
void classBegin() override
Implements the QQmlParserStatus interface.
Definition remoteshelfmodel.cpp:256
void setColumns(int columns)
Definition remoteshelfmodel.cpp:103
QColor averageColor
Definition remoteshelfmodel.h:79
QUrl serverAddress
Address used to connect to a ShelfModel instance.
Definition remoteshelfmodel.h:51
void setAnimateAverageColorTransitions(bool animate)
Definition remoteshelfmodel.cpp:211
void serverAddressChanged() const
The address used to connect to a ShelfModel instance has changed.
void setAnimateBrightnessTransitions(bool animate)
Definition remoteshelfmodel.cpp:175
int wallThickness
Definition remoteshelfmodel.h:70
void columnsChanged() const
int transitionDuration
Definition remoteshelfmodel.h:85
void enabledChanged() const
void brightnessChanged() const
bool animateAverageColorTransitions
Definition remoteshelfmodel.h:82
void readyChanged() const
Whether the connection is healthy and remote data is available.
bool animating
Definition remoteshelfmodel.h:88
int rows
Definition remoteshelfmodel.h:64
qreal brightness
Definition remoteshelfmodel.h:73
void setServerAddress(const QUrl &url)
Set the address used to connect to a ShelfModel instance.
Definition remoteshelfmodel.cpp:38
int columns
Definition remoteshelfmodel.h:66
bool enabled
Definition remoteshelfmodel.h:61
void wallThicknessChanged() const
void densityChanged() const
void setTransitionDuration(int duration)
Definition remoteshelfmodel.cpp:247
bool animateBrightnessTransitions
Definition remoteshelfmodel.h:76
void averageColorChanged() const
void shelfRowsChanged() const
void animatingChanged() const
void animateBrightnessTransitionsChanged() const
void animateAverageColorTransitionsChanged() const
void setDensity(int density)
Definition remoteshelfmodel.cpp:121
void setWallThickness(int thickness)
Definition remoteshelfmodel.cpp:139
int density
Definition remoteshelfmodel.h:68
void setAnimating(bool animating)
Definition remoteshelfmodel.cpp:229
void setRows(int rows)
Definition remoteshelfmodel.cpp:85
void shelfColumnsChanged() const