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