From d32d36b936cb031ba1b11c67c0d9c6afbdc280b3 Mon Sep 17 00:00:00 2001 From: Loïc Collignon Date: Tue, 18 Dec 2018 17:16:35 +0100 Subject: Reworked the way qml create sliders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/audiorole.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app/audiorole.hpp (limited to 'app/audiorole.hpp') 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 + +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 -- cgit 1.2.3-korg