Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ParameterServiceFreeRDP.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include "ParameterServiceFreeRDP.h"
4#include <QSettings>
5
6CParameterServiceFreeRDP::CParameterServiceFreeRDP(QObject *parent)
7 : CParameterService(parent),
8 m_bTlsSecurity(true),
9 m_bRdpSecurity(true),
10 m_bNlaSecurity(false),
11 m_bNlaExtSecurity(false),
12 #ifdef WITH_SHADOW_X11
13 m_bAuthentication(true),
14 #else
15 m_bAuthentication(false),
16 #endif
17 m_MayView(true),
18 m_MayInteract(true)
19{
20 setPort(3389);
21}
22
23bool CParameterServiceFreeRDP::getTlsSecurity() const
24{
25 return m_bTlsSecurity;
26}
27
28void CParameterServiceFreeRDP::setTlsSecurity(bool newTlsSecurity)
29{
30 if (m_bTlsSecurity == newTlsSecurity)
31 return;
32 m_bTlsSecurity = newTlsSecurity;
33 emit sigTlsSecurityChanged();
34}
35
36bool CParameterServiceFreeRDP::getRdpSecurity() const
37{
38 return m_bRdpSecurity;
39}
40
41void CParameterServiceFreeRDP::setRdpSecurity(bool newRdpSecurity)
42{
43 if (m_bRdpSecurity == newRdpSecurity)
44 return;
45 m_bRdpSecurity = newRdpSecurity;
46 emit sigRdpSecurityChanged();
47}
48
49bool CParameterServiceFreeRDP::getNlaSecurity() const
50{
51 return m_bNlaSecurity;
52}
53
54void CParameterServiceFreeRDP::setNlaSecurity(bool newNlaSecurity)
55{
56 if (m_bNlaSecurity == newNlaSecurity)
57 return;
58 m_bNlaSecurity = newNlaSecurity;
59 emit sigNlaecurityChanged();
60}
61
62bool CParameterServiceFreeRDP::getNlaExtSecurity() const
63{
64 return m_bNlaExtSecurity;
65}
66
67void CParameterServiceFreeRDP::setNlaExtSecurity(bool newNlaExtSecurity)
68{
69 if (m_bNlaExtSecurity == newNlaExtSecurity)
70 return;
71 m_bNlaExtSecurity = newNlaExtSecurity;
72 emit sigNlaExtSecurityChanged();
73}
74
75bool CParameterServiceFreeRDP::getAuthentication() const
76{
77 return m_bAuthentication;
78}
79
80void CParameterServiceFreeRDP::setAuthentication(bool newAuthentication)
81{
82 if (m_bAuthentication == newAuthentication)
83 return;
84 m_bAuthentication = newAuthentication;
85 emit sigAuthenticationChanged();
86}
87
88bool CParameterServiceFreeRDP::getMayView() const
89{
90 return m_MayView;
91}
92
93void CParameterServiceFreeRDP::setMayView(bool newMayView)
94{
95 if (m_MayView == newMayView)
96 return;
97 m_MayView = newMayView;
98 emit sigMayViewChanged();
99}
100
101bool CParameterServiceFreeRDP::getMayInteract() const
102{
103 return m_MayInteract;
104}
105
106void CParameterServiceFreeRDP::setMayInteract(bool newMayInteract)
107{
108 if (m_MayInteract == newMayInteract)
109 return;
110 m_MayInteract = newMayInteract;
111 emit sigMayInteractChanged();
112}
113
114const QString &CParameterServiceFreeRDP::getSamFile() const
115{
116 return m_szSamFile;
117}
118
119void CParameterServiceFreeRDP::setSamFile(const QString &newSamFile)
120{
121 if (m_szSamFile == newSamFile)
122 return;
123 m_szSamFile = newSamFile;
124 emit sigSamFileChanged();
125}
126
127int CParameterServiceFreeRDP::Load(const QString &szFile)
128{
129 QSettings set(szFile, QSettings::IniFormat);
130
131 setTlsSecurity(set.value("Security/Tls", getTlsSecurity()).toBool());
132 setRdpSecurity(set.value("Security/Rdp", getRdpSecurity()).toBool());
133 setNlaSecurity(set.value("Security/Nla", getNlaSecurity()).toBool());
134 setNlaExtSecurity(set.value("Security/NlaExt", getNlaExtSecurity()).toBool());
135 setSamFile(set.value("Security/Nla/SamFIle", getSamFile()).toString());
136
137 setAuthentication(set.value("Server/Authentication", getAuthentication()).toBool());
138 setMayView(set.value("Server/MayView", getMayView()).toBool());
139 setMayInteract(set.value("Server/MayInteract", getMayInteract()).toBool());
140 return CParameterService::Load(szFile);
141}
142
143int CParameterServiceFreeRDP::Save(const QString &szFile)
144{
145 QSettings set(szFile, QSettings::IniFormat);
146
147 set.setValue("Security/Tls", getTlsSecurity());
148 set.setValue("Security/Rdp", getRdpSecurity());
149 set.setValue("Security/Nla", getNlaSecurity());
150 set.setValue("Security/NlaExt", getNlaExtSecurity());
151 set.setValue("Security/Nla/SamFIle", getSamFile());
152
153 set.setValue("Server/Authentication", getAuthentication());
154 set.setValue("Server/MayView", getMayView());
155 set.setValue("Server/MayInteract", getMayInteract());
156
157 return CParameterService::Save(szFile);
158}