Commit 50b38687 authored by Eskil Abrahamsen-Blomfeldt's avatar Eskil Abrahamsen-Blomfeldt
Browse files

Start on framework for documentation

Pitstop commit. Docs now generated, but not complete at all.
parent b96270af
......@@ -35,3 +35,7 @@ qt_internal_extend_target(VncServer CONDITION LibTomCrypt_FOUND
DEFINES
LIBTOMCRYPT_FOUND
)
qt_internal_add_docs(VncServer
doc/qtvncserver.qdocconf
)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtVncServer
description = Qt VNC Server Reference Documentation
version = $QT_VERSION
buildversion = Qt VNC Server | Commercial or GPLv3
examplesinstallpath = vncserver
qhp.projects = QtVncServer
qhp.QtVncServer.file = qtvncserver.qhp
qhp.QtVncServer.namespace = org.qt-project.qtvncserver.$QT_VERSION_TAG
qhp.QtVncServer.namespace = org.qt-project.qtvncserver.dev
qhp.QtVncServer.virtualFolder = qtvncserver
qhp.QtVncServer.indexTitle = Qt VNC Server
qhp.QtVncServer.indexRoot =
qhp.QtVncServer.subprojects = qmltypes examples classes
qhp.QtVncServer.subprojects.qmltypes.title = QML Types
qhp.QtVncServer.subprojects.qmltypes.indexTitle = Qt VNC Server QML Types
qhp.QtVncServer.subprojects.qmltypes.selectors = qmlclass
qhp.QtVncServer.subprojects.qmltypes.sortPages = true
qhp.QtVncServer.subprojects.examples.title = Examples
qhp.QtVncServer.subprojects.examples.indexTitle = Qt VNC Server Examples and Tutorials
qhp.QtVncServer.subprojects.examples.selectors = doc:example
qhp.QtVncServer.subprojects.classes.title = C++ Classes
qhp.QtVncServer.subprojects.classes.indexTitle = Qt VNC Server C++ Classes
qhp.QtVncServer.subprojects.classes.selectors = class doc:headerfile
qhp.QtVncServer.subprojects.classes.sortPages = true
depends += qtcore qtgui qtquick qtwaylandcompositor
sourcedirs += .. \
src
exampledirs += ../../../examples/vncserver
imagedirs += images
# Exclude private header files from the documentation build
excludefiles += "*_p.h"
Cpp.ignoretokens += Q_VNCSERVER_EXPORT
navigation.landingpage = "Qt VNC Server"
navigation.qmltypespage = "Qt VNC Server QML Types"
navigation.cppclassespage = "Qt VNC Server C++ Classes"
tagfile = qtvncserver.tags
# Fail the documentation build if there are more warnings than the limit
# warninglimit = 0
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\qmlmodule QtQuickVnc
\title Qt VNC Server QML Types
\brief Provides the QML types to include physics items into a Qt Quick scene.
Qt VNC Server provides the following QML types:
\section1 QtQuickVnc QML Types
Import the QtQuickVnc module with the following statement:
\code
import QtQuickVnc
\endcode
\generatelist qmltypesbymodule QtQuickVnc
\noautolist
*/
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\module QtVncServer
\title Qt VNC Server C++ Classes
\ingroup modules
\qtvariable vncserver
\qtcmakepackage VncServer
\brief The \l {Qt VNC Server} module provides APIs for creating a simple VNC server
with Qt.
\section1 Qt VNC Server Module
\generatelist {classesbymodule QtVncServer}
*/
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qtvncserver-index.html
\title Qt VNC Server
\brief Provides API for creating a VNC server with Qt.
Qt VNC Server provides APIs for creating a simple VNC server with Qt. The VNC server uses the
"Remote Frame Buffer protocol" (RFB) to share graphics and input between the server and one or more
remote VNC clients.
A typical use case is to share parts of a Qt Quick application with a remote user or remote screen,
by using the QtQuickVnc module. Using VNC client software, the remote user will be able to see and
interact with the application.
The module can be combined with \l{Qt Wayland Compositor} in order to make a remote desktop
solution.
\section1 Using the Module
\section2 QML API
\include {module-use.qdocinc} {using the qml api} {QtQuickVnc}
\section2 C++ API
\section1 Examples
The best way to see what Qt VNC Server can do is to check out the examples:
\list
\endlist
\section1 Reference
\list
\li \l{Qt VNC Server QML Types}
\li \l{Qt VNC Server C++ Classes}
\endlist
\section1 Technology Preview
Qt VNC Server is a technology preview. There are no source or binary compatibility guarantees,
as APIs may change based on user feedback and general improvements.
\section1 License and Attributions
Qt VNC Server is available under the commercial license from \l {The Qt Company}.
In addition, it is available under the
\l{GNU General Public License, version 3}.
See \l {Qt Licensing} for further details.
*/
......@@ -60,6 +60,18 @@ public:
QByteArray password;
};
/*!
* \class QVncServer
* \inmodule QtVncServer
* \brief The QVncServer is a QTcpServer which supports the RFB protocol.
*
* The QVncServer can be used to create a TCP server which accepts connections from VNC clients.
*/
/*!
* Constructs a QVncSserver with the given \a screenSize and \a screenFormat. This will open a
* TCP server listening for RFB connections on \a port.
*/
QVncServer::QVncServer(const QSize &screenSize, QImage::Format screenFormat, quint16 port)
: QTcpServer(QAbstractSocket::TcpSocket, *new QVncServerPrivate)
{
......@@ -73,6 +85,10 @@ QVncServer::QVncServer(const QSize &screenSize, QImage::Format screenFormat, qui
QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
}
/*!
* \internal
* Initializes the QVncServer
*/
void QVncServer::init()
{
Q_D(QVncServer);
......@@ -103,6 +119,9 @@ void QVncServer::incomingConnection(qintptr handle)
setIsConnected(true);
}
/*!
* Destroys the QVncServer. This will disconnect all clients.
*/
QVncServer::~QVncServer()
{
Q_D(QVncServer);
......@@ -112,18 +131,28 @@ QVncServer::~QVncServer()
delete d->clientCursor;
}
/*!
* Returns the a rectangle spanning from (0, 0) with the dimensions passed to the constructor.
*/
QRect QVncServer::screenGeometry() const
{
Q_D(const QVncServer);
return QRect(QPoint{}, d->screenSize);
}
/*!
* Returns the format passed to the constructor.
*/
QImage::Format QVncServer::screenFormat() const
{
Q_D(const QVncServer);
return d->screenFormat;
}
/*!
* \internal
* Alert all connected clients that an update is needed.
*/
void QVncServer::setDirty()
{
Q_D(QVncServer);
......@@ -134,6 +163,10 @@ void QVncServer::setDirty()
//qvnc_screen->clearDirty();
}
/*!
* \internal
* Disconnects client \a c.
*/
void QVncServer::discardClient(QObject *c)
{
Q_D(QVncServer);
......@@ -155,12 +188,20 @@ void QVncServer::discardClient(QObject *c)
}
}
/*!
* \property QVncServer::isConnected
*
* This property is set to true if any client is connected to the server, and false if not.
*/
bool QVncServer::isConnected() const
{
Q_D(const QVncServer);
return d->isConnected;
}
/*!
* Provides a \a cursor for clients supporting this.
*/
void QVncServer::setCursor(QCursor *cursor)
{
Q_D(QVncServer);
......@@ -168,6 +209,10 @@ void QVncServer::setCursor(QCursor *cursor)
d->clientCursor->changeCursor(cursor, nullptr);
}
/*!
* \internal
* Enables the client cursor for \a client.
*/
void QVncServer::enableClientCursor(QVncClient *client)
{
#if QT_CONFIG(cursor)
......@@ -180,6 +225,10 @@ void QVncServer::enableClientCursor(QVncClient *client)
#endif
}
/*!
* \internal
* Sets the server's connected state to \a newIsConnected.
*/
void QVncServer::setIsConnected(bool newIsConnected)
{
Q_D(QVncServer);
......@@ -193,6 +242,12 @@ void QVncServer::setIsConnected(bool newIsConnected)
emit isConnectedChanged(newIsConnected);
}
/*!
* Sets the current \a image provided to clients. For images where the vertical origin
* is at the bottom, pass true for \a flippedVertically, otherwise false.
*
* \sa screenImage()
*/
void QVncServer::provideImage(const QImage &image, bool flippedVertically)
{
Q_D(QVncServer);
......@@ -208,6 +263,15 @@ void QVncServer::provideImage(const QImage &image, bool flippedVertically)
setDirty();
}
/*!
* Returns the current image shared by the server to clients. If \a isFlipped is not null, its
* contents will be set to true if the current image's origin is at the bottom, and false if it
* is at the top.
*
* \note This function is thread-safe.
*
* \sa provideImage()
*/
QImage QVncServer::screenImage(bool *isFlipped) const
{
Q_D(const QVncServer);
......@@ -218,13 +282,26 @@ QImage QVncServer::screenImage(bool *isFlipped) const
}
// TODO: we probably need one client cursor per client
/*!
* \internal
* Returns the current client cursor.
*/
QVncClientCursor *QVncServer::clientCursor() const
{
Q_D(const QVncServer);
return d->clientCursor;
}
/*!
* \property QVncServer::password
*
* This property holds the password for the VNC server. By default, the property is the empty
* string. If left empty, no authentication will be enabled for the server. If set, it will enable
* DEC authentication.
*
* \note DEC authentication is considered weak protection, and the connection itself is not
* encrypted. This protects mainly against accidental intrusion, but not against targeted attacks.
*/
const QByteArray &QVncServer::password() const
{
Q_D(const QVncServer);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment