diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-02-25 13:51:41 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-03-14 13:55:36 +0200 |
commit | b72cc1f31784346884c8552c22f1e4c3c6d5ed1d (patch) | |
tree | 00a04967dc56ccdc69ee998058c13911292ecef7 /subsurface-desktop-main.cpp | |
parent | 4e44fe7598430f9879736ec2d00b99b15dc05451 (diff) | |
download | subsurface-b72cc1f31784346884c8552c22f1e4c3c6d5ed1d.tar.gz |
Cleanup: consistently use qPrintable()
Replace constructs of the kind
s.toUtf8().data(),
s.toUtf8().constData(),
s.toLocal8Bit().data(),
s.toLocal8Bit.constData() or
qUtf8Printable(s)
by
qPrintable(s).
This is concise, consistent and - in principle - more performant than
the .data() versions.
Sadly, owing to a suboptimal implementation, qPrintable(s) currently
is a pessimization compared to s.toUtf8().data(). A fix is scheduled for
new Qt versions: https://codereview.qt-project.org/#/c/221331/
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'subsurface-desktop-main.cpp')
-rw-r--r-- | subsurface-desktop-main.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index c439179c8..765b3e943 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -56,7 +56,7 @@ int main(int argc, char **argv) if (a.isEmpty()) continue; if (a.at(0) == '-') { - parse_argument(a.toLocal8Bit().data()); + parse_argument(qPrintable(a)); continue; } if (imported) { @@ -142,7 +142,7 @@ void validateGL() if (!quickBackend.isEmpty()) { if (verbose) { qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "'QT_QUICK_BACKEND' is set to '%1'. " - "Skipping validation.").arg(quickBackend).toUtf8().data(); + "Skipping validation.").arg(quickBackend); } return; } @@ -160,7 +160,7 @@ void validateGL() goto exit; } if (verbose) - qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "created OpenGLContext.").toUtf8().data(); + qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "created OpenGLContext."); ctx.makeCurrent(&surface); func = ctx.functions(); if (!func) { @@ -168,7 +168,7 @@ void validateGL() goto exit; } if (verbose) - qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "obtained QOpenGLFunctions.").toUtf8().data(); + qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "obtained QOpenGLFunctions."); // detect version for legacy profiles verChar = (const char *)func->glGetString(GL_VERSION); if (verChar) { @@ -178,7 +178,7 @@ void validateGL() "Attempting to run with the available profile!\n" "If this fails try manually setting the environment variable\n" "'QT_QUICK_BACKEND' with the value of 'software'\n" - "before running Subsurface!\n").toUtf8().data(); + "before running Subsurface!\n"); return; } int min, maj; @@ -197,7 +197,7 @@ void validateGL() goto exit; } if (verbose) - qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "detected OpenGL version %1.%2.").arg(verMajor).arg(verMinor).toUtf8().data(); + qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "detected OpenGL version %1.%2.").arg(verMajor).arg(verMinor); if (verMajor * 10 + verMinor < 21) { // set 2.1 as the minimal version glError = "OpenGL 2.1 or later is required"; goto exit; @@ -211,10 +211,10 @@ exit: qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "ERROR: %1.\n" "Cannot automatically fallback to a software renderer!\n" "Set the environment variable 'QT_QUICK_BACKEND' with the value of 'software'\n" - "before running Subsurface!\n").arg(glError).toUtf8().data(); + "before running Subsurface!\n").arg(glError); exit(0); #else - qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError).toUtf8().data(); + qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError); QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software); #endif } |