diff options
author | Loïc Collignon <loic.collignon@iot.bzh> | 2018-12-18 17:16:35 +0100 |
---|---|---|
committer | Loïc Collignon [ IoT.bzh ] <loic.collignon@iot.bzh> | 2018-12-19 10:06:56 +0000 |
commit | d32d36b936cb031ba1b11c67c0d9c6afbdc280b3 (patch) | |
tree | a5a09e31bb41ced3ddea5dddf92530d187da4341 /app/audiorole.hpp | |
parent | f8da591c53f17df877e354896dbbf18410c53b6c (diff) |
Reworked the way qml create sliders
Use the qml MVC to populate a ListView with components based on a template
VolumeSlider. Should now handle potential disconnections, volume changes
by third-party and also fix the issue where sliders are set to 0 at
startup.
Change-Id: I2961d5a1584a121c473ece253faa90a747c64445
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'app/audiorole.hpp')
-rw-r--r-- | app/audiorole.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/audiorole.hpp b/app/audiorole.hpp new file mode 100644 index 0000000..afc3665 --- /dev/null +++ b/app/audiorole.hpp @@ -0,0 +1,38 @@ +#ifndef AUDIOROLE_H +#define AUDIOROLE_H + +#include <QObject> + +class AudioRole + : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString name READ Name WRITE setName NOTIFY NameChanged) + Q_PROPERTY(int value READ Value WRITE setValue NOTIFY ValueChanged) + +private: + QString m_Name; + int m_Value; + int m_Updating; + +public: + explicit AudioRole(QObject* parent = nullptr); + explicit AudioRole(const QString& name, int value, QObject* parent = nullptr); + + QString Name() const; + void setName(const QString& name); + + int Value() const; + void setValue(int value); + + void BeginUpdate(); + void EndUpdate(); + +signals: + void NameChanged(); + void ValueChanged(); + +public slots: +}; + +#endif // AUDIOROLE_H |