Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ParameterPlayer.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include "ParameterPlayer.h"
4
5CParameterPlayer::CParameterPlayer(QObject *parent)
6 : CParameterBase{parent}
7 , m_Type(TYPE::Url)
8 , m_nCamera(-1)
9 , m_nAudioInput(-1)
10 , m_bEnableAudioInput(true)
11 , m_bAudioInputMuted(false)
12 , m_fAudioInputVolume(100)
13 , m_nAudioOutput(-1)
14 , m_bEnableAudioOutput(true)
15 , m_bAudioOutputMuted(false)
16 , m_fAudioOutputVolume(100)
17 , m_nScreen(-1)
18{}
19
20const CParameterPlayer::TYPE CParameterPlayer::GetType() const
21{
22 return m_Type;
23}
24
25int CParameterPlayer::SetType(TYPE type)
26{
27 if(m_Type == type)
28 return 0;
29 m_Type = type;
30 SetModified(true);
31 return 0;
32}
33
34const QString CParameterPlayer::GetUrl() const
35{
36 return m_szUrl;
37}
38
39int CParameterPlayer::SetUrl(const QString& szUrl)
40{
41 if(m_szUrl == szUrl)
42 return 0;
43 SetModified(true);
44 m_szUrl = szUrl;
45 return 0;
46}
47
48const int CParameterPlayer::GetCamera() const
49{
50 return m_nCamera;
51}
52
53int CParameterPlayer::SetCamera(int nIndex)
54{
55 if(m_nCamera == nIndex)
56 return 0;
57 m_nCamera = nIndex;
58 SetModified(true);
59 return 0;
60}
61
62const int CParameterPlayer::GetAudioInput() const
63{
64 return m_nAudioInput;
65}
66
67int CParameterPlayer::SetAudioInput(int nIndex)
68{
69 if(m_nAudioInput == nIndex)
70 return 0;
71 m_nAudioInput = nIndex;
72 SetModified(true);
73 emit sigAudioInput(m_nAudioInput);
74 return 0;
75}
76
77const bool CParameterPlayer::GetEnableAudioInput() const
78{
79 return m_bEnableAudioInput;
80}
81
82int CParameterPlayer::SetEnableAudioInput(bool bEnable)
83{
84 if(m_bEnableAudioInput == bEnable)
85 return 0;
86 m_bEnableAudioInput = bEnable;
87 SetModified(true);
88 emit sigEnableAudioInput(m_bEnableAudioInput);
89 return 0;
90}
91
92const bool CParameterPlayer::GetAudioInputMuted() const
93{
94 return m_bAudioInputMuted;
95}
96
97int CParameterPlayer::SetAudioInputMuted(bool bMuted)
98{
99 if(m_bAudioInputMuted == bMuted)
100 return 0;
101 m_bAudioInputMuted = bMuted;
102 SetModified(true);
103 emit sigAudioInputMuted(m_bAudioInputMuted);
104 return 0;
105}
106
107const float CParameterPlayer::GetAudioInputVolume() const
108{
109 return m_fAudioInputVolume;
110}
111
112int CParameterPlayer::SetAudioInputVolume(float fVolume)
113{
114 if(m_fAudioInputVolume == fVolume)
115 return 0;
116 m_fAudioInputVolume = fVolume;
117 SetModified(true);
118 emit sigAudioInputVolume(m_fAudioInputVolume);
119 return 0;
120}
121
122const int CParameterPlayer::GetAudioOutput() const
123{
124 return m_nAudioOutput;
125}
126
127int CParameterPlayer::SetAudioOutput(int nIndex)
128{
129 if(m_nAudioOutput == nIndex)
130 return 0;
131 m_nAudioOutput = nIndex;
132 SetModified(true);
133 emit sigAudioOutput(m_nAudioOutput);
134 return 0;
135}
136
137const bool CParameterPlayer::GetEnableAudioOutput() const
138{
139 return m_bEnableAudioOutput;
140}
141
142int CParameterPlayer::SetEnableAudioOutput(bool bEnable)
143{
144 if(m_bEnableAudioOutput == bEnable)
145 return 0;
146 m_bEnableAudioOutput = bEnable;
147 SetModified(true);
148 emit sigEnableAudioOutput(bEnable);
149 return 0;
150}
151
152const bool CParameterPlayer::GetAudioOutputMuted() const
153{
154 return m_bAudioOutputMuted;
155}
156
157int CParameterPlayer::SetAudioOutputMuted(bool bMuted)
158{
159 if(m_bAudioOutputMuted == bMuted)
160 return 0;
161 m_bAudioOutputMuted = bMuted;
162 SetModified(true);
163 emit sigAudioOutputMuted(m_bAudioOutputMuted);
164 return 0;
165}
166
167const float CParameterPlayer::GetAudioOutputVolume() const
168{
169 return m_fAudioOutputVolume;
170}
171
172int CParameterPlayer::SetAudioOutputVolume(float fVolume)
173{
174 if(m_fAudioOutputVolume == fVolume)
175 return 0;
176 m_fAudioOutputVolume = fVolume;
177 SetModified(true);
178 emit sigAudioOutputVolume(m_fAudioOutputVolume);
179 return 0;
180}
181int CParameterPlayer::OnLoad(QSettings &set)
182{
183 set.beginGroup("Player");
184 SetType((TYPE)set.value("Type", (int)GetType()).toInt());
185 SetUrl(set.value("Url", GetUrl()).toString());
186 SetCamera(set.value("Camera", GetCamera()).toInt());
187
188 set.beginGroup("Audio/Input");
189 SetAudioInput(set.value("Device", GetAudioInput()).toInt());
190 SetEnableAudioInput(set.value("Enable", GetEnableAudioInput()).toBool());
191 SetAudioInputMuted(set.value("Muted", GetAudioInputMuted()).toBool());
192 SetAudioInputVolume(set.value("Volume", GetAudioInputVolume()).toBool());
193 set.endGroup();
194
195 set.beginGroup("Audio/Output");
196 SetAudioOutput(set.value("Device", GetAudioOutput()).toInt());
197 SetEnableAudioOutput(set.value("Enable", GetEnableAudioOutput()).toBool());
198 SetAudioOutputMuted(set.value("Muted", GetAudioOutputMuted()).toBool());
199 SetAudioOutputVolume(set.value("Volume", GetAudioOutputVolume()).toFloat());
200 set.endGroup();
201
202 set.endGroup();
203 return 0;
204}
205
206int CParameterPlayer::OnSave(QSettings &set)
207{
208 set.beginGroup("Player");
209 set.setValue("Type", (int)GetType());
210 set.setValue("Url", GetUrl());
211 set.setValue("Camera", GetCamera());
212
213 set.beginGroup("Audio/Input");
214 set.setValue("Device", GetAudioInput());
215 set.setValue("Enable", GetEnableAudioInput());
216 set.setValue("Muted", GetAudioInputMuted());
217 set.setValue("Volume", GetAudioInputVolume());
218 set.endGroup();
219
220 set.beginGroup("Audio/Output");
221 set.setValue("Device", GetAudioOutput());
222 set.setValue("Enable", GetEnableAudioOutput());
223 set.setValue("Muted", GetAudioOutputMuted());
224 set.setValue("Volume", GetAudioOutputVolume());
225 set.endGroup();
226
227 set.endGroup();
228 return 0;
229}
230
231const int CParameterPlayer::GetScreen() const
232{
233 return m_nScreen;
234}
235
236int CParameterPlayer::SetScreen(int nIndex)
237{
238 if(m_nScreen == nIndex)
239 return 0;
240 m_nScreen = nIndex;
241 SetModified(true);
242 return 0;
243}
The interface of connecter parameters.
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.