Commit 774df68e authored by Eskil Abrahamsen-Blomfeldt's avatar Eskil Abrahamsen-Blomfeldt
Browse files

Some more preparations for making a proper module

Documentation, renaming a private header, some additional
build files.
parent 72fb0796
qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(vncserver)
qt_examples_build_end()
qt_internal_add_example(vncchat)
qt_internal_add_module(QuickVnc
SOURCES
qvncitem.cpp qvncitem.h
qvncitem.cpp qvncitem_p.h
DEFINES
QT_NO_FOREACH
QT_NO_USING_NAMESPACE
......
......@@ -30,7 +30,7 @@
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqmlengine.h>
#include "qvncitem.h"
#include "qvncitem_p.h"
QT_BEGIN_NAMESPACE
......
......@@ -5,7 +5,7 @@ IMPORT_VERSION = 1.$$QT_MINOR_VERSION
QT += quick-private gui-private core-private network vncserver
HEADERS += \
qvncitem.h
qvncitem_p.h
SOURCES += \
plugin.cpp \
......
......@@ -27,7 +27,7 @@
**
****************************************************************************/
#include "qvncitem.h"
#include "qvncitem_p.h"
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qsgrhilayer_p.h>
#include <QtQuick/private/qquickwindow_p.h>
......@@ -44,6 +44,17 @@ Q_DECLARE_LOGGING_CATEGORY(lcVncFPS)
Q_LOGGING_CATEGORY(lcVncFPS, "qt.vncserver.fps");
Q_LOGGING_CATEGORY(lcVncTiming, "qt.vncserver.time");
/*!
\qmltype VncItem
\inqmlmodule QtQuickVnc
\brief Item for creating a VNC®-compatible server.
VncItem is a Qt Quick \l{Item} which will share its children over the RFB® protocol. It can be
the top-level item in the scene for sharing the full window, or any rectangular part of it.
Resizing the item will also resize the frames shared with clients.
As soon as the VncItem is initialized, it will accept connections.
*/
QVncItem::QVncItem()
: m_vncPort(QVncServer::DefaultPort)
{
......@@ -276,6 +287,11 @@ void QVncItem::handleImageRequest()
}
}
/*!
\qmlproperty bool VncItem::connectionEnabled
This property decides whether the server accepts new connections. Set this to \c false to
reject new connections. It is \c true by default.
*/
bool QVncItem::connectionEnabled() const
{
return m_connectionEnabled;
......@@ -295,6 +311,12 @@ void QVncItem::setConnectionEnabled(bool newConnectionEnabled)
emit connectionEnabledChanged();
}
/*!
\qmlproperty bool VncItem::remoteInputEnabled
This property decides whether input from remote clients is processed. If set to \c false then
clients will only be able to see the contents of the VncItem, but not actually interact with
it. The default is \c true.
*/
bool QVncItem::remoteInputEnabled() const
{
return m_remoteInputEnabled;
......@@ -507,6 +529,10 @@ QSGNode *QVncItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data)
return QQuickItem::updatePaintNode(node, data);
}
/*!
\qmlproperty bool VncItem::connectionActive
This property reflects whether there is currently one or more clients connected to the server.
*/
bool QVncItem::connectionActive() const
{
return m_connectionActive;
......@@ -525,6 +551,12 @@ void QVncItem::setConnectionActive(bool newConnectionActive)
emit connectionActiveChanged();
}
/*!
\qmlproperty int VncItem::vncPort
This property decides the port on which the VncItem listens to new connections. The default
value is 5900.
*/
int QVncItem::vncPort() const
{
return m_vncPort;
......@@ -538,7 +570,17 @@ void QVncItem::setVncPort(int newVncPort)
emit vncPortChanged();
}
/*!
\qmlproperty string VncItem::password
When set, this property enables DEC Authentication on the server and remote clients will have
to provide a matching password to connect.
\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.
\note This depends on the availability of \l{https://www.libtom.net/}{LibTomCrypt}, otherwise
it will have no effect.
*/
const QByteArray &QVncItem::password() const
{
return m_password;
......
......@@ -31,7 +31,8 @@ qhp.QtVncServer.subprojects.classes.sortPages = true
depends += qtcore qtgui qtquick qtwaylandcompositor
sourcedirs += .. \
headerdirs += ../..
sourcedirs += ../.. \
src
exampledirs += ../../../examples/vncserver
......
......@@ -62,15 +62,16 @@ public:
/*!
* \class QVncServer
* \brief The QVncServer is a QTcpServer which supports the RFB® protocol.
* \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.
* The QVncServer can be used to create a TCP server which accepts connections from VNC®-compatible
* 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.
* TCP server listening for RFB® connections on \a port.
*/
QVncServer::QVncServer(const QSize &screenSize, QImage::Format screenFormat, quint16 port)
: QTcpServer(QAbstractSocket::TcpSocket, *new QVncServerPrivate)
......@@ -246,6 +247,10 @@ void QVncServer::setIsConnected(bool 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.
*
* \note If the size or format of the image is different from the current size or format, the
* server's parameters will be updated. This requires support in the connected clients for updating
* image parameters while they are connected.
*
* \sa screenImage()
*/
void QVncServer::provideImage(const QImage &image, bool flippedVertically)
......@@ -295,9 +300,9 @@ QVncClientCursor *QVncServer::clientCursor() const
/*!
* \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.
* This property holds the password for the VNC®-compatible 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.
......
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