玉兔远程控制 0.0.31
载入中...
搜索中...
未找到
PluginFreeRDP.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include "PluginFreeRDP.h"
4#include "ConnecterFreeRDP.h"
5#include "winpr/wlog.h"
6
7#include <QLoggingCategory>
8
9#ifdef HAVE_LIBSSH
10 #include "ChannelSSHTunnel.h"
11#endif
12
13static Q_LOGGING_CATEGORY(log, "FreeRDP.Plugin")
14static Q_LOGGING_CATEGORY(LoggerFreeRDP, "FreeRDP.Log")
15
18 : CPluginClient(parent)
19{
20 qDebug(log) << Q_FUNC_INFO;
21 qInfo(log) << "FreeRDP version:" << freerdp_get_version_string()
22 << "revision:" << freerdp_get_build_revision();
23
24 static wLogCallbacks* pCbLog = new wLogCallbacks;
25 BOOL bRet = WLog_SetLogAppenderType(WLog_GetRoot(), WLOG_APPENDER_CALLBACK);
26 if(bRet && pCbLog)
27 {
28 memset(pCbLog, 0, sizeof(wLogCallbacks));
29 pCbLog->message = [](const wLogMessage* msg)->BOOL{
30 switch(msg->Level)
31 {
32 case WLOG_TRACE:
33 break;
34 case WLOG_DEBUG:
35 qDebug(LoggerFreeRDP) /*<< msg->PrefixString */ << msg->TextString;
36 break;
37 case WLOG_INFO:
38 qInfo(LoggerFreeRDP) /*<< msg->PrefixString*/ << msg->TextString;
39 break;
40 case WLOG_WARN:
41 qWarning(LoggerFreeRDP) /*<< msg->PrefixString */<< msg->TextString;
42 case WLOG_ERROR:
43 qCritical(LoggerFreeRDP) /*<< msg->PrefixString*/ << msg->TextString;
44 break;
45 case WLOG_FATAL:
46 case WLOG_OFF:
47 qFatal(msg->FormatString, msg->TextString);
48 break;
49 default:
50 break;
51 }
52 return TRUE;
53 };
54 WLog_ConfigureAppender(WLog_GetLogAppender(WLog_GetRoot()), "callbacks", pCbLog);
55 }
56 WLog_SetLogLevel(WLog_GetRoot(), WLOG_TRACE);
57}
59
62{
63 qDebug(log) << Q_FUNC_INFO;
64}
66
67const QString CPluginFreeRDP::Name() const
68{
69 return "FreeRDP";
70}
71
72const QString CPluginFreeRDP::DisplayName() const
73{
74 return tr("Free remote desktop");
75}
76
77const QString CPluginFreeRDP::Description() const
78{
79 return tr("RDP(Windows remote desktop Protocol): Access remote desktops such as windows.");
80}
81
82const QString CPluginFreeRDP::Protocol() const
83{
84 return "RDP";
85}
86
87const QIcon CPluginFreeRDP::Icon() const
88{
89 return QIcon::fromTheme("windows");
90}
91
92const QString CPluginFreeRDP::Version() const
93{
94 return PluginFreeDP_VERSION;
95}
96
100const QString CPluginFreeRDP::Details() const
101{
102 QString szDetails;
103 szDetails = "- " + tr("FreeRDP");
104 szDetails += "\n";
105 szDetails += " - " + tr("version: ");
106 szDetails += freerdp_get_version_string();
107 szDetails += "\n";
108 szDetails += " - " + tr("Build version: ");
109 szDetails += freerdp_get_build_revision();
110 szDetails += ":";
111 szDetails += freerdp_get_build_revision();
112 szDetails += "\n";
113#if FreeRDP_VERSION_MAJOR < 3
114 szDetails += " - " + tr("Build date: ");
115 szDetails += freerdp_get_build_date();
116 szDetails += "\n";
117#endif
118 szDetails += " - ";
119 szDetails += freerdp_get_build_config();
120
121#ifdef HAVE_LIBSSH
122 QSharedPointer<CParameterChannelSSH> parameter(new CParameterChannelSSH());
123 CChannelSSHTunnel channel(parameter);
124 szDetails += channel.GetDetails();
125#endif
126
127 return szDetails;
128}
129
131{
132 if(Id() == szId)
133 {
134 return new CConnecterFreeRDP(this);
135 }
136 return nullptr;
137}
连接者应用接口。
Definition Connecter.h:62
客户端插件接口。用于建立 CConnecter 实例,它由协议插件实现。
virtual const QString Id() const
标识。默认: Protocol() + ":" + Name()
virtual const QString DisplayName() const override
在界面上显示的名称
virtual CConnecter * CreateConnecter(const QString &szId) override
新建 CConnecter 实例。仅由 CClient 调用
virtual const QString Version() const override
Version
virtual const QString Name() const override
[Clean resource]
virtual const QString Description() const override
描述
virtual const QString Details() const override
Show the plugin depends on the freerdp version
virtual const QString Protocol() const override
协议
virtual ~CPluginFreeRDP() override
[Initialize resource]