aboutsummaryrefslogtreecommitdiffstats
path: root/app/audiorole.cpp
blob: 7351d13cace9dfb04e81548938c91382cb25ce10 (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
55
56
#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;
		emit ValueChanged();
	}
}

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

bool AudioRole::EndUpdate()
{
	if (m_Updating > 0) {
		m_Updating--;
		return true;
	}
	return false;
}