1#include <QLoggingCategory>
2#include <QRegularExpression>
3#include "ConnecterConnect.h"
4#include "PluginClientThread.h"
6static Q_LOGGING_CATEGORY(log,
"Client.Connecter.Connect")
11 qDebug(log) << Q_FUNC_INFO;
14CConnecterConnect::~CConnecterConnect()
16 qDebug(log) << Q_FUNC_INFO;
21 QString szId =
Protocol() +
"_" + GetPlugClient()->
Name();
28 +
"_" + QString::number(
GetParameter()->m_Net.GetPort());
30 static QRegularExpression exp(
"[-@:/#%!^&* \\.]");
31 szId = szId.replace(exp,
"_");
55 &&
GetParameter()->GetParameterClient()->GetShowProtocolPrefix())
67 return tr(
"Name: ") +
Name() +
"\n"
74 + tr(
"Description: ") + GetPlugClient()->
Description();
79 return qobject_cast<CParameterBase*>(CConnecter::GetParameter());
89 check = connect(
GetParameter(), SIGNAL(sigNameChanged()),
90 this, SLOT(slotUpdateName()));
92 check = connect(
GetParameter(), SIGNAL(sigShowServerNameChanged()),
93 this, SLOT(slotShowServerName()));
102 check = connect(
GetParameter(), SIGNAL(sigZoomFactorChanged(
double)),
103 pViewer, SLOT(slotSetZoomFactor(
double)));
122 bool check = connect(pPara, SIGNAL(sigShowProtocolPrefixChanged()),
123 this, SLOT(slotUpdateName()));
125 check = connect(pPara, SIGNAL(sigSHowIpPortInNameChanged()),
126 this, SLOT(slotUpdateName()));
131 QString szMsg =
"The CConnecter is not parameters! "
132 "please first create parameters, "
133 "then call SetParameter in the ";
134 szMsg += metaObject()->className() + QString(
"::")
135 + metaObject()->className();
136 szMsg += QString(
" or ") + metaObject()->className()
137 + QString(
"::") +
"Initial()";
138 szMsg +=
" to set the parameters pointer. "
139 "Default set CParameterClient for the parameters of connecter "
140 "(CParameterConnecter or its derived classes) "
141 "See: CClient::CreateConnecter. "
142 "If you are sure the parameter of connecter "
143 "does not need CParameterClient. "
144 "Please overload the SetParameterClient in the ";
145 szMsg += QString(metaObject()->className()) +
" . don't set it";
146 qCritical(log) << szMsg.toStdString().c_str();
154 qDebug(log) << Q_FUNC_INFO;
156 = qobject_cast<CPluginClientThread*>(GetPlugClient());
158 emit sigOpenConnect(
this);
162 int nRet = m_pConnect->
Connect();
172 qDebug(log) << Q_FUNC_INFO;
174 = qobject_cast<CPluginClientThread*>(GetPlugClient());
176 emit sigCloseconnect(
this);
180 m_pConnect->deleteLater();
191 &&
GetParameter()->GetParameterClient()->GetShowIpPortInName())
194 +
":" + QString::number(
GetParameter()->m_Net.GetPort());
199 return m_szServerName;
204 if(m_szServerName == szName)
207 m_szServerName = szName;
virtual int Disconnect()
Disconnect.
virtual int Connect()
Start connect.
The connector interface of the plug-in, which is only used by the plug-in.
virtual const QString Id() override
Identity.
virtual int DisConnect() override
emit sigDisconnected() in here
virtual const QString Description() override
Description.
virtual int Connect() override
virtual void slotSetServerName(const QString &szName)
virtual CParameterBase * GetParameter()
Get parameter.
virtual const QString Name() override
Display order:
virtual int SetParameterClient(CParameterClient *pPara) override
Set CParameterClient.
virtual CConnect * InstanceConnect()=0
New connect.
virtual QString ServerName()
Current connect server name (remote desktop name, if not present, then IP:PORT).
void sigUpdateName(const QString &szName)
void sigConnected()
Successful connection signal.
virtual QWidget * GetViewer()=0
Get Viewer.
void sigDisconnected()
Successful disconnection signal.
virtual int SetParameter(CParameter *p)
Set parameters.
virtual const QString Protocol() const
Protocol.
void sigUpdateParameters(CConnecter *pConnecter)
Update parameters, notify application to save or show parameters.
A widget which displays output image from a CConnectDesktop and sends input keypresses and mouse acti...
ADAPT_WINDOWS
The ADAPT_WINDOWS enum.
The interface of connecter parameters.
The parameters of client.
void sigChanged()
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a cha...
It starts a background thread by default.
virtual const QString DisplayName() const
The plugin display name.
virtual const QString Description() const =0
Plugin description.
virtual const QString Name() const =0
This name must be the same as the project name (${PROJECT_NAME}). The translation file (${PROJECT_NAM...