aboutsummaryrefslogtreecommitdiffstats
path: root/app/audiorole.hpp
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-12-18 17:16:35 +0100
committerLoïc Collignon <loic.collignon@iot.bzh>2018-12-19 18:26:34 +0100
commit449ae663fadf654bbe46f6e4c927a60e8d1a61bb (patch)
tree4cb17287002965e1f661ff521221d607982caea7 /app/audiorole.hpp
parent34ff9f8c02a90fa0cce8ee6c1d4b87c300771bdc (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.hpp38
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