From adf6bd931fe479b058752fb615c30c87ba661f46 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 21 Jun 2016 12:44:31 +0200 Subject: 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 --- src/plugins/platforms/vnc/qvncscreen.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/plugins/platforms/vnc/qvncscreen.cpp') 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 #include +#include QT_BEGIN_NAMESPACE @@ -62,11 +63,27 @@ QVncScreen::~QVncScreen() bool QVncScreen::initialize() { + QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); + QRegularExpression mmSizeRx(QLatin1String("mmsize=(?(\\d*\\.)?\\d+)x(?(\\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(); -- cgit v1.2.3