Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ParameterFreeRDP.cpp
1#include "ParameterFreeRDP.h"
2#include <QSettings>
3
4CParameterFreeRDP::CParameterFreeRDP(QObject *parent)
5 : CParameterBase(parent),
6 m_nWidth(1024),
7 m_nHeight(768),
8 m_nColorDepth(32),
9 m_bUseMultimon(false),
10 m_nReconnectInterval(0),
11 m_bShowVerifyDiaglog(true),
12 m_bRedirectionPrinter(false),
13 m_nRedirectionSound(RedirecionSoundType::Disable),
14 m_bRedirectionMicrophone(false),
15 m_Proxy(this)
16{
17 m_Net.SetPort(3389);
18
19 m_Proxy.SetType(
20 QList<CParameterProxy::TYPE>() << CParameterProxy::TYPE::None
21 << CParameterProxy::TYPE::SSHTunnel);
22
23 m_szRedirectionSoundParameters =
24 #if defined (Q_OS_WINDOWS) || defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_WINRT)
25 "sys:winmm"
26 #elif defined(Q_OS_IOS)
27 "sys:ios"
28 #elif defined (Q_OS_ANDROID)
29 "sys:opensles"
30 #elif defined (Q_OS_LINUX) || defined (Q_OS_UNIX)
31 "sys:alsa"
32 #endif
33 ;
34 m_szRedirectionMicrophoneParameters = m_szRedirectionSoundParameters;
35}
36
37int CParameterFreeRDP::OnLoad(QSettings &set)
38{
39 CParameterBase::OnLoad(set);
40
41 set.beginGroup("FreeRDP");
42 SetDomain(set.value("Domain", GetDomain()).toString());
43 SetDesktopWidth(set.value("Width", GetDesktopWidth()).toInt());
44 SetDesktopHeight(set.value("Height", GetDesktopHeight()).toInt());
45 SetColorDepth(set.value("ColorDepth", GetColorDepth()).toInt());
46 SetUseMultimon(set.value("UseMultimon", GetUseMultimon()).toBool());
47 SetReconnectInterval(set.value("ReconnectionInterval",
48 GetReconnectInterval()).toInt());
49
50 SetShowVerifyDiaglog(set.value("ShowVerifyDiaglog",
51 GetShowVerifyDiaglog()).toBool());
52
53 SetRedirectionPrinter(set.value("Redirection/Printer",
54 GetRedirectionPrinter()).toBool());
55 SetRedirectionSound(static_cast<RedirecionSoundType>(set.value("Redirection/Sound",
56 static_cast<int>(GetRedirectionSound())).toInt()));
57 SetRedirectionSoundParameters(set.value("Redirection/Sound/Parameters",
58 GetRedirectionSoundParameters()).toString());
59 SetRedirectionMicrophone(set.value("Redirection/Microphone",
60 GetRedirectionMicrophone()).toBool());
61 SetRedirectionMicrophoneParameters(set.value("Redirection/Microphone/Parameters",
62 GetRedirectionMicrophoneParameters()).toString());
63 SetRedirectionDrives(set.value("Redirection/Drive").toStringList());
64 set.endGroup();
65
66 return 0;
67}
68
69int CParameterFreeRDP::OnSave(QSettings &set)
70{
71 CParameterBase::OnSave(set);
72
73 set.beginGroup("FreeRDP");
74 set.setValue("Domain", GetDomain());
75 set.setValue("Width", GetDesktopWidth());
76 set.setValue("Height", GetDesktopHeight());
77 set.setValue("ColorDepth", GetColorDepth());
78 set.setValue("UseMultimon", GetUseMultimon());
79
80 set.setValue("ReconnectionInterval", GetReconnectInterval());
81 set.setValue("ShowVerifyDiaglog", GetShowVerifyDiaglog());
82
83 set.setValue("Redirection/Printer", GetRedirectionPrinter());
84 set.setValue("Redirection/Sound", static_cast<int>(GetRedirectionSound()));
85 set.setValue("Redirection/Sound/Parameters", GetRedirectionSoundParameters());
86 set.setValue("Redirection/Microphone", GetRedirectionMicrophone());
87 set.setValue("Redirection/Microphone/Parameters", GetRedirectionMicrophoneParameters());
88 set.setValue("Redirection/Drive", GetRedirectionDrives());
89 set.endGroup();
90
91 return 0;
92}
93
94UINT32 CParameterFreeRDP::GetDesktopWidth() const
95{
96 return m_nWidth;
97}
98
99int CParameterFreeRDP::SetDesktopWidth(UINT32 nWidth)
100{
101 if(m_nWidth == nWidth)
102 return 0;
103 m_nWidth = nWidth;
104 SetModified(true);
105 return 0;
106}
107
108UINT32 CParameterFreeRDP::GetDesktopHeight() const
109{
110 return m_nHeight;
111}
112
113int CParameterFreeRDP::SetDesktopHeight(UINT32 nHeight)
114{
115 if(m_nHeight == nHeight)
116 return 0;
117 m_nHeight = nHeight;
118 SetModified(true);
119 return 0;
120}
121
122UINT32 CParameterFreeRDP::GetColorDepth() const
123{
124 return m_nColorDepth;
125}
126
127int CParameterFreeRDP::SetColorDepth(UINT32 color)
128{
129 if(m_nColorDepth == color)
130 return 0;
131 m_nColorDepth = color;
132 SetModified(true);
133 return 0;
134}
135
136bool CParameterFreeRDP::GetUseMultimon() const
137{
138 return m_bUseMultimon;
139}
140
141int CParameterFreeRDP::SetUseMultimon(bool bUse)
142{
143 if(m_bUseMultimon == bUse)
144 return 0;
145 m_bUseMultimon = bUse;
146 SetModified(true);
147 return 0;
148}
149
150UINT CParameterFreeRDP::GetReconnectInterval() const
151{
152 return m_nReconnectInterval;
153}
154
155void CParameterFreeRDP::SetReconnectInterval(UINT newReconnectInterval)
156{
157 if (m_nReconnectInterval == newReconnectInterval)
158 return;
159
160 m_nReconnectInterval = newReconnectInterval;
161 SetModified(true);
162 emit sigReconnectIntervalChanged();
163}
164
165bool CParameterFreeRDP::GetShowVerifyDiaglog() const
166{
167 return m_bShowVerifyDiaglog;
168}
169
170void CParameterFreeRDP::SetShowVerifyDiaglog(bool bShow)
171{
172 if(m_bShowVerifyDiaglog == bShow)
173 return;
174 m_bShowVerifyDiaglog = bShow;
175 SetModified(true);
176}
177
178CParameterFreeRDP::RedirecionSoundType CParameterFreeRDP::GetRedirectionSound() const
179{
180 return m_nRedirectionSound;
181}
182
183void CParameterFreeRDP::SetRedirectionSound(RedirecionSoundType newRedirectionSound)
184{
185 if (m_nRedirectionSound == newRedirectionSound)
186 return;
187 m_nRedirectionSound = newRedirectionSound;
188 SetModified(true);
189 emit sigRedirectionSoundChanged(m_nRedirectionSound);
190}
191
192bool CParameterFreeRDP::GetRedirectionMicrophone() const
193{
194 return m_bRedirectionMicrophone;
195}
196
197void CParameterFreeRDP::SetRedirectionMicrophone(bool newRedirectionMicrophone)
198{
199 if (m_bRedirectionMicrophone == newRedirectionMicrophone)
200 return;
201 m_bRedirectionMicrophone = newRedirectionMicrophone;
202 SetModified(true);
203 emit sigRedirectionMicrophoneChanged(m_bRedirectionMicrophone);
204}
205
206QStringList CParameterFreeRDP::GetRedirectionDrives() const
207{
208 return m_lstRedirectionDrives;
209}
210
211void CParameterFreeRDP::SetRedirectionDrives(const QStringList &newRedirectionDrive)
212{
213 if (m_lstRedirectionDrives == newRedirectionDrive)
214 return;
215 m_lstRedirectionDrives = newRedirectionDrive;
216 SetModified(true);
217 emit sigRedirectionDrivesChanged(m_lstRedirectionDrives);
218}
219
220bool CParameterFreeRDP::GetRedirectionPrinter() const
221{
222 return m_bRedirectionPrinter;
223}
224
225void CParameterFreeRDP::SetRedirectionPrinter(bool newRedirectionPrinter)
226{
227 if (m_bRedirectionPrinter == newRedirectionPrinter)
228 return;
229 m_bRedirectionPrinter = newRedirectionPrinter;
230 SetModified(true);
231 emit sigRedirectionPrinterChanged(m_bRedirectionPrinter);
232}
233
234const QString &CParameterFreeRDP::GetRedirectionSoundParameters() const
235{
236 return m_szRedirectionSoundParameters;
237}
238
239void CParameterFreeRDP::SetRedirectionSoundParameters(const QString &newRedirectionSoundParameters)
240{
241 if (m_szRedirectionSoundParameters == newRedirectionSoundParameters)
242 return;
243 m_szRedirectionSoundParameters = newRedirectionSoundParameters;
244 SetModified(true);
245 emit sigRedirectionSoundParametersChanged();
246}
247
248const QString &CParameterFreeRDP::GetRedirectionMicrophoneParameters() const
249{
250 return m_szRedirectionMicrophoneParameters;
251}
252
253void CParameterFreeRDP::SetRedirectionMicrophoneParameters(const QString &newRedirectionMicrophoneParameters)
254{
255 if (m_szRedirectionMicrophoneParameters == newRedirectionMicrophoneParameters)
256 return;
257 m_szRedirectionMicrophoneParameters = newRedirectionMicrophoneParameters;
258 SetModified(true);
259 emit sigRedirectionMicrophoneParametersChanged();
260}
261
262void CParameterFreeRDP::SetDomain(const QString& szDomain)
263{
264 if(m_szDomain == szDomain)
265 return;
266 m_szDomain = szDomain;
267 SetModified(true);
268}
269
270const QString CParameterFreeRDP::GetDomain() const
271{
272 return m_szDomain;
273}
The interface of connecter parameters.
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.