Rabbit Remote Control 0.1.0-bate10
Loading...
Searching...
No Matches
ParameterFtpServer.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include "ParameterFtpServer.h"
4
5CParameterFtpServer::CParameterFtpServer(QObject *parent, const QString &szPrefix)
6 : CParameterServer{parent, szPrefix}
7 , m_bAnonymousLogin(false)
8 , m_bReadOnly(true)
9{
10#if defined(Q_OS_UNIX)
11 m_Net.SetPort(2121);
12#else
13 m_Net.SetPort(21);
14#endif
15 m_Net.SetEnablleUI(CParameterNet::SHOW_UI::Port | CParameterNet::SHOW_UI::User);
16}
17
18int CParameterFtpServer::OnLoad(QSettings &set)
19{
20 int nRet = 0;
21 nRet = CParameterServer::OnLoad(set);
22 if(nRet) return nRet;
23 SetAnonymousLogin(set.value("AnonemousLogin", GetAnonymousLogin()).toBool());
24 SetReadOnly(set.value("ReadOnly", GetReadOnly()).toBool());
25 SetRoot(set.value("Root", GetRoot()).toString());
26 return nRet;
27}
28
29int CParameterFtpServer::OnSave(QSettings &set)
30{
31 int nRet = 0;
32 nRet = CParameterServer::OnSave(set);
33 if(nRet) return nRet;
34 set.setValue("AnonemousLogin", GetAnonymousLogin());
35 set.setValue("ReadOnly", GetReadOnly());
36 set.setValue("Root", GetRoot());
37 return nRet;
38}
39
40bool CParameterFtpServer::GetAnonymousLogin() const
41{
42 return m_bAnonymousLogin;
43}
44
45void CParameterFtpServer::SetAnonymousLogin(bool newAnonymousLogin)
46{
47 if(m_bAnonymousLogin == newAnonymousLogin)
48 return;
49 m_bAnonymousLogin = newAnonymousLogin;
50 SetModified(true);
51}
52
53bool CParameterFtpServer::GetReadOnly() const
54{
55 return m_bReadOnly;
56}
57
58void CParameterFtpServer::SetReadOnly(bool newReadOnly)
59{
60 if(m_bReadOnly == newReadOnly)
61 return;
62 m_bReadOnly = newReadOnly;
63 SetModified(true);
64}
65
66QString CParameterFtpServer::GetRoot() const
67{
68 return m_szRoot;
69}
70
71void CParameterFtpServer::SetRoot(const QString &newRoot)
72{
73 if(m_szRoot == newRoot)
74 return;
75 m_szRoot = newRoot;
76 SetModified(true);
77}
The server base parameters.
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.