summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-04-13 16:28:09 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2022-04-14 15:29:06 +0200
commitd0a08d1f1176f00a8f3dde8dba49f139ab1e2535 (patch)
tree3761ba328ab3d4d189bb9be5168876ff34214b4b
parent252e3a1526dc01c5e5024a4ff4f4fb2e87fbc3d2 (diff)
Android: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Iebcbdbd7cecac09d0a7039e3ef6a4509d33039ba Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.cpp10
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp2
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp24
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp4
-rw-r--r--src/plugins/platforms/android/qandroidplatformfontdatabase.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidsystemlocale.cpp2
-rw-r--r--src/tools/androiddeployqt/main.cpp128
-rw-r--r--src/tools/androidtestrunner/main.cpp16
10 files changed, 101 insertions, 103 deletions
diff --git a/src/plugins/platforms/android/androidcontentfileengine.cpp b/src/plugins/platforms/android/androidcontentfileengine.cpp
index c5ead186c9..2be5614eaf 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.cpp
+++ b/src/plugins/platforms/android/androidcontentfileengine.cpp
@@ -60,15 +60,15 @@ bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode,
Q_UNUSED(permissions);
QString openModeStr;
if (openMode & QFileDevice::ReadOnly) {
- openModeStr += QLatin1Char('r');
+ openModeStr += u'r';
}
if (openMode & QFileDevice::WriteOnly) {
- openModeStr += QLatin1Char('w');
+ openModeStr += u'w';
}
if (openMode & QFileDevice::Truncate) {
- openModeStr += QLatin1Char('t');
+ openModeStr += u't';
} else if (openMode & QFileDevice::Append) {
- openModeStr += QLatin1Char('a');
+ openModeStr += u'a';
}
m_pfd = QJniObject::callStaticObjectMethod("org/qtproject/qt/android/QtNative",
@@ -152,7 +152,7 @@ QString AndroidContentFileEngine::fileName(FileName f) const
return m_file;
case BaseName:
{
- const int pos = m_file.lastIndexOf(QChar(QLatin1Char('/')));
+ const qsizetype pos = m_file.lastIndexOf(u'/');
return m_file.mid(pos);
}
default:
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index aa24c7d775..ff27f77090 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -328,7 +328,7 @@ namespace QtAndroid
QString manufacturer = QJniObject::getStaticObjectField("android/os/Build", "MANUFACTURER", "Ljava/lang/String;").toString();
QString model = QJniObject::getStaticObjectField("android/os/Build", "MODEL", "Ljava/lang/String;").toString();
- return manufacturer + QLatin1Char(' ') + model;
+ return manufacturer + u' ' + model;
}
jint generateViewId()
diff --git a/src/plugins/platforms/android/androidjnimenu.cpp b/src/plugins/platforms/android/androidjnimenu.cpp
index 9b49140335..cfca712e44 100644
--- a/src/plugins/platforms/android/androidjnimenu.cpp
+++ b/src/plugins/platforms/android/androidjnimenu.cpp
@@ -181,12 +181,12 @@ namespace QtAndroidMenu
static QString removeAmpersandEscapes(QString s)
{
- int i = 0;
+ qsizetype i = 0;
while (i < s.size()) {
++i;
- if (s.at(i-1) != QLatin1Char('&'))
+ if (s.at(i - 1) != u'&')
continue;
- if (i < s.size() && s.at(i) == QLatin1Char('&'))
+ if (i < s.size() && s.at(i) == u'&')
++i;
s.remove(i-1,1);
}
diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
index 0c6fb92ffb..21feb91339 100644
--- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
+++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
@@ -57,16 +57,16 @@ static inline QString cleanedAssetPath(QString file)
if (file.startsWith(assetsPrefix))
file.remove(0, prefixSize);
file.replace(QLatin1String("//"), QLatin1String("/"));
- if (file.startsWith(QLatin1Char('/')))
+ if (file.startsWith(u'/'))
file.remove(0, 1);
- if (file.endsWith(QLatin1Char('/')))
+ if (file.endsWith(u'/'))
file.chop(1);
return file;
}
static inline QString prefixedPath(QString path)
{
- path = assetsPrefix + QLatin1Char('/') + path;
+ path = assetsPrefix + u'/' + path;
path.replace(QLatin1String("//"), QLatin1String("/"));
return path;
}
@@ -81,7 +81,7 @@ struct AssetItem {
AssetItem (const QString &rawName)
: name(rawName)
{
- if (name.endsWith(QLatin1Char('/'))) {
+ if (name.endsWith(u'/')) {
type = Type::Folder;
name.chop(1);
}
@@ -114,7 +114,7 @@ public:
{
if (filePath.isEmpty())
return AssetItem::Type::Folder;
- const QStringList paths = filePath.split(QLatin1Char('/'));
+ const QStringList paths = filePath.split(u'/');
QString fullPath;
AssetItem::Type res = AssetItem::Type::Invalid;
for (const auto &path: paths) {
@@ -125,7 +125,7 @@ public:
if (it == folder->end() || it->name != path)
return AssetItem::Type::Invalid;
if (!fullPath.isEmpty())
- fullPath.append(QLatin1Char('/'));
+ fullPath.append(u'/');
fullPath += path;
res = it->type;
}
@@ -156,7 +156,7 @@ public:
}), item);
}
}
- m_path = assetsPrefix + QLatin1Char('/') + m_path + QLatin1Char('/');
+ m_path = assetsPrefix + u'/' + m_path + u'/';
m_path.replace(QLatin1String("//"), QLatin1String("/"));
}
@@ -329,21 +329,21 @@ public:
QString fileName(FileName file = DefaultName) const override
{
- int pos;
+ qsizetype pos;
switch (file) {
case DefaultName:
case AbsoluteName:
case CanonicalName:
return prefixedPath(m_fileName);
case BaseName:
- if ((pos = m_fileName.lastIndexOf(QChar(QLatin1Char('/')))) != -1)
+ if ((pos = m_fileName.lastIndexOf(u'/')) != -1)
return prefixedPath(m_fileName.mid(pos));
else
return prefixedPath(m_fileName);
case PathName:
case AbsolutePathName:
case CanonicalPathName:
- if ((pos = m_fileName.lastIndexOf(QChar(QLatin1Char('/')))) != -1)
+ if ((pos = m_fileName.lastIndexOf(u'/')) != -1)
return prefixedPath(m_fileName.left(pos));
else
return prefixedPath(m_fileName);
@@ -401,9 +401,9 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file
QString path = fileName.mid(prefixSize);
path.replace(QLatin1String("//"), QLatin1String("/"));
- if (path.startsWith(QLatin1Char('/')))
+ if (path.startsWith(u'/'))
path.remove(0, 1);
- if (path.endsWith(QLatin1Char('/')))
+ if (path.endsWith(u'/'))
path.chop(1);
return new AndroidAbstractFileEngine(m_assetManager, path);
}
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index a6418e94d3..0cce19534b 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -1147,7 +1147,7 @@ void QAndroidInputContext::focusObjectStartComposing()
return;
// Composing strings containing newline characters are rare and may cause problems
- if (m_composingText.contains(QLatin1Char('\n')))
+ if (m_composingText.contains(u'\n'))
return;
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
@@ -1230,7 +1230,7 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/)
if (focusObjectIsComposing())
surroundingText += QStringView{m_composingText}.left(m_composingCursor - m_composingTextStart);
// Add a character to see if it is at the end of the sentence or not
- QTextBoundaryFinder finder(QTextBoundaryFinder::Sentence, surroundingText + QLatin1Char('A'));
+ QTextBoundaryFinder finder(QTextBoundaryFinder::Sentence, surroundingText + u'A');
finder.setPosition(surroundingText.length());
if (finder.isAtBoundary())
atWordBoundary = finder.isAtBoundary();
@@ -1450,7 +1450,7 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur
const bool focusObjectWasComposing = focusObjectIsComposing();
// Same checks as in focusObjectStartComposing()
- if (!m_composingText.isEmpty() && !m_composingText.contains(QLatin1Char('\n'))
+ if (!m_composingText.isEmpty() && !m_composingText.contains(u'\n')
&& newAbsoluteCursorPos >= m_composingTextStart
&& newAbsoluteCursorPos <= m_composingTextStart + m_composingText.length())
m_composingCursor = newAbsoluteCursorPos;
diff --git a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
index ddf58e095b..03f19c5f87 100644
--- a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
+++ b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
@@ -73,8 +73,8 @@ static QString htmlText(QString text)
{
if (Qt::mightBeRichText(text))
return text;
- text.remove(QLatin1Char('\r'));
- return text.toHtmlEscaped().replace(QLatin1Char('\n'), QLatin1String("<br />"));
+ text.remove(u'\r');
+ return text.toHtmlEscaped().replace(u'\n', QLatin1String("<br />"));
}
bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags,
diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
index 925d1b34af..c603213793 100644
--- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
+++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
@@ -82,11 +82,11 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
{
QStringList result;
if (styleHint == QFont::Monospace || styleHint == QFont::Courier)
- result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(QLatin1Char(';')));
+ result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(u';'));
else if (styleHint == QFont::Serif)
- result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(QLatin1Char(';')));
+ result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(u';'));
else
- result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(QLatin1Char(';')));
+ result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(u';'));
result.append(QFreeTypeFontDatabase::fallbacksForFamily(family, style, styleHint, script));
return result;
diff --git a/src/plugins/platforms/android/qandroidsystemlocale.cpp b/src/plugins/platforms/android/qandroidsystemlocale.cpp
index 74a549454d..2748b26945 100644
--- a/src/plugins/platforms/android/qandroidsystemlocale.cpp
+++ b/src/plugins/platforms/android/qandroidsystemlocale.cpp
@@ -72,7 +72,7 @@ void QAndroidSystemLocale::getLocaleFromJava() const
QString languageCode = javaLocaleObject.callObjectMethod("getLanguage", "()Ljava/lang/String;").toString();
QString countryCode = javaLocaleObject.callObjectMethod("getCountry", "()Ljava/lang/String;").toString();
- m_locale = QLocale(languageCode + QLatin1Char('_') + countryCode);
+ m_locale = QLocale(languageCode + u'_' + countryCode);
}
QVariant QAndroidSystemLocale::query(QueryType type, QVariant in) const
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index e1d097619e..6299e53711 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -69,7 +69,7 @@ static QStringList dependenciesForDepfile;
FILE *openProcess(const QString &command)
{
#if defined(Q_OS_WIN32)
- QString processedCommand = QLatin1Char('\"') + command + QLatin1Char('\"');
+ QString processedCommand = u'\"' + command + u'\"';
#else
const QString& processedCommand = command;
#endif
@@ -271,9 +271,9 @@ static QString shellQuoteUnix(const QString &arg)
QString ret(arg);
if (hasSpecialChars(ret, iqm)) {
- ret.replace(QLatin1Char('\''), QLatin1String("'\\''"));
- ret.prepend(QLatin1Char('\''));
- ret.append(QLatin1Char('\''));
+ ret.replace(u'\'', QLatin1String("'\\''"));
+ ret.prepend(u'\'');
+ ret.append(u'\'');
}
return ret;
}
@@ -301,18 +301,18 @@ static QString shellQuoteWin(const QString &arg)
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
- int i = ret.length();
- while (i > 0 && ret.at(i - 1) == QLatin1Char('\\'))
+ qsizetype i = ret.length();
+ while (i > 0 && ret.at(i - 1) == u'\\')
--i;
- ret.insert(i, QLatin1Char('"'));
- ret.prepend(QLatin1Char('"'));
+ ret.insert(i, u'"');
+ ret.prepend(u'"');
}
return ret;
}
static QString shellQuote(const QString &arg)
{
- if (QDir::separator() == QLatin1Char('\\'))
+ if (QDir::separator() == u'\\')
return shellQuoteWin(arg);
else
return shellQuoteUnix(arg);
@@ -586,8 +586,8 @@ Options parseOptions()
options.outputDirectory.clear();
} else {
options.outputDirectory = QFileInfo(options.outputDirectory).canonicalFilePath();
- if (!options.outputDirectory.endsWith(QLatin1Char('/')))
- options.outputDirectory += QLatin1Char('/');
+ if (!options.outputDirectory.endsWith(u'/'))
+ options.outputDirectory += u'/';
}
return options;
@@ -778,7 +778,7 @@ QString cleanPackageName(QString packageName)
};
for (QChar &c : packageName) {
if (!isLegalChar(c))
- c = QLatin1Char('_');
+ c = u'_';
}
static QStringList keywords;
@@ -803,17 +803,16 @@ QString cleanPackageName(QString packageName)
}
// No keywords
- int index = -1;
+ qsizetype index = -1;
while (index < packageName.length()) {
- int next = packageName.indexOf(QLatin1Char('.'), index + 1);
+ qsizetype next = packageName.indexOf(u'.', index + 1);
if (next == -1)
next = packageName.length();
QString word = packageName.mid(index + 1, next - index - 1);
if (!word.isEmpty()) {
QChar c = word[0];
- if ((c >= QChar(QLatin1Char('0')) && c<= QChar(QLatin1Char('9')))
- || c == QLatin1Char('_')) {
- packageName.insert(index + 1, QLatin1Char('a'));
+ if ((c >= u'0' && c <= u'9') || c == u'_') {
+ packageName.insert(index + 1, u'a');
index = next + 1;
continue;
}
@@ -1034,7 +1033,7 @@ bool readInputFile(Options *options)
continue;
if (!options->architectures.contains(it.key())) {
fprintf(stderr, "Architecture %s unknown (%s).", qPrintable(it.key()),
- qPrintable(options->architectures.keys().join(QLatin1Char(','))));
+ qPrintable(options->architectures.keys().join(u',')));
return false;
}
options->architectures[it.key()].triple = it.value().toString();
@@ -1081,13 +1080,13 @@ bool readInputFile(Options *options)
{
const QJsonValue extraLibs = jsonObject.value(QLatin1String("android-extra-libs"));
if (!extraLibs.isUndefined())
- options->extraLibs = extraLibs.toString().split(QLatin1Char(','), Qt::SkipEmptyParts);
+ options->extraLibs = extraLibs.toString().split(u',', Qt::SkipEmptyParts);
}
{
const QJsonValue extraPlugins = jsonObject.value(QLatin1String("android-extra-plugins"));
if (!extraPlugins.isUndefined())
- options->extraPlugins = extraPlugins.toString().split(QLatin1Char(','));
+ options->extraPlugins = extraPlugins.toString().split(u',');
}
{
@@ -1117,7 +1116,7 @@ bool readInputFile(Options *options)
{
const QJsonValue qmlImportPaths = jsonObject.value(QLatin1String("qml-import-paths"));
if (!qmlImportPaths.isUndefined())
- options->qmlImportPaths = qmlImportPaths.toString().split(QLatin1Char(','));
+ options->qmlImportPaths = qmlImportPaths.toString().split(u',');
}
{
@@ -1156,7 +1155,7 @@ bool readInputFile(Options *options)
const QJsonValue deploymentDependencies = jsonObject.value(QLatin1String("deployment-dependencies"));
if (!deploymentDependencies.isUndefined()) {
QString deploymentDependenciesString = deploymentDependencies.toString();
- const auto dependencies = QStringView{deploymentDependenciesString}.split(QLatin1Char(','));
+ const auto dependencies = QStringView{deploymentDependenciesString}.split(u',');
for (const auto &dependency : dependencies) {
QString path = options->qtInstallDirectory + QChar::fromLatin1('/');
path += dependency;
@@ -1190,7 +1189,7 @@ bool readInputFile(Options *options)
}
{
const QJsonValue qrcFiles = jsonObject.value(QLatin1String("qrcFiles"));
- options->qrcFiles = qrcFiles.toString().split(QLatin1Char(','), Qt::SkipEmptyParts);
+ options->qrcFiles = qrcFiles.toString().split(u',', Qt::SkipEmptyParts);
}
{
const QJsonValue zstdCompressionFlag = jsonObject.value(QLatin1String("zstdCompression"));
@@ -1216,7 +1215,7 @@ bool copyFiles(const QDir &sourceDirectory, const QDir &destinationDirectory, co
return false;
}
- if (!copyFiles(dir, QDir(destinationDirectory.path() + QLatin1Char('/') + dir.dirName()), options, forceOverwrite))
+ if (!copyFiles(dir, QDir(destinationDirectory.path() + u'/' + dir.dirName()), options, forceOverwrite))
return false;
} else {
QString destination = destinationDirectory.absoluteFilePath(entry.fileName());
@@ -1339,7 +1338,7 @@ bool copyAndroidExtraLibs(Options *options)
QString destinationFile(options->outputDirectory
+ QLatin1String("/libs/")
+ options->currentArchitecture
- + QLatin1Char('/')
+ + u'/'
+ extraLibInfo.fileName());
if (!copyFileIfNewer(extraLib, destinationFile, *options))
@@ -1381,8 +1380,8 @@ bool copyAndroidExtraResources(Options *options)
}
QDir resourceDir(extraResource);
- QString assetsDir = options->outputDirectory + QLatin1String("/assets/") + resourceDir.dirName() + QLatin1Char('/');
- QString libsDir = options->outputDirectory + QLatin1String("/libs/") + options->currentArchitecture + QLatin1Char('/');
+ QString assetsDir = options->outputDirectory + QLatin1String("/assets/") + resourceDir.dirName() + u'/';
+ QString libsDir = options->outputDirectory + QLatin1String("/libs/") + options->currentArchitecture + u'/';
const QStringList files = allFilesInside(resourceDir, resourceDir);
for (const QString &resourceFile : files) {
@@ -1466,7 +1465,7 @@ bool updateLibsXml(Options *options)
for (auto it = options->architectures.constBegin(); it != options->architectures.constEnd(); ++it) {
if (!it->enabled)
continue;
- QString libsPath = QLatin1String("libs/") + it.key() + QLatin1Char('/');
+ QString libsPath = QLatin1String("libs/") + it.key() + u'/';
qtLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), options->stdCppName);
for (const Options::BundledFile &bundledFile : options->bundledFiles[it.key()]) {
@@ -1539,9 +1538,9 @@ bool updateLibsXml(Options *options)
// remove all paths
for (auto &lib : localLibs) {
if (lib.endsWith(QLatin1String(".so")))
- lib = lib.mid(lib.lastIndexOf(QLatin1Char('/')) + 1);
+ lib = lib.mid(lib.lastIndexOf(u'/') + 1);
}
- allLocalLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(QLatin1Char(':')));
+ allLocalLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(u':'));
}
options->initClasses.removeDuplicates();
@@ -1550,7 +1549,7 @@ bool updateLibsXml(Options *options)
replacements[QStringLiteral("<!-- %%INSERT_QT_LIBS%% -->")] += qtLibs.trimmed();
replacements[QStringLiteral("<!-- %%INSERT_LOCAL_LIBS%% -->")] = allLocalLibs.trimmed();
replacements[QStringLiteral("<!-- %%INSERT_EXTRA_LIBS%% -->")] = extraLibs.trimmed();
- const QString initClasses = options->initClasses.join(QLatin1Char(':'));
+ const QString initClasses = options->initClasses.join(u':');
replacements[QStringLiteral("<!-- %%INSERT_INIT_CLASSES%% -->")] = initClasses;
// Bundle and use libs from the apk because currently we don't have a way avoid
@@ -1658,8 +1657,7 @@ bool updateAndroidManifest(Options &options)
} else if (reader.name() == QLatin1String("meta-data")) {
const auto name = reader.attributes().value(QLatin1String("android:name"));
const auto value = reader.attributes().value(QLatin1String("android:value"));
- if (name == QLatin1String("android.app.lib_name")
- && value.contains(QLatin1Char(' '))) {
+ if (name == QLatin1String("android.app.lib_name") && value.contains(u' ')) {
fprintf(stderr, "The Activity's android.app.lib_name should not contain"
" spaces.\n");
return false;
@@ -1704,18 +1702,18 @@ static QString absoluteFilePath(const Options *options, const QString &relativeF
// Library directories from a build tree(extraLibraryDirs) have the higher priority.
if (relativeFileName.startsWith(QLatin1String("lib/"))) {
for (const auto &dir : options->extraLibraryDirs) {
- const QString path = dir + QLatin1Char('/') + relativeFileName.mid(sizeof("lib/") - 1);
+ const QString path = dir + u'/' + relativeFileName.mid(sizeof("lib/") - 1);
if (QFile::exists(path))
return path;
}
}
for (const auto &prefix : options->extraPrefixDirs) {
- const QString path = prefix + QLatin1Char('/') + relativeFileName;
+ const QString path = prefix + u'/' + relativeFileName;
if (QFile::exists(path))
return path;
}
- return options->qtInstallDirectory + QLatin1Char('/') + relativeFileName;
+ return options->qtInstallDirectory + u'/' + relativeFileName;
}
QList<QtDependency> findFilesRecursively(const Options &options, const QFileInfo &info, const QString &rootPath)
@@ -1744,12 +1742,12 @@ QList<QtDependency> findFilesRecursively(const Options &options, const QFileInfo
QList<QtDependency> findFilesRecursively(const Options &options, const QString &fileName)
{
for (const auto &prefix : options.extraPrefixDirs) {
- QFileInfo info(prefix + QLatin1Char('/') + fileName);
+ QFileInfo info(prefix + u'/' + fileName);
if (info.exists())
- return findFilesRecursively(options, info, prefix + QLatin1Char('/'));
+ return findFilesRecursively(options, info, prefix + u'/');
}
- QFileInfo info(options.qtInstallDirectory + QLatin1Char('/') + fileName);
- return findFilesRecursively(options, info, options.qtInstallDirectory + QLatin1Char('/'));
+ QFileInfo info(options.qtInstallDirectory + u'/' + fileName);
+ return findFilesRecursively(options, info, options.qtInstallDirectory + u'/');
}
bool readAndroidDependencyXml(Options *options,
@@ -2021,8 +2019,8 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
for (auto rootPath : options->rootPaths) {
rootPath = QFileInfo(rootPath).absoluteFilePath();
- if (!rootPath.endsWith(QLatin1Char('/')))
- rootPath += QLatin1Char('/');
+ if (!rootPath.endsWith(u'/'))
+ rootPath += u'/';
// After checking for qml folder imports we can add rootPath
if (!rootPath.isEmpty())
@@ -2034,10 +2032,10 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
if (!options->qrcFiles.isEmpty()) {
qmlImportScanner += QLatin1String(" -qrcFiles");
for (const QString &qrcFile : options->qrcFiles)
- qmlImportScanner += QLatin1Char(' ') + shellQuote(qrcFile);
+ qmlImportScanner += u' ' + shellQuote(qrcFile);
}
- qmlImportScanner += QLatin1String(" -importPath %1").arg(importPaths.join(QLatin1Char(' ')));
+ qmlImportScanner += QLatin1String(" -importPath %1").arg(importPaths.join(u' '));
if (options->verbose) {
fprintf(stdout, "Running qmlimportscanner with the following command: %s\n",
@@ -2088,8 +2086,8 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
}
QString absolutePath = info.absolutePath();
- if (!absolutePath.endsWith(QLatin1Char('/')))
- absolutePath += QLatin1Char('/');
+ if (!absolutePath.endsWith(u'/'))
+ absolutePath += u'/';
if (checkQmlFileInRootPaths(options, absolutePath)) {
if (options->verbose)
@@ -2116,7 +2114,7 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
return false;
}
- importPathOfThisImport = QDir(importPathOfThisImport).absolutePath() + QLatin1Char('/');
+ importPathOfThisImport = QDir(importPathOfThisImport).absolutePath() + u'/';
QList<QtDependency> qmlImportsDependencies;
auto collectQmlDependency = [&usedDependencies, &qmlImportsDependencies,
&importPathOfThisImport](const QString &filePath) {
@@ -2131,7 +2129,7 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
QString plugin = object.value(QLatin1String("plugin")).toString();
bool pluginIsOptional = object.value(QLatin1String("pluginIsOptional")).toBool();
QFileInfo pluginFileInfo = QFileInfo(
- path + QLatin1Char('/') + QLatin1String("lib") + plugin + QLatin1Char('_')
+ path + u'/' + QLatin1String("lib") + plugin + u'_'
+ options->currentArchitecture + QLatin1String(".so"));
QString pluginFilePath = pluginFileInfo.absoluteFilePath();
QSet<QString> remainingDependencies;
@@ -2145,7 +2143,7 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
continue;
}
- QFileInfo qmldirFileInfo = QFileInfo(path + QLatin1Char('/') + QLatin1String("qmldir"));
+ QFileInfo qmldirFileInfo = QFileInfo(path + u'/' + QLatin1String("qmldir"));
if (qmldirFileInfo.exists()) {
collectQmlDependency(qmldirFileInfo.absoluteFilePath());
}
@@ -2229,7 +2227,7 @@ bool createRcc(const Options &options)
if (!options.rccBinaryPath.isEmpty()) {
rcc = options.rccBinaryPath;
} else {
- rcc = options.qtInstallDirectory + QLatin1Char('/') + defaultLibexecDir()
+ rcc = options.qtInstallDirectory + u'/' + defaultLibexecDir()
+ QLatin1String("/rcc");
}
@@ -2303,7 +2301,7 @@ bool readDependencies(Options *options)
} else {
fprintf(stdout, "Skipping %s due to unmet dependencies: %s\n",
qPrintable(fileName),
- qPrintable(unmetDependencies.join(QLatin1Char(','))));
+ qPrintable(unmetDependencies.join(u',')));
}
}
@@ -2313,7 +2311,7 @@ bool readDependencies(Options *options)
if (!goodToCopy(options, absoluteFilePath(options, *it), &unmetDependencies)) {
fprintf(stdout, "Skipping %s due to unmet dependencies: %s\n",
qPrintable(*it),
- qPrintable(unmetDependencies.join(QLatin1Char(','))));
+ qPrintable(unmetDependencies.join(u',')));
it = options->localLibs[options->currentArchitecture].erase(it);
} else {
++it;
@@ -2433,9 +2431,9 @@ bool copyQtFiles(Options *options)
if (QDir::fromNativeSeparators(qtDependency.relativePath).startsWith(QLatin1String("lib/"))) {
garbledFileName = qtDependency.relativePath.mid(sizeof("lib/") - 1);
} else {
- garbledFileName = qtDependency.relativePath.mid(qtDependency.relativePath.lastIndexOf(QLatin1Char('/')) + 1);
+ garbledFileName = qtDependency.relativePath.mid(qtDependency.relativePath.lastIndexOf(u'/') + 1);
}
- destinationFileName = libsDirectory + options->currentArchitecture + QLatin1Char('/') + garbledFileName;
+ destinationFileName = libsDirectory + options->currentArchitecture + u'/' + garbledFileName;
} else if (QDir::fromNativeSeparators(qtDependency.relativePath).startsWith(QLatin1String("jar/"))) {
destinationFileName = libsDirectory + qtDependency.relativePath.mid(sizeof("jar/") - 1);
} else {
@@ -2457,14 +2455,14 @@ bool copyQtFiles(Options *options)
} else {
fprintf(stdout, " -- Skipping %s. It has unmet dependencies: %s.\n",
qPrintable(sourceFileName),
- qPrintable(unmetDependencies.join(QLatin1Char(','))));
+ qPrintable(unmetDependencies.join(u',')));
}
continue;
}
if (options->deploymentMechanism == Options::Bundled
&& !copyFileIfNewer(sourceFileName,
- options->outputDirectory + QLatin1Char('/') + destinationFileName,
+ options->outputDirectory + u'/' + destinationFileName,
*options)) {
return false;
}
@@ -2488,7 +2486,7 @@ QStringList getLibraryProjectsInOutputFolder(const Options &options)
if (equalSignIndex >= 0) {
QString path = QString::fromLocal8Bit(line.mid(equalSignIndex + 1));
- QFileInfo info(options.outputDirectory + QLatin1Char('/') + path);
+ QFileInfo info(options.outputDirectory + u'/' + path);
if (QDir::isRelativePath(path)
&& info.exists()
&& info.isDir()
@@ -2571,9 +2569,9 @@ QString findInPath(const QString &fileName)
const QStringList paths = path.split(separator);
for (const QString &path : paths) {
- QFileInfo fileInfo(path + QLatin1Char('/') + fileName);
+ QFileInfo fileInfo(path + u'/' + fileName);
if (fileInfo.exists() && fileInfo.isFile() && fileInfo.isExecutable())
- return path + QLatin1Char('/') + fileName;
+ return path + u'/' + fileName;
}
return QString();
@@ -2603,15 +2601,15 @@ static GradleProperties readGradleProperties(const QString &path)
static bool mergeGradleProperties(const QString &path, GradleProperties properties)
{
- QFile::remove(path + QLatin1Char('~'));
- QFile::rename(path, path + QLatin1Char('~'));
+ QFile::remove(path + u'~');
+ QFile::rename(path, path + u'~');
QFile file(path);
if (!file.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)) {
fprintf(stderr, "Can't open file: %s for writing\n", qPrintable(file.fileName()));
return false;
}
- QFile oldFile(path + QLatin1Char('~'));
+ QFile oldFile(path + u'~');
if (oldFile.open(QIODevice::ReadOnly)) {
while (!oldFile.atEnd()) {
QByteArray line(oldFile.readLine());
@@ -2652,7 +2650,7 @@ void checkAndWarnGradleLongPaths(const QString &outputDirectory)
"The maximum path length that can be processed by Gradle on Windows is %d characters.\n"
"Consider moving your project to reduce its path length.\n"
"The following files have too long paths:\n%s.\n",
- MAX_PATH, qPrintable(longFileNames.join(QLatin1Char('\n'))));
+ MAX_PATH, qPrintable(longFileNames.join(u'\n')));
}
}
#endif
@@ -2674,7 +2672,7 @@ bool buildAndroidProject(const Options &options)
// Projects using a custom build.gradle file may use this variable.
// ### Qt7: Remove the following line
gradleProperties["qt5AndroidDir"] = (options.qtInstallDirectory + QLatin1String("/src/android/java")).toUtf8();
- gradleProperties["androidCompileSdkVersion"] = options.androidPlatform.split(QLatin1Char('-')).last().toLocal8Bit();
+ gradleProperties["androidCompileSdkVersion"] = options.androidPlatform.split(u'-').last().toLocal8Bit();
gradleProperties["qtMinSdkVersion"] = options.minSdkVersion;
gradleProperties["qtTargetSdkVersion"] = options.targetSdkVersion;
gradleProperties["androidNdkVersion"] = options.ndkVersion.toUtf8();
@@ -2789,7 +2787,7 @@ QString packagePath(const Options &options, PackageType pt)
QString buildType(options.releasePackage ? QLatin1String("release/") : QLatin1String("debug/"));
if (QDir(path + buildType).exists())
path += buildType;
- path += QDir(options.outputDirectory).dirName() + QLatin1Char('-');
+ path += QDir(options.outputDirectory).dirName() + u'-';
if (options.releasePackage) {
path += QLatin1String("release-");
if (pt >= UnsignedAPK) {
diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp
index dbad68ffa3..2f13f911e2 100644
--- a/src/tools/androidtestrunner/main.cpp
+++ b/src/tools/androidtestrunner/main.cpp
@@ -211,9 +211,9 @@ static QString shellQuoteUnix(const QString &arg)
QString ret(arg);
if (hasSpecialChars(ret, iqm)) {
- ret.replace(QLatin1Char('\''), QStringLiteral("'\\''"));
- ret.prepend(QLatin1Char('\''));
- ret.append(QLatin1Char('\''));
+ ret.replace(u'\'', QStringLiteral("'\\''"));
+ ret.prepend(u'\'');
+ ret.append(u'\'');
}
return ret;
}
@@ -241,18 +241,18 @@ static QString shellQuoteWin(const QString &arg)
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
- int i = ret.length();
- while (i > 0 && ret.at(i - 1) == QLatin1Char('\\'))
+ qsizetype i = ret.length();
+ while (i > 0 && ret.at(i - 1) == u'\\')
--i;
- ret.insert(i, QLatin1Char('"'));
- ret.prepend(QLatin1Char('"'));
+ ret.insert(i, u'"');
+ ret.prepend(u'"');
}
return ret;
}
static QString shellQuote(const QString &arg)
{
- if (QDir::separator() == QLatin1Char('\\'))
+ if (QDir::separator() == u'\\')
return shellQuoteWin(arg);
else
return shellQuoteUnix(arg);