diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-01-13 14:14:17 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-13 17:28:07 +0100 |
commit | 9752cf7d130a0ab1a7ece6e3fe698379d8835039 (patch) | |
tree | 99159ad9be3b7c93bb0163ac425a5d6e3c4ad103 | |
parent | 98504fb82da12133ae6b566c6dafd86e1076bc9a (diff) |
linuxfb: Migrate to QRegularExpression
Change-Id: Ieeef375a5f613c09b2c85f632a093dd575290ba2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index 735a43daf7..c0691a38fc 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp @@ -41,6 +41,7 @@ #include "qlinuxfbscreen.h" #include <QtPlatformSupport/private/qfbcursor_p.h> +#include <QtCore/QRegularExpression> #include <QtGui/QPainter> #include <private/qcore_unix_p.h> // overrides QT_OPEN @@ -318,11 +319,11 @@ QLinuxFbScreen::~QLinuxFbScreen() bool QLinuxFbScreen::initialize() { - QRegExp ttyRx(QLatin1String("tty=(.*)")); - QRegExp fbRx(QLatin1String("fb=(.*)")); - QRegExp mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); - QRegExp sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); - QRegExp offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); + QRegularExpression ttyRx(QLatin1String("tty=(.*)")); + QRegularExpression fbRx(QLatin1String("fb=(.*)")); + QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); + QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); + QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); QString fbDevice, ttyDevice; QSize userMmSize; @@ -331,18 +332,19 @@ bool QLinuxFbScreen::initialize() // Parse arguments foreach (const QString &arg, mArgs) { + QRegularExpressionMatch match; if (arg == QLatin1String("nographicsmodeswitch")) doSwitchToGraphicsMode = false; - else if (sizeRx.indexIn(arg) != -1) - userGeometry.setSize(QSize(sizeRx.cap(1).toInt(), sizeRx.cap(2).toInt())); - else if (offsetRx.indexIn(arg) != -1) - userGeometry.setTopLeft(QPoint(offsetRx.cap(1).toInt(), offsetRx.cap(2).toInt())); - else if (ttyRx.indexIn(arg) != -1) - ttyDevice = ttyRx.cap(1); - else if (fbRx.indexIn(arg) != -1) - fbDevice = fbRx.cap(1); - else if (mmSizeRx.indexIn(arg) != -1) - userMmSize = QSize(mmSizeRx.cap(1).toInt(), mmSizeRx.cap(2).toInt()); + else if (arg.contains(sizeRx, &match)) + userGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt())); + else if (arg.contains(offsetRx, &match)) + userGeometry.setTopLeft(QPoint(match.captured(1).toInt(), match.captured(2).toInt())); + else if (arg.contains(ttyRx, &match)) + ttyDevice = match.captured(1); + else if (arg.contains(fbRx, &match)) + fbDevice = match.captured(1); + else if (arg.contains(mmSizeRx, &match)) + userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt()); } if (fbDevice.isEmpty()) { |