| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the documentation of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial Usage | 
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and Nokia. | 
|---|
| 14 | ** | 
|---|
| 15 | ** GNU Lesser General Public License Usage | 
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 19 | ** packaging of this file.  Please review the following information to | 
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 22 | ** | 
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 26 | ** package. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please | 
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | /*! | 
|---|
| 43 | \page qt-embedded-vnc.html | 
|---|
| 44 | \brief A guide to using Qt for Embedded Linux applications as VNC servers | 
|---|
| 45 | and clients. | 
|---|
| 46 |  | 
|---|
| 47 | \title The VNC Protocol and Qt for Embedded Linux | 
|---|
| 48 | \ingroup qt-embedded-linux | 
|---|
| 49 |  | 
|---|
| 50 | VNC (Virtual Network Computing) software makes it possible to view | 
|---|
| 51 | and interact with one computer (the "server") from any other | 
|---|
| 52 | computer or mobile device (the "viewer") anywhere on a network. | 
|---|
| 53 |  | 
|---|
| 54 | \image qt-embedded-vnc-screen.png | 
|---|
| 55 |  | 
|---|
| 56 | VNC clients are available for a vast array of display systems, including | 
|---|
| 57 | X11, Mac OS X and Windows. | 
|---|
| 58 |  | 
|---|
| 59 | \section1 Configuring Qt with VNC Capabilities | 
|---|
| 60 |  | 
|---|
| 61 | To run a \l{Qt for Embedded Linux} application using the VNC protocol, the | 
|---|
| 62 | \l{Qt for Embedded Linux} library must be configured and compiled with the | 
|---|
| 63 | \c -qt-gfx-vnc option: | 
|---|
| 64 |  | 
|---|
| 65 | \snippet doc/src/snippets/code/doc_src_emb-vnc.qdoc 0 | 
|---|
| 66 |  | 
|---|
| 67 | \section1 Running a Server Application | 
|---|
| 68 |  | 
|---|
| 69 | Start a server application by specifying the \c -qws command | 
|---|
| 70 | line option when running the application. (This can also be | 
|---|
| 71 | specified in the application's source code.) | 
|---|
| 72 | Use the \c -display command line option to specify the VNC server's | 
|---|
| 73 | driver and the virtual screen to use. For example: | 
|---|
| 74 |  | 
|---|
| 75 | \snippet doc/src/snippets/code/doc_src_emb-vnc.qdoc 1 | 
|---|
| 76 |  | 
|---|
| 77 | The application will act as a VNC server which can be accessed using | 
|---|
| 78 | an ordinary VNC client, either on the development machine or from a | 
|---|
| 79 | different machine on a network. | 
|---|
| 80 |  | 
|---|
| 81 | For example, using the X11 VNC client to view the application from the | 
|---|
| 82 | same machine: | 
|---|
| 83 |  | 
|---|
| 84 | \snippet doc/src/snippets/code/doc_src_emb-vnc.qdoc 2 | 
|---|
| 85 |  | 
|---|
| 86 | To interact with the application from another machine on the network, | 
|---|
| 87 | run a VNC client pointing to the machine that is running the server | 
|---|
| 88 | application. | 
|---|
| 89 |  | 
|---|
| 90 | \l{Qt for Embedded Linux} will create a 640 by 480 pixel display by | 
|---|
| 91 | default. Alternatively, the \c QWS_SIZE environment variable can be | 
|---|
| 92 | used to set another size; e.g., \c{QWS_SIZE=240x320}. | 
|---|
| 93 |  | 
|---|
| 94 | \section1 Running Client Applications | 
|---|
| 95 |  | 
|---|
| 96 | If you want to run more than one application on the same display, you | 
|---|
| 97 | only need to start the first one as a server application, using the | 
|---|
| 98 | \c -qws command line option to indicate that it will manage other | 
|---|
| 99 | windows. | 
|---|
| 100 |  | 
|---|
| 101 | \snippet doc/src/snippets/code/doc_src_emb-vnc.qdoc Starting server | 
|---|
| 102 |  | 
|---|
| 103 | Subsequent client applications can be started \e without the \c -qws | 
|---|
| 104 | option, but will each require the same \c -display option and argument | 
|---|
| 105 | as those used for the server. | 
|---|
| 106 |  | 
|---|
| 107 | \snippet doc/src/snippets/code/doc_src_emb-vnc.qdoc Starting clients | 
|---|
| 108 |  | 
|---|
| 109 | However, for the clients, this option will not cause a new VNC server | 
|---|
| 110 | to be started, but only indicates that their windows will appear on the | 
|---|
| 111 | virtual screen managed by the server application. | 
|---|
| 112 |  | 
|---|
| 113 | \section1 Related Resources | 
|---|
| 114 |  | 
|---|
| 115 | It is not always necessary to specify the \c -qws command line option | 
|---|
| 116 | when running a server application as long as the QApplication object | 
|---|
| 117 | used by the application has been constructed with the | 
|---|
| 118 | QApplication::GuiServer flag. | 
|---|
| 119 |  | 
|---|
| 120 | See the \l{Running Qt for Embedded Linux Applications}{running applications} | 
|---|
| 121 | documentation for more details about server and client applications. | 
|---|
| 122 |  | 
|---|
| 123 | \table | 
|---|
| 124 | \row | 
|---|
| 125 | \o \bold {The Virtual Framebuffer} | 
|---|
| 126 |  | 
|---|
| 127 | The \l{The Virtual Framebuffer}{virtual framebuffer} is | 
|---|
| 128 | an alternative technique recommended for development and debugging | 
|---|
| 129 | purposes. | 
|---|
| 130 |  | 
|---|
| 131 | The virtual framebuffer emulates a framebuffer using a shared | 
|---|
| 132 | memory region and the \c qvfb tool to display the framebuffer in a | 
|---|
| 133 | window. | 
|---|
| 134 |  | 
|---|
| 135 | Its use of shared memory makes the virtual framebuffer much faster | 
|---|
| 136 | and smoother than using the VNC protocol, but it does not operate | 
|---|
| 137 | over a network. | 
|---|
| 138 |  | 
|---|
| 139 | \o \inlineimage qt-embedded-virtualframebuffer.png | 
|---|
| 140 | \endtable | 
|---|
| 141 | */ | 
|---|