5fad48f0db62859fd3c384a67bf61ba06ee1ad6d
[apps/mixer.git] / app / audiorole.cpp
1 #include "audiorole.hpp"
2
3 AudioRole::AudioRole(QObject* parent)
4         : QObject(parent)
5         , m_Name{""}
6         , m_Value{0}
7         , m_Updating{0}
8 {
9 }
10
11 AudioRole::AudioRole(const QString& name, int value, QObject* parent)
12         : QObject(parent)
13         , m_Name{name}
14         , m_Value{value}
15         , m_Updating{0}
16 {
17 }
18
19 QString AudioRole::Name() const
20 {
21         return m_Name;
22 }
23
24 void AudioRole::setName(const QString& name)
25 {
26         m_Name = name;
27         emit NameChanged();
28 }
29
30 int AudioRole::Value() const
31 {
32         return m_Value;
33 }
34
35 void AudioRole::setValue(int value)
36 {
37         if (m_Value != value)
38         {
39                 m_Value = value;
40                 if (m_Updating == 0)
41                         emit ValueChanged();
42         }
43 }
44
45 void AudioRole::BeginUpdate()
46 {
47         m_Updating++;
48 }
49
50 void AudioRole::EndUpdate()
51 {
52         if (m_Updating > 0) m_Updating--;
53         //if (m_Updating == 0) emit ValueChanged();
54 }