Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ConnecterVnc.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include "ConnecterVnc.h"
4#include "DlgSettingsVnc.h"
5#include "PluginClient.h"
6#include "ConnectVnc.h"
7
8#include <QMessageBox>
9#include <QRegularExpression>
10#include <QLoggingCategory>
11
12static Q_LOGGING_CATEGORY(log, "VNC.Connecter")
13
15 : CConnecterThread(plugin)
16{
17 qDebug(log) << Q_FUNC_INFO;
18}
19
20CConnecterVnc::~CConnecterVnc()
21{
22 qDebug(log) << Q_FUNC_INFO;
23}
24
25const QString CConnecterVnc::Id()
26{
27 if(m_Para.GetIce())
28 {
29 QString szId = Protocol() + "_" + GetPlugClient()->Name();
30 if(GetParameter())
31 {
32 if(!m_Para.GetPeerUser().isEmpty())
33 szId += + "_" + m_Para.GetPeerUser();
34 }
35 szId = szId.replace(QRegularExpression("[@:/#%!^&*\\.]"), "_");
36 return szId;
37 }
38 return CConnecter::Id();
39}
40
42{
43 return 0;
44}
45
47{
48 if(GetParameter())
49 if(!GetParameter()->GetShowServerName()
50 || CConnecterConnect::ServerName().isEmpty())
51 {
52 if(m_Para.GetIce())
53 {
54 if(!m_Para.GetPeerUser().isEmpty())
55 return m_Para.GetPeerUser();
56 }
57 else {
58 if(!GetParameter()->m_Net.GetHost().isEmpty())
59 return GetParameter()->m_Net.GetHost() + ":"
60 + QString::number(GetParameter()->m_Net.GetPort());
61 }
62 }
64}
65
66QDialog *CConnecterVnc::OnOpenDialogSettings(QWidget *parent)
67{
68 CDlgSettingsVnc* p = new CDlgSettingsVnc(&m_Para, parent);
69 return p;
70}
71
73{
74 CConnectVnc* p = new CConnectVnc(this);
75 return p;
76}
77
79{
80 qDebug(log) << Q_FUNC_INFO;
81 int nRet = 0;
83 if(nRet) return nRet;
84 nRet = SetParameter(&m_Para);
85 return nRet;
86}
87
89{
90 qDebug(log) << Q_FUNC_INFO;
91 int nRet = 0;
93 return nRet;
94}
Connect interface.
Definition Connect.h:45
virtual CParameterBase * GetParameter()
Get parameter.
virtual QString ServerName()
Current connect server name (remote desktop name, if not present, then IP:PORT).
It starts a background thread by default.
virtual int Initial() override
Initial parameters and resource.
virtual int Clean() override
Clean parameters and resource.
virtual qint16 Version() override
Version.
virtual QString ServerName() override
Current connect server name (remote desktop name, if not present, then IP:PORT).
virtual const QString Id() override
Identity.
virtual CConnect * InstanceConnect() override
New connect.
virtual int Clean() override
Clean parameters and resource.
virtual int Initial() override
Initial parameters and resource.
virtual QDialog * OnOpenDialogSettings(QWidget *parent=nullptr) override
Open settgins dialog.
virtual const QString Protocol() const
Protocol.
Definition Connecter.cpp:69
virtual const QString Id()
Identity.
Definition Connecter.cpp:47
The plugin interface.
virtual const QString Name() const =0
This name must be the same as the project name (${PROJECT_NAME}). The translation file (${PROJECT_NAM...