1#include "ParameterBase.h"
2#include <QLoggingCategory>
4static Q_LOGGING_CATEGORY(log,
"Client.Parameter.Base")
16 const QString& szPrefix)
25int CParameterBase::Init()
27 m_bShowServerName =
true;
29 m_bLocalCursor =
true;
30 m_bCursorPosition =
true;
32 m_bSupportsDesktopResize =
true;
39int CParameterBase::OnLoad(QSettings &set)
41 SetName(set.value(
"Name", GetName()).toString());
42 SetServerName(set.value(
"ServerName", GetServerName()).toString());
43 SetShowServerName(set.value(
"ShowServerName", GetShowServerName()).toBool());
44 SetOnlyView(set.value(
"OnlyView", GetOnlyView()).toBool());
45 SetLocalCursor(set.value(
"LocalCursor", GetLocalCursor()).toBool());
46 SetCursorPosition(set.value(
"CursorPosition", GetCursorPosition()).toBool());
47 SetClipboard(set.value(
"Clipboard", GetClipboard()).toBool());
48 SetSupportsDesktopResize(set.value(
"SupportsDesktopResize",
49 GetSupportsDesktopResize()).toBool());
50 SetLedState(set.value(
"LedState", GetLedState()).toBool());
51 SetZoomFactor(set.value(
"Viewer/ZoomFactor", GetZoomFactor()).toDouble());
54 set.value(
"Viewer/AdaptType",
59int CParameterBase::OnSave(QSettings &set)
61 set.setValue(
"Name", GetName());
62 set.setValue(
"ServerName", GetServerName());
63 set.setValue(
"ShowServerName", GetShowServerName());
64 set.setValue(
"OnlyView", GetOnlyView());
65 set.setValue(
"LocalCursor", GetLocalCursor());
66 set.setValue(
"CursorPosition", GetCursorPosition());
67 set.setValue(
"Clipboard", GetClipboard());
68 set.setValue(
"SupportsDesktopResize", GetSupportsDesktopResize());
69 set.setValue(
"LedState", GetLedState());
70 set.setValue(
"Viewer/ZoomFactor", GetZoomFactor());
71 set.setValue(
"Viewer/AdaptType", (
int)GetAdaptWindows());
75const QString CParameterBase::GetName()
const
80void CParameterBase::SetName(
const QString& szName)
82 if(m_szName == szName)
86 emit sigNameChanged(m_szName);
89const QString CParameterBase::GetServerName()
const
91 return m_szServerName;
94void CParameterBase::SetServerName(
const QString& szName)
96 if(m_szServerName == szName)
98 m_szServerName = szName;
102bool CParameterBase::GetShowServerName()
const
104 return m_bShowServerName;
107void CParameterBase::SetShowServerName(
bool NewShowServerName)
109 if (m_bShowServerName == NewShowServerName)
111 m_bShowServerName = NewShowServerName;
113 emit sigShowServerNameChanged();
116bool CParameterBase::GetOnlyView()
const
121void CParameterBase::SetOnlyView(
bool only)
123 if(m_bOnlyView == only)
129const bool CParameterBase::GetLocalCursor()
const
131 return m_bLocalCursor;
134void CParameterBase::SetLocalCursor(
bool cursor)
136 if(m_bLocalCursor == cursor)
138 m_bLocalCursor = cursor;
142const bool CParameterBase::GetCursorPosition()
const
144 return m_bCursorPosition;
147void CParameterBase::SetCursorPosition(
bool pos)
149 if(m_bCursorPosition == pos)
151 m_bCursorPosition = pos;
155const bool CParameterBase::GetClipboard()
const
160void CParameterBase::SetClipboard(
bool c)
162 if(m_bClipboard == c)
168bool CParameterBase::GetSupportsDesktopResize()
const
170 return m_bSupportsDesktopResize;
173void CParameterBase::SetSupportsDesktopResize(
bool newSupportsDesktopResize)
175 if(m_bSupportsDesktopResize == newSupportsDesktopResize)
177 m_bSupportsDesktopResize = newSupportsDesktopResize;
181bool CParameterBase::GetLedState()
const
186void CParameterBase::SetLedState(
bool state)
188 if(m_bLedState == state)
196 return m_AdaptWindows;
201 if(m_AdaptWindows == aw)
205 emit sigAdaptWindowsChanged(m_AdaptWindows);
208double CParameterBase::GetZoomFactor()
const
210 return m_dbZoomFactor;
213void CParameterBase::SetZoomFactor(
double newZoomFactor)
215 if(m_dbZoomFactor == newZoomFactor)
217 m_dbZoomFactor = newZoomFactor;
219 emit sigZoomFactorChanged(m_dbZoomFactor);
227 QString szErr =
"The CParameterClient is null";
228 qCritical(log) << szErr;
229 Q_ASSERT_X(
false,
"CParameterBase", szErr.toStdString().c_str());
233 SetAdaptWindows(pClient->GetAdaptWindows());
235 m_Record = pClient->m_Record;
ADAPT_WINDOWS
The ADAPT_WINDOWS enum.
@ ZoomToWindow
Desktop adapt to windows.
The interface of connecter parameters.
virtual void slotSetParameterClient() override
Call after set CParameterClient.
The parameters of client.
the parameters of connecter interface.
CParameterClient * GetParameterClient()
Get CParameterClient.
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.