Rabbit Remote Control 0.0.33
Loading...
Searching...
No Matches
ParameterClient.cpp
1#include "ParameterClient.h"
2
3CParameterClient::CParameterClient(QObject *parent)
4 : CParameter(parent)
5 , m_bHookKeyboard(false)
6 , m_bHookShowAdministratorPrivilege(true)
7 , m_bEnableSystemUserToUser(true)
8 , m_bSavePassword(false)
9 , m_PromptType(PromptType::No)
10 , m_nPromptCount(0)
11 , m_bViewPassowrd(false)
12 , m_bShowProtocolPrefix(false)
13 , m_bShowIpPortInName(false)
14 , m_AdaptWindows(CFrmViewer::ADAPT_WINDOWS::ZoomToWindow)
15 , m_Record(this)
16{}
17
18CParameterClient::~CParameterClient()
19{}
20
21int CParameterClient::OnLoad(QSettings &set)
22{
23 // Note: SetShowHookAdministratorPrivilege must precede SetHookKeyboard
24 SetHookShowAdministratorPrivilege(
25 set.value("Client/Hook/ShowAdministratorPrivilege",
26 GetHookShowAdministratorPrivilege()).toBool());
27 SetHookKeyboard(set.value("Client/Hook/Keyboard",
28 GetHookKeyboard()).toBool());
29 SetEnableSystemUserToUser(set.value("Client/UserName/Enable",
30 GetEnableSystemUserToUser()).toBool());
31 SetPromptType(static_cast<PromptType>(
32 set.value("Client/Password/Prompty/Type",
33 static_cast<int>(GetPromptType())).toInt()
34 ));
35 SetSavePassword(set.value("Client/Password/Save", GetSavePassword()).toBool());
36 SetViewPassowrd(set.value("Client/Password/View", GetViewPassowrd()).toBool());
37 SetShowProtocolPrefix(set.value("Client/Connecter/Name/ShowProtocolPrefix", GetShowProtocolPrefix()).toBool());
38 SetShowIpPortInName(set.value("Client/Connecter/Name/ShowIpPort", GetShowIpPortInName()).toBool());
39 SetAdaptWindows((CFrmViewer::ADAPT_WINDOWS)set.value("Client/Viewer/AdaptWindows",
40 (int)GetAdaptWindows()).toInt());
41 return 0;
42}
43
44int CParameterClient::OnSave(QSettings& set)
45{
46 set.setValue("Client/Hook/Keyboard", GetHookKeyboard());
47 set.setValue("Client/Hook/ShowAdministratorPrivilege", GetHookShowAdministratorPrivilege());
48 set.setValue("Client/UserName/Enable", GetEnableSystemUserToUser());
49 set.setValue("Client/Password/Prompty/Type",
50 static_cast<int>(GetPromptType()));
51 set.setValue("Client/Password/Save", GetSavePassword());
52 set.setValue("Client/Password/View", GetViewPassowrd());
53 set.setValue("Client/Connecter/Name/ShowProtocolPrefix", GetShowProtocolPrefix());
54 set.setValue("Client/Connecter/Name/ShowIpPort", GetShowIpPortInName());
55 set.setValue("Client/Viewer/AdaptWindows", (int)GetAdaptWindows());
56 return 0;
57}
58
59bool CParameterClient::GetHookKeyboard() const
60{
61 return m_bHookKeyboard;
62}
63
64void CParameterClient::SetHookKeyboard(bool newHookKeyboard)
65{
66 if (m_bHookKeyboard == newHookKeyboard)
67 return;
68 SetModified(true);
69 m_bHookKeyboard = newHookKeyboard;
70 emit sigHookKeyboardChanged();
71}
72
73bool CParameterClient::GetHookShowAdministratorPrivilege()
74{
75 return m_bHookShowAdministratorPrivilege;
76}
77
78void CParameterClient::SetHookShowAdministratorPrivilege(bool bShow)
79{
80 if(bShow == m_bHookShowAdministratorPrivilege)
81 return;
82 SetModified(true);
83 m_bHookShowAdministratorPrivilege = bShow;
84 emit sigHookShowAdministratorPrivilege();
85}
86
87bool CParameterClient::GetEnableSystemUserToUser() const
88{
89 return m_bEnableSystemUserToUser;
90}
91
92void CParameterClient::SetEnableSystemUserToUser(bool enable)
93{
94 if(m_bEnableSystemUserToUser == enable)
95 return;
96 m_bEnableSystemUserToUser = enable;
97 SetModified(true);
98}
99
100const QString &CParameterClient::GetEncryptKey() const
101{
102 return m_szEncryptKey;
103}
104
105void CParameterClient::SetEncryptKey(const QString &newPassword)
106{
107 if (m_szEncryptKey == newPassword)
108 return;
109 m_szEncryptKey = newPassword;
110 SetModified(true);
111 emit sigEncryptKeyChanged();
112}
113
114const bool &CParameterClient::GetSavePassword() const
115{
116 return m_bSavePassword;
117}
118
119void CParameterClient::SetSavePassword(bool NewAutoSavePassword)
120{
121 if (m_bSavePassword == NewAutoSavePassword)
122 return;
123 SetModified(true);
124 m_bSavePassword = NewAutoSavePassword;
125 emit sigSavePasswordChanged(m_bSavePassword);
126}
127
128CParameterClient::PromptType CParameterClient::GetPromptType() const
129{
130 return m_PromptType;
131}
132
133void CParameterClient::SetPromptType(PromptType NewPromptType)
134{
135 if (m_PromptType == NewPromptType)
136 return;
137 SetModified(true);
138 m_PromptType = NewPromptType;
139 emit sigPromptTypeChanged(m_PromptType);
140}
141
142int CParameterClient::GetPromptCount() const
143{
144 return m_nPromptCount;
145}
146
147void CParameterClient::SetPromptCount(int NewPromptCount)
148{
149 if (m_nPromptCount == NewPromptCount)
150 return;
151 m_nPromptCount = NewPromptCount;
152 SetModified(true);
153 emit sigPromptCountChanged(m_nPromptCount);
154}
155
156bool CParameterClient::GetViewPassowrd() const
157{
158 return m_bViewPassowrd;
159}
160
161void CParameterClient::SetViewPassowrd(bool NewViewPassowrd)
162{
163 if (m_bViewPassowrd == NewViewPassowrd)
164 return;
165 m_bViewPassowrd = NewViewPassowrd;
166 SetModified(true);
167 emit sigViewPassowrdChanged(m_bViewPassowrd);
168}
169
170bool CParameterClient::GetShowProtocolPrefix() const
171{
172 return m_bShowProtocolPrefix;
173}
174
175void CParameterClient::SetShowProtocolPrefix(bool bShowProtocolPrefix)
176{
177 if(m_bShowProtocolPrefix == bShowProtocolPrefix)
178 return;
179 m_bShowProtocolPrefix = bShowProtocolPrefix;
180 SetModified(true);
181 emit sigShowProtocolPrefixChanged();
182}
183
184bool CParameterClient::GetShowIpPortInName() const
185{
186 return m_bShowIpPortInName;
187}
188
189void CParameterClient::SetShowIpPortInName(bool bShowIpPortInName)
190{
191 if(m_bShowIpPortInName == bShowIpPortInName)
192 return;
193 m_bShowIpPortInName = bShowIpPortInName;
194 SetModified(true);
195 emit sigSHowIpPortInNameChanged();
196}
197
198CFrmViewer::ADAPT_WINDOWS CParameterClient::GetAdaptWindows()
199{
200 return m_AdaptWindows;
201}
202
203void CParameterClient::SetAdaptWindows(CFrmViewer::ADAPT_WINDOWS aw)
204{
205 if(m_AdaptWindows == aw)
206 return;
207 m_AdaptWindows = aw;
208 SetModified(true);
209 emit sigAdaptWindowsChanged();
210}
A widget which displays output image from a CConnectDesktop and sends input keypresses and mouse acti...
Definition FrmViewer.h:49
ADAPT_WINDOWS
The ADAPT_WINDOWS enum.
Definition FrmViewer.h:61
virtual int OnLoad(QSettings &set) override
virtual int OnSave(QSettings &set) override
Parameter interface.
Definition Parameter.h:169
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.