Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ParameterICE.cpp
1#include "ParameterICE.h"
2
3CParameterICE::CParameterICE(QObject *parent)
4 : QObject{parent}
5{
6 m_bIce = false;
7 m_bIceDebug = false;
8 m_nSignalPort = 5222;
9 m_nStunPort = m_nTurnPort = 3478;
10}
11
12int CParameterICE::Load(QSettings &set)
13{
14 int nRet = 0;
15
16 m_szSignalServer = set.value("ICE/Signal/Server", m_szSignalServer).toString();
17 m_nSignalPort = set.value("ICE/Signal/Port", m_nSignalPort).toUInt();
18 m_szSignalUser = set.value("ICE/Signal/User", m_szSignalUser).toString();
19 m_szSignalPassword = set.value("ICE/Signal/Password", m_szSignalPassword).toString();
20 m_szStunServer = set.value("ICE/STUN/Server", m_szTurnServer).toString();
21 m_nStunPort = set.value("ICE/STUN/Port", m_nStunPort).toUInt();
22 m_szTurnServer = set.value("ICE/TURN/Server", m_szTurnServer).toString();
23 m_nTurnPort = set.value("ICE/TURN/Port", m_nTurnPort).toUInt();
24 m_szTurnUser = set.value("ICE/TURN/User", m_szTurnUser).toString();
25 m_szTurnPassword = set.value("ICE/TURN/Password", m_szTurnPassword).toString();
26
27 setIce(set.value("ICE/Enable", m_bIce).toBool());
28 SetIceDebug(set.value("ICE/Enable/Debug", GetIceDebug()).toBool());
29 return nRet;
30}
31
32int CParameterICE::Save(QSettings &set)
33{
34 int nRet = 0;
35 set.setValue("ICE/Signal/Server", m_szSignalServer);
36 set.setValue("ICE/Signal/Port", m_nSignalPort);
37 set.setValue("ICE/Signal/User", m_szSignalUser);
38 set.setValue("ICE/Signal/Password", m_szSignalPassword);
39 set.setValue("ICE/STUN/Server", m_szStunServer);
40 set.setValue("ICE/STUN/Port", m_nStunPort);
41 set.setValue("ICE/TURN/Server", m_szTurnServer);
42 set.setValue("ICE/TURN/Port", m_nTurnPort);
43 set.setValue("ICE/TURN/User", m_szTurnUser);
44 set.setValue("ICE/TURN/Password", m_szTurnPassword);
45 set.setValue("ICE/Enable", m_bIce);
46 set.setValue("ICE/Enable/Debug", GetIceDebug());
47 return nRet;
48}
49
50bool CParameterICE::getIce() const
51{
52 return m_bIce;
53}
54
55void CParameterICE::setIce(bool newBIce)
56{
57 if (m_bIce == newBIce)
58 return;
59 m_bIce = newBIce;
60 emit sigIceChanged();
61}
62
63bool CParameterICE::GetIceDebug() const
64{
65 return m_bIceDebug;
66}
67
68void CParameterICE::SetIceDebug(bool newIceDebug)
69{
70 if(m_bIceDebug == newIceDebug)
71 return;
72 m_bIceDebug = newIceDebug;
73 emit sigIceDebugChanged(m_bIceDebug);
74}
75
76const QString &CParameterICE::getSignalServer() const
77{
78 return m_szSignalServer;
79}
80
81void CParameterICE::setSignalServer(const QString &newSzSignalServer)
82{
83 if (m_szSignalServer == newSzSignalServer)
84 return;
85 m_szSignalServer = newSzSignalServer;
86 emit sigSignalServerChanged();
87}
88
89quint16 CParameterICE::getSignalPort() const
90{
91 return m_nSignalPort;
92}
93
94void CParameterICE::setSignalPort(quint16 newNSignalPort)
95{
96 if (m_nSignalPort == newNSignalPort)
97 return;
98 m_nSignalPort = newNSignalPort;
99 emit sigSignalPortChanged();
100}
101
102const QString &CParameterICE::getSignalUser() const
103{
104 return m_szSignalUser;
105}
106
107void CParameterICE::setSignalUser(const QString &newSzSignalUser)
108{
109 if (m_szSignalUser == newSzSignalUser)
110 return;
111 m_szSignalUser = newSzSignalUser;
112 emit sigSignalUserChanged();
113}
114
115const QString &CParameterICE::getSignalPassword() const
116{
117 return m_szSignalPassword;
118}
119
120void CParameterICE::setSignalPassword(const QString &newSzSignalPassword)
121{
122 if (m_szSignalPassword == newSzSignalPassword)
123 return;
124 m_szSignalPassword = newSzSignalPassword;
125 emit sigSignalPasswordChanged();
126}
127
128const QString &CParameterICE::getStunServer() const
129{
130 return m_szStunServer;
131}
132
133void CParameterICE::setStunServer(const QString &newSzStunServer)
134{
135 if (m_szStunServer == newSzStunServer)
136 return;
137 m_szStunServer = newSzStunServer;
138 emit sigStunServerChanged();
139}
140
141quint16 CParameterICE::getStunPort() const
142{
143 return m_nStunPort;
144}
145
146void CParameterICE::setStunPort(quint16 newNStunPort)
147{
148 if (m_nStunPort == newNStunPort)
149 return;
150 m_nStunPort = newNStunPort;
151 emit sigStunPortChanged();
152}
153
154const QString &CParameterICE::getTurnServer() const
155{
156 return m_szTurnServer;
157}
158
159void CParameterICE::setTurnServer(const QString &newSzTurnServer)
160{
161 if (m_szTurnServer == newSzTurnServer)
162 return;
163 m_szTurnServer = newSzTurnServer;
164 emit sigTurnServerChanged();
165}
166
167quint16 CParameterICE::getTurnPort() const
168{
169 return m_nTurnPort;
170}
171
172void CParameterICE::setTurnPort(quint16 newNTurnPort)
173{
174 if (m_nTurnPort == newNTurnPort)
175 return;
176 m_nTurnPort = newNTurnPort;
177 emit sigTurnPortChanged();
178}
179
180const QString &CParameterICE::getTurnUser() const
181{
182 return m_szTurnUser;
183}
184
185void CParameterICE::setTurnUser(const QString &newSzTurnUser)
186{
187 if (m_szTurnUser == newSzTurnUser)
188 return;
189 m_szTurnUser = newSzTurnUser;
190 emit sigTurnUserChanged();
191}
192
193const QString &CParameterICE::getTurnPassword() const
194{
195 return m_szTurnPassword;
196}
197
198void CParameterICE::setTurnPassword(const QString &newSzTurnPassword)
199{
200 if (m_szTurnPassword == newSzTurnPassword)
201 return;
202 m_szTurnPassword = newSzTurnPassword;
203 emit sigTurnPasswordChanged();
204}