summaryrefslogtreecommitdiffstats
path: root/app/audiorole.cpp
blob: 5fad48f0db62859fd3c384a67bf61ba06ee1ad6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "audiorole.hpp"

AudioRole::AudioRole(QObject* parent)
	: QObject(parent)
	, m_Name{""}
	, m_Value{0}
	, m_Updating{0}
{
}

AudioRole::AudioRole(const QString& name, int value, QObject* parent)
	: QObject(parent)
	, m_Name{name}
	, m_Value{value}
	, m_Updating{0}
{
}

QString AudioRole::Name() const
{
	return m_Name;
}

void AudioRole::setName(const QString& name)
{
	m_Name = name;
	emit NameChanged();
}

int AudioRole::Value() const
{
	return m_Value;
}

void AudioRole::setValue(int value)
{
	if (m_Value != value)
	{
		m_Value = value;
		if (m_Updating == 0)
			emit ValueChanged();
	}
}

void AudioRole::BeginUpdate()
{
	m_Updating++;
}

void AudioRole::EndUpdate()
{
	if (m_Updating > 0) m_Updating--;
	//if (m_Updating == 0) emit ValueChanged();
}