商业插件:Qt VNC服务器

Commercial add-on: Qt VNC Server

商业插件:Qt VNC服务器

Wednesday July 06, 2022 by Eskil Abrahamsen Blomfeldt | Comments

​2022年7月6日星期三,Eskil Abrahamsen Blomfeldt评论

"VNC" (or Virtual Network Computing) compatibility has a long history in Qt, and we are now improving this story with a commercial add-on which is compatible with Qt 6.4.

“VNC”(或虚拟网络计算)兼容性在Qt中有着悠久的历史,我们现在正在通过一个与Qt 6.4兼容的商业插件来改进这个故事。

History

历史

I did an archeological dig in Qt's history, and the first mention of VNC support I could find was in the very early port to embedded Linux (Qt 2.2 most likely) in a change called "VNC remote framebuffer support" from July 5th, 2000. Technically speaking, though, VNC is a brand name, and the protocol supported is called "RFB" (Remote FrameBuffer). Clients and servers that speak this protocol are typically referred to as "VNC-compatible".

​我在Qt的历史中做了一个考古挖掘,我能找到的第一个提到VNC支持的地方是2000年7月5日在嵌入式Linux的早期端口(最有可能是Qt 2.2),这一更改被称为“VNC远程帧缓冲支持”。然而,从技术上讲,VNC是一个品牌名称,支持的协议称为“RFB”(远程帧缓冲区)。使用此协议的客户端和服务器通常被称为“VNC兼容”。

This original support evolved over time into its current manifestation, which came in one of the Qt 4 feature releases as part of the so-called "Lighthouse project", later re-branded to QPA (or Qt Platform Abstraction).

随着时间的推移,这种最初的支持逐渐演变为当前的表现形式,出现在Qt 4功能版本中,作为所谓的“灯塔项目”的一部分,后来重新命名为QPA(或Qt平台抽象)。

So the existing support for VNC in Qt 4, 5 and 6 is a platform plugin, where you can run your applications in headless mode and render to remote VNC-compatible clients when they connect. Any Qt GUI-based application can be run in this mode, by passing "-platform vnc" as a command line option, or by setting QT_QPA_PLATFORM=vnc in the environment (note: this plugin is only built on Linux platforms at the moment).

因此,Qt 4、5和6中对VNC的现有支持是一个平台插件,在那里,您可以在无头模式下运行应用程序,并在连接时呈现给与VNC兼容的远程客户端。任何基于Qt GUI的应用程序都可以在此模式下运行,方法是将“-platform vnc”作为命令行选项传递,或者在环境中设置QT_QPA_PLATFORM=vnc(注意:目前此插件仅在Linux平台上构建)。

This is pretty elegant and works smoothly to this day, but it has one downside: The only way you can render to a local display simultaneously as a remote display, is by running a VNC-compatible client locally alongside the server and connecting it to localhost. Due to this, we've had several customers request that we expand the capabilities to include mirroring to a local display. Typically, their use case is an embedded device - often backed by Qt Wayland Compositor - where users want to broadcast the display to a remote user on demand.

​这相当优雅,至今仍能顺利工作,但有一个缺点:您可以将其作为远程显示器同时渲染到本地显示器的唯一方法是在服务器旁边本地运行一个VNC兼容的客户端,并将其连接到本地主机。因此,有几位客户要求我们扩展功能,包括镜像到本地显示器。通常,他们的用例是一个嵌入式设备——通常由Qt Wayland Compositor支持——其中用户希望根据需要向远程用户广播显示。 

For instance, the remote user could be a representative from support who needs to see exactly what the end user is seeing on screen in order to help them efficiently. The application should primarily be running unencumbered, but on request it should be able to share its contents with a remote user, as well as accept remote input (optionally). The VNC QPA plugin in Qt does not cover this use case, since the application would have to be closed and restarted in order for any remote connection to be possible, and the end user would not be able to see anything on their screen as long as the system is running in this mode.

例如,远程用户可以是支持部门的代表,他需要准确地看到最终用户在屏幕上看到的内容,以便有效地帮助他们。应用程序主要应无阻碍地运行,但应请求,它应能够与远程用户共享其内容,并接受远程输入(可选)。Qt中的VNC QPA插件不涵盖此用例,因为必须关闭并重新启动应用程序才能实现任何远程连接,并且只要系统在此模式下运行,最终用户将无法在屏幕上看到任何内容。

So we set out to provide a solution to this and came up with the Qt VNC Server module. This will be available to commercial customers as a technology preview which is compatible with Qt 6.4. The documentation snapshot is available here.

​因此,我们着手提供解决方案,并提出了Qt VNC服务器模块。这将作为与Qt 6.4兼容的技术预览提供给商业客户。此处提供了文档快照。

Qt VNC Server

Qt VNC服务器

Our main use case when going into this was to support remote desktop on Qt Wayland Compositor-based display servers, but we quickly realized that it did not make sense for us to limit support to Wayland.

讨论这个问题时,我们的主要用例是支持基于Qt Wayland合成器的显示服务器上的远程桌面,但我们很快意识到,限制对Wayland的支持对我们来说没有意义。

A Qt Wayland Compositor is typically just a Qt Quick application which composes graphics buffers from different clients, so any solution which allows you to share the content of a Qt Quick application will also work for a compositor. We also knew that some customers had multiple displays in their systems, and might want to limit remote users to seeing just one of these displays over the RFB connection.

Qt Wayland合成器通常只是一个Qt Quick应用程序,它从不同的客户端组成图形缓冲区,因此任何允许共享Qt Quick应用程序内容的解决方案也适用于合成器。我们还知道,一些客户的系统中有多个显示器,可能希望限制远程用户通过RFB连接只能看到其中一个显示器。

So the solution we ended up with allows you to share any Qt Quick application - or any part of it - with a VNC-compatible client. And like with Qt Quick in general, we have tried to make the solution as simple to use as possible, yet still powerful enough to cover many use cases.

因此,我们最终的解决方案允许您与VNC兼容的客户端共享任何Qt Quick应用程序或其任何部分。和Qt Quick一样,我们试图使解决方案尽可能简单易用,但仍然强大到足以覆盖许多用例。

In order to use Qt VNC Server in your product, you simply import the QtVncServer module and create a VncItem as the root of the subtree you wish to share remotely. When there is no active connection, this will behave just as an empty Item, and will not cause any noticeable overhead to the application.

​为了在产品中使用Qt VNC服务器,只需导入QtVncServer模块并创建一个VncItem作为要远程共享的子树的根。当没有活动连接时,这将作为一个空项,不会对应用程序造成任何明显的开销。

When a user connects, it will use the same mechanisms as ShaderEffectSource to capture the contents of the subtree, sharing this with remote clients. It will additionally accept input from the clients, unless this is explicitly disabled.

​当用户连接时,它将使用与ShaderEffectSource相同的机制来捕获子树的内容,并与远程客户端共享。它还将接受来自客户端的输入,除非显式禁用。

One of the examples in Qt VNC Server shows how this works with Qt Wayland Compositor.

​Qt VNC服务器中的一个示例显示了如何使用Qt Wayland合成器。 

Here you see three Qt applications running inside a Qt Wayland Compositor, and the entire desktop is being shared over VNC. A remote user has been typing into the Wiggly app, remote-controlling the desktop. (This may be one of the main use cases, but it's worth mentioning that the Qt VNC Server module itself is cross-platform and has no dependencies on Wayland.)

在这里,您可以看到在Qt Wayland合成器中运行的三个Qt应用程序,整个桌面都通过VNC共享。一个远程用户一直在Wiggly应用程序中输入内容,远程控制桌面。(这可能是主要用例之一,但值得一提的是,Qt VNC服务器模块本身是跨平台的,对Wayland没有依赖性。)

Additional features

附加特性

The existing VNC plugin in Qt remains available and is not going anywhere, but Qt VNC Server hopefully adds value to users who are building their own platforms, where there might not be a remote desktop solution available by default.

Qt中现有的VNC插件仍然可用,并且不会在任何地方使用,但Qt VNC服务器有望为正在构建自己平台的用户增加价值,因为默认情况下可能没有远程桌面解决方案可用。

In addition to the basic support for the RFB protocol that matches the support in the QPA plugin, Qt VNC Server also implements Hextile compression and Zlib compression (when libz is available). It supports detecting damage regions to avoid sending too much data over the network connection. And, finally, it supports password protection using DEC Authentication, through the libtomcrypt library (if this is available).

除了与QPA插件中的支持相匹配的RFB协议的基本支持外,Qt VNC服务器还实现了Hextile压缩和Zlib压缩(当libz可用时)。它支持检测损坏区域,以避免通过网络连接发送过多数据。最后,它通过libtomcrypt库(如果可用)支持使用DEC身份验证的密码保护。

Tech preview

技术预览

Qt VNC Server is considered a tech preview at the moment. This means we are looking for feedback from prospective users: Are there additional features needed? Does the API work as well as we hope, or should we make adjustments? Etc.

Qt VNC服务器目前被视为技术预览。这意味着我们正在寻找潜在用户的反馈:是否需要其他功能?API是否像我们希望的那样工作,或者我们应该进行调整?等

It also means that there are no compatibility guarantees with future releases of the module, but the API is fairly small, so keeping up with changes should not be too impractical.

这也意味着与模块的未来版本没有兼容性保证,但API相当小,因此跟上变化应该不会太不切实际。

If you are a Qt commercial customer, you can download the Qt VNC Server via the Qt Maintenance tool. Give it a test run with your app and let us know what you think. Suggestions and bugs can be reported via Qt Support as usual.

如果您是Qt商业客户,可以通过Qt维护工具下载Qt VNC服务器。用你的应用程序测试一下,让我们知道你的想法。建议和错误可以像往常一样通过Qt支持报告。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值