linuxfb: Migrate to QRegularExpression
Change-Id: Ieeef375a5f613c09b2c85f632a093dd575290ba2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
98504fb82d
commit
9752cf7d13
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include "qlinuxfbscreen.h"
|
#include "qlinuxfbscreen.h"
|
||||||
#include <QtPlatformSupport/private/qfbcursor_p.h>
|
#include <QtPlatformSupport/private/qfbcursor_p.h>
|
||||||
|
#include <QtCore/QRegularExpression>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
|
|
||||||
#include <private/qcore_unix_p.h> // overrides QT_OPEN
|
#include <private/qcore_unix_p.h> // overrides QT_OPEN
|
||||||
@ -318,11 +319,11 @@ QLinuxFbScreen::~QLinuxFbScreen()
|
|||||||
|
|
||||||
bool QLinuxFbScreen::initialize()
|
bool QLinuxFbScreen::initialize()
|
||||||
{
|
{
|
||||||
QRegExp ttyRx(QLatin1String("tty=(.*)"));
|
QRegularExpression ttyRx(QLatin1String("tty=(.*)"));
|
||||||
QRegExp fbRx(QLatin1String("fb=(.*)"));
|
QRegularExpression fbRx(QLatin1String("fb=(.*)"));
|
||||||
QRegExp mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)"));
|
QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)"));
|
||||||
QRegExp sizeRx(QLatin1String("size=(\\d+)x(\\d+)"));
|
QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)"));
|
||||||
QRegExp offsetRx(QLatin1String("offset=(\\d+)x(\\d+)"));
|
QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)"));
|
||||||
|
|
||||||
QString fbDevice, ttyDevice;
|
QString fbDevice, ttyDevice;
|
||||||
QSize userMmSize;
|
QSize userMmSize;
|
||||||
@ -331,18 +332,19 @@ bool QLinuxFbScreen::initialize()
|
|||||||
|
|
||||||
// Parse arguments
|
// Parse arguments
|
||||||
foreach (const QString &arg, mArgs) {
|
foreach (const QString &arg, mArgs) {
|
||||||
|
QRegularExpressionMatch match;
|
||||||
if (arg == QLatin1String("nographicsmodeswitch"))
|
if (arg == QLatin1String("nographicsmodeswitch"))
|
||||||
doSwitchToGraphicsMode = false;
|
doSwitchToGraphicsMode = false;
|
||||||
else if (sizeRx.indexIn(arg) != -1)
|
else if (arg.contains(sizeRx, &match))
|
||||||
userGeometry.setSize(QSize(sizeRx.cap(1).toInt(), sizeRx.cap(2).toInt()));
|
userGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt()));
|
||||||
else if (offsetRx.indexIn(arg) != -1)
|
else if (arg.contains(offsetRx, &match))
|
||||||
userGeometry.setTopLeft(QPoint(offsetRx.cap(1).toInt(), offsetRx.cap(2).toInt()));
|
userGeometry.setTopLeft(QPoint(match.captured(1).toInt(), match.captured(2).toInt()));
|
||||||
else if (ttyRx.indexIn(arg) != -1)
|
else if (arg.contains(ttyRx, &match))
|
||||||
ttyDevice = ttyRx.cap(1);
|
ttyDevice = match.captured(1);
|
||||||
else if (fbRx.indexIn(arg) != -1)
|
else if (arg.contains(fbRx, &match))
|
||||||
fbDevice = fbRx.cap(1);
|
fbDevice = match.captured(1);
|
||||||
else if (mmSizeRx.indexIn(arg) != -1)
|
else if (arg.contains(mmSizeRx, &match))
|
||||||
userMmSize = QSize(mmSizeRx.cap(1).toInt(), mmSizeRx.cap(2).toInt());
|
userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fbDevice.isEmpty()) {
|
if (fbDevice.isEmpty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user