Rabbit Remote Control 0.0.33
Loading...
Searching...
No Matches
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")
15static Q_LOGGING_CATEGORY(LoggerFreeRDPTrace, "FreeRDP.Log.Trace")
16static Q_LOGGING_CATEGORY(LoggerFreeRDPFatal, "FreeRDP.Log.Fatal")
17
20 : CPluginClient(parent)
21{
22 qDebug(log) << Q_FUNC_INFO;
23 qInfo(log) << "FreeRDP version:" << freerdp_get_version_string()
24 << "revision:" << freerdp_get_build_revision();
25
26 static wLogCallbacks* pCbLog = new wLogCallbacks;
27 BOOL bRet = WLog_SetLogAppenderType(WLog_GetRoot(), WLOG_APPENDER_CALLBACK);
28 if(bRet && pCbLog)
29 {
30 memset(pCbLog, 0, sizeof(wLogCallbacks));
31 pCbLog->message = [](const wLogMessage* msg)->BOOL{
32 switch(msg->Level)
33 {
34 case WLOG_TRACE:
35 qDebug(LoggerFreeRDPTrace) /*<< msg->PrefixString */ << msg->TextString;
36 break;
37 case WLOG_DEBUG:
38 qDebug(LoggerFreeRDP) /*<< msg->PrefixString */ << msg->TextString;
39 break;
40 case WLOG_INFO:
41 qInfo(LoggerFreeRDP) /*<< msg->PrefixString*/ << msg->TextString;
42 break;
43 case WLOG_WARN:
44 qWarning(LoggerFreeRDP) /*<< msg->PrefixString */<< msg->TextString;
45 case WLOG_ERROR:
46 qCritical(LoggerFreeRDP) /*<< msg->PrefixString*/ << msg->TextString;
47 break;
48 case WLOG_FATAL:
49 case WLOG_OFF:
50 qCritical(LoggerFreeRDPFatal) /*<< msg->PrefixString*/ << msg->TextString;
51 break;
52 default:
53 break;
54 }
55 return TRUE;
56 };
57 WLog_ConfigureAppender(WLog_GetLogAppender(WLog_GetRoot()), "callbacks", pCbLog);
58 }
59 WLog_SetLogLevel(WLog_GetRoot(), WLOG_TRACE);
60}
62
65{
66 qDebug(log) << Q_FUNC_INFO;
67}
69
70const QString CPluginFreeRDP::Name() const
71{
72 return "FreeRDP";
73}
74
75const QString CPluginFreeRDP::DisplayName() const
76{
77 return tr("Free remote desktop");
78}
79
80const QString CPluginFreeRDP::Description() const
81{
82 return tr("RDP(Windows remote desktop Protocol): Access remote desktops such as windows.");
83}
84
85const QString CPluginFreeRDP::Protocol() const
86{
87 return "RDP";
88}
89
90const QIcon CPluginFreeRDP::Icon() const
91{
92 return QIcon::fromTheme("windows");
93}
94
95const QString CPluginFreeRDP::Version() const
96{
97 return PluginFreeDP_VERSION;
98}
99
103const QString CPluginFreeRDP::Details() const
104{
105 QString szDetails;
106 szDetails = "- " + tr("FreeRDP");
107 szDetails += "\n";
108 szDetails += " - " + tr("version: ");
109 szDetails += freerdp_get_version_string();
110 szDetails += "\n";
111 szDetails += " - " + tr("Build version: ");
112 szDetails += freerdp_get_build_revision();
113 szDetails += ":";
114 szDetails += freerdp_get_build_revision();
115 szDetails += "\n";
116#if FreeRDP_VERSION_MAJOR < 3
117 szDetails += " - " + tr("Build date: ");
118 szDetails += freerdp_get_build_date();
119 szDetails += "\n";
120#endif
121 szDetails += " - ";
122 szDetails += freerdp_get_build_config();
123
124#ifdef HAVE_LIBSSH
125 QSharedPointer<CParameterChannelSSH> parameter(new CParameterChannelSSH());
126 CChannelSSHTunnel channel(parameter);
127 szDetails += channel.GetDetails();
128#endif
129
130 return szDetails;
131}
132
133CConnecter* CPluginFreeRDP::OnCreateConnecter(const QString &szId)
134{
135 if(Id() == szId)
136 {
137 return new CConnecterFreeRDP(this);
138 }
139 return nullptr;
140}
ssh tunnel class
Connecter interface.
Definition Connecter.h:62
The plugin interface.
virtual const QString Id() const
ID. Default: Protocol() + ":" + Name()
virtual const QString DisplayName() const override
The plugin display name.
virtual const QString Version() const override
Version.
virtual const QString Name() const override
[Clean resource]
virtual const QString Description() const override
Plugin description.
virtual const QString Details() const override
Show the plugin depends on the freerdp version.
virtual const QString Protocol() const override
Plugin Protocol.
virtual ~CPluginFreeRDP() override
[Initialize resource]