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