7351d13cace9dfb04e81548938c91382cb25ce10
[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                 emit ValueChanged();
41         }
42 }
43
44 void AudioRole::BeginUpdate()
45 {
46         m_Updating++;
47 }
48
49 bool AudioRole::EndUpdate()
50 {
51         if (m_Updating > 0) {
52                 m_Updating--;
53                 return true;
54         }
55         return false;
56 }