diff options
author | Andy Nichols <andy.nichols@theqtcompany.com> | 2016-06-21 12:44:31 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-06-28 10:18:38 +0000 |
commit | adf6bd931fe479b058752fb615c30c87ba661f46 (patch) | |
tree | 0a6f2d5c0001dd9e024668c4bad9026e2a55696a /src/plugins/platforms/vnc/qvncscreen.cpp | |
parent | 2cf3696d9f11ae2aa2dba56a0774bea10d59a482 (diff) |
Add plugin arguments to VNC plugin
It is now possible to specify a port number to run the VNC server on, as
well as the screen properties:
Logical Size
Physical Size
Depth
Change-Id: I79b38c6e37ad5abb5e158eca9a17d7e8a86e692f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/platforms/vnc/qvncscreen.cpp')
-rw-r--r-- | src/plugins/platforms/vnc/qvncscreen.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp index 2b38ce6c51..532b9225da 100644 --- a/src/plugins/platforms/vnc/qvncscreen.cpp +++ b/src/plugins/platforms/vnc/qvncscreen.cpp @@ -43,6 +43,7 @@ #include <QtPlatformSupport/private/qfbcursor_p.h> #include <QtGui/QPainter> +#include <QtCore/QRegularExpression> QT_BEGIN_NAMESPACE @@ -62,11 +63,27 @@ QVncScreen::~QVncScreen() bool QVncScreen::initialize() { + QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); + QRegularExpression mmSizeRx(QLatin1String("mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)")); + QRegularExpression depthRx(QLatin1String("depth=(\\d+)")); + mGeometry = QRect(0, 0, 1024, 768); mFormat = QImage::Format_ARGB32_Premultiplied; mDepth = 32; mPhysicalSize = QSizeF(mGeometry.width()/96.*25.4, mGeometry.height()/96.*25.4); + for (const QString &arg : mArgs) { + QRegularExpressionMatch match; + if (arg.contains(mmSizeRx, &match)) { + mPhysicalSize = QSizeF(match.captured("width").toDouble(), match.captured("height").toDouble()); + } else if (arg.contains(sizeRx, &match)) { + mGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt())); + } else if (arg.contains(depthRx, &match)) { + mDepth = match.captured(1).toInt(); + } + } + + QFbScreen::initializeCompositor(); QT_VNC_DEBUG() << "QVncScreen::init" << geometry(); |