Android: use _L1 for for creating Latin-1 string literals

Task-number: QTBUG-98434
Change-Id: I5ee5fe079c9a4530f636e59f6171abfa523591f4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Sona Kurazyan 2022-04-13 16:44:37 +02:00
parent d0a08d1f11
commit b28ed7fdc2
11 changed files with 395 additions and 382 deletions

View File

@ -47,6 +47,7 @@
#include <QDebug> #include <QDebug>
using namespace QNativeInterface; using namespace QNativeInterface;
using namespace Qt::StringLiterals;
AndroidContentFileEngine::AndroidContentFileEngine(const QString &f) AndroidContentFileEngine::AndroidContentFileEngine(const QString &f)
: m_file(f) : m_file(f)
@ -175,9 +176,8 @@ AndroidContentFileEngineHandler::~AndroidContentFileEngineHandler() = default;
QAbstractFileEngine* AndroidContentFileEngineHandler::create(const QString &fileName) const QAbstractFileEngine* AndroidContentFileEngineHandler::create(const QString &fileName) const
{ {
if (!fileName.startsWith(QLatin1String("content"))) { if (!fileName.startsWith("content"_L1))
return nullptr; return nullptr;
}
return new AndroidContentFileEngine(fileName); return new AndroidContentFileEngine(fileName);
} }

View File

@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QAndroidIntegrationPlugin : public QPlatformIntegrationPlugin class QAndroidIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -54,7 +56,7 @@ public:
QPlatformIntegration *QAndroidIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration *QAndroidIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
if (!system.compare(QLatin1String("android"), Qt::CaseInsensitive)) if (!system.compare("android"_L1, Qt::CaseInsensitive))
return new QAndroidPlatformIntegration(paramList); return new QAndroidPlatformIntegration(paramList);
return nullptr; return nullptr;

View File

@ -49,14 +49,16 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static const QLatin1String assetsPrefix("assets:"); using namespace Qt::StringLiterals;
static const auto assetsPrefix = "assets:"_L1;
const static int prefixSize = 7; const static int prefixSize = 7;
static inline QString cleanedAssetPath(QString file) static inline QString cleanedAssetPath(QString file)
{ {
if (file.startsWith(assetsPrefix)) if (file.startsWith(assetsPrefix))
file.remove(0, prefixSize); file.remove(0, prefixSize);
file.replace(QLatin1String("//"), QLatin1String("/")); file.replace("//"_L1, "/"_L1);
if (file.startsWith(u'/')) if (file.startsWith(u'/'))
file.remove(0, 1); file.remove(0, 1);
if (file.endsWith(u'/')) if (file.endsWith(u'/'))
@ -67,7 +69,7 @@ static inline QString cleanedAssetPath(QString file)
static inline QString prefixedPath(QString path) static inline QString prefixedPath(QString path)
{ {
path = assetsPrefix + u'/' + path; path = assetsPrefix + u'/' + path;
path.replace(QLatin1String("//"), QLatin1String("/")); path.replace("//"_L1, "/"_L1);
return path; return path;
} }
@ -157,7 +159,7 @@ public:
} }
} }
m_path = assetsPrefix + u'/' + m_path + u'/'; m_path = assetsPrefix + u'/' + m_path + u'/';
m_path.replace(QLatin1String("//"), QLatin1String("/")); m_path.replace("//"_L1, "/"_L1);
} }
QString currentFileName() const QString currentFileName() const
@ -381,7 +383,7 @@ private:
AAsset *m_assetFile = nullptr; AAsset *m_assetFile = nullptr;
AAssetManager *m_assetManager = nullptr; AAssetManager *m_assetManager = nullptr;
// initialize with a name that can't be used as a file name // initialize with a name that can't be used as a file name
QString m_fileName = QLatin1String("."); QString m_fileName = "."_L1;
bool m_isFolder = false; bool m_isFolder = false;
}; };
@ -400,7 +402,7 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file
return nullptr; return nullptr;
QString path = fileName.mid(prefixSize); QString path = fileName.mid(prefixSize);
path.replace(QLatin1String("//"), QLatin1String("/")); path.replace("//"_L1, "/"_L1);
if (path.startsWith(u'/')) if (path.startsWith(u'/'))
path.remove(0, 1); path.remove(0, 1);
if (path.endsWith(u'/')) if (path.endsWith(u'/'))

View File

@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
namespace QtAndroidDialogHelpers { namespace QtAndroidDialogHelpers {
static jclass g_messageDialogHelperClass = nullptr; static jclass g_messageDialogHelperClass = nullptr;
@ -74,7 +76,7 @@ static QString htmlText(QString text)
if (Qt::mightBeRichText(text)) if (Qt::mightBeRichText(text))
return text; return text;
text.remove(u'\r'); text.remove(u'\r');
return text.toHtmlEscaped().replace(u'\n', QLatin1String("<br />")); return text.toHtmlEscaped().replace(u'\n', "<br />"_L1);
} }
bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags, bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags,

View File

@ -50,6 +50,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
namespace QtAndroidFileDialogHelper { namespace QtAndroidFileDialogHelper {
#define RESULT_OK -1 #define RESULT_OK -1
@ -172,7 +174,7 @@ void QAndroidPlatformFileDialogHelper::setMimeTypes()
mimeTypes.append(db.mimeTypeForFile(filter, QMimeDatabase::MatchExtension).name()); mimeTypes.append(db.mimeTypeForFile(filter, QMimeDatabase::MatchExtension).name());
} }
const QString initialType = mimeTypes.size() == 1 ? mimeTypes.at(0) : QLatin1String("*/*"); const QString initialType = mimeTypes.size() == 1 ? mimeTypes.at(0) : "*/*"_L1;
m_intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;", m_intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;",
QJniObject::fromString(initialType).object()); QJniObject::fromString(initialType).object());

View File

@ -43,14 +43,16 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QString QAndroidPlatformFontDatabase::fontDir() const QString QAndroidPlatformFontDatabase::fontDir() const
{ {
return QLatin1String("/system/fonts"); return "/system/fonts"_L1;
} }
QFont QAndroidPlatformFontDatabase::defaultFont() const QFont QAndroidPlatformFontDatabase::defaultFont() const
{ {
return QFont(QLatin1String("Roboto")); return QFont("Roboto"_L1);
} }
void QAndroidPlatformFontDatabase::populateFontDatabase() void QAndroidPlatformFontDatabase::populateFontDatabase()
@ -64,9 +66,9 @@ void QAndroidPlatformFontDatabase::populateFontDatabase()
} }
QStringList nameFilters; QStringList nameFilters;
nameFilters << QLatin1String("*.ttf") nameFilters << "*.ttf"_L1
<< QLatin1String("*.otf") << "*.otf"_L1
<< QLatin1String("*.ttc"); << "*.ttc"_L1;
const auto entries = dir.entryInfoList(nameFilters, QDir::Files); const auto entries = dir.entryInfoList(nameFilters, QDir::Files);
for (const QFileInfo &fi : entries) { for (const QFileInfo &fi : entries) {

View File

@ -80,6 +80,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QSize QAndroidPlatformIntegration::m_defaultScreenSize = QSize(320, 455); QSize QAndroidPlatformIntegration::m_defaultScreenSize = QSize(320, 455);
QRect QAndroidPlatformIntegration::m_defaultAvailableGeometry = QRect(0, 0, 320, 455); QRect QAndroidPlatformIntegration::m_defaultAvailableGeometry = QRect(0, 0, 320, 455);
QSize QAndroidPlatformIntegration::m_defaultPhysicalSize = QSize(50, 71); QSize QAndroidPlatformIntegration::m_defaultPhysicalSize = QSize(50, 71);
@ -286,9 +288,9 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
static bool needsBasicRenderloopWorkaround() static bool needsBasicRenderloopWorkaround()
{ {
static bool needsWorkaround = static bool needsWorkaround =
QtAndroid::deviceName().compare(QLatin1String("samsung SM-T211"), Qt::CaseInsensitive) == 0 QtAndroid::deviceName().compare("samsung SM-T211"_L1, Qt::CaseInsensitive) == 0
|| QtAndroid::deviceName().compare(QLatin1String("samsung SM-T210"), Qt::CaseInsensitive) == 0 || QtAndroid::deviceName().compare("samsung SM-T210"_L1, Qt::CaseInsensitive) == 0
|| QtAndroid::deviceName().compare(QLatin1String("samsung SM-T215"), Qt::CaseInsensitive) == 0; || QtAndroid::deviceName().compare("samsung SM-T215"_L1, Qt::CaseInsensitive) == 0;
return needsWorkaround; return needsWorkaround;
} }
@ -457,7 +459,7 @@ Qt::WindowState QAndroidPlatformIntegration::defaultWindowState(Qt::WindowFlags
return QPlatformIntegration::defaultWindowState(flags); return QPlatformIntegration::defaultWindowState(flags);
} }
static const QLatin1String androidThemeName("android"); static const auto androidThemeName = "android"_L1;
QStringList QAndroidPlatformIntegration::themeNames() const QStringList QAndroidPlatformIntegration::themeNames() const
{ {
return QStringList(QString(androidThemeName)); return QStringList(QString(androidThemeName));

View File

@ -50,6 +50,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QAndroidPlatformServices::QAndroidPlatformServices() QAndroidPlatformServices::QAndroidPlatformServices()
{ {
m_actionView = QJniObject::getStaticObjectField("android/content/Intent", "ACTION_VIEW", m_actionView = QJniObject::getStaticObjectField("android/content/Intent", "ACTION_VIEW",
@ -80,7 +82,7 @@ bool QAndroidPlatformServices::openUrl(const QUrl &theUrl)
// if the file is local, we need to pass the MIME type, otherwise Android // if the file is local, we need to pass the MIME type, otherwise Android
// does not start an Intent to view this file // does not start an Intent to view this file
QLatin1String fileScheme("file"); const auto fileScheme = "file"_L1;
if ((url.scheme().isEmpty() || url.scheme() == fileScheme) && QFile::exists(url.path())) { if ((url.scheme().isEmpty() || url.scheme() == fileScheme) && QFile::exists(url.path())) {
// a real URL including the scheme is needed, else the Intent can not be started // a real URL including the scheme is needed, else the Intent can not be started
url.setScheme(fileScheme); url.setScheme(fileScheme);

View File

@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
namespace { namespace {
const int textStyle_bold = 1; const int textStyle_bold = 1;
const int textStyle_italic = 2; const int textStyle_italic = 2;
@ -69,44 +71,44 @@ namespace {
static int fontType(const QString &androidControl) static int fontType(const QString &androidControl)
{ {
if (androidControl == QLatin1String("defaultStyle")) if (androidControl == "defaultStyle"_L1)
return QPlatformTheme::SystemFont; return QPlatformTheme::SystemFont;
if (androidControl == QLatin1String("textViewStyle")) if (androidControl == "textViewStyle"_L1)
return QPlatformTheme::LabelFont; return QPlatformTheme::LabelFont;
else if (androidControl == QLatin1String("buttonStyle")) else if (androidControl == "buttonStyle"_L1)
return QPlatformTheme::PushButtonFont; return QPlatformTheme::PushButtonFont;
else if (androidControl == QLatin1String("checkboxStyle")) else if (androidControl == "checkboxStyle"_L1)
return QPlatformTheme::CheckBoxFont; return QPlatformTheme::CheckBoxFont;
else if (androidControl == QLatin1String("radioButtonStyle")) else if (androidControl == "radioButtonStyle"_L1)
return QPlatformTheme::RadioButtonFont; return QPlatformTheme::RadioButtonFont;
else if (androidControl == QLatin1String("simple_list_item_single_choice")) else if (androidControl == "simple_list_item_single_choice"_L1)
return QPlatformTheme::ItemViewFont; return QPlatformTheme::ItemViewFont;
else if (androidControl == QLatin1String("simple_spinner_dropdown_item")) else if (androidControl == "simple_spinner_dropdown_item"_L1)
return QPlatformTheme::ComboMenuItemFont; return QPlatformTheme::ComboMenuItemFont;
else if (androidControl == QLatin1String("spinnerStyle")) else if (androidControl == "spinnerStyle"_L1)
return QPlatformTheme::ComboLineEditFont; return QPlatformTheme::ComboLineEditFont;
else if (androidControl == QLatin1String("simple_list_item")) else if (androidControl == "simple_list_item"_L1)
return QPlatformTheme::ListViewFont; return QPlatformTheme::ListViewFont;
return -1; return -1;
} }
static int paletteType(const QString &androidControl) static int paletteType(const QString &androidControl)
{ {
if (androidControl == QLatin1String("defaultStyle")) if (androidControl == "defaultStyle"_L1)
return QPlatformTheme::SystemPalette; return QPlatformTheme::SystemPalette;
if (androidControl == QLatin1String("textViewStyle")) if (androidControl == "textViewStyle"_L1)
return QPlatformTheme::LabelPalette; return QPlatformTheme::LabelPalette;
else if (androidControl == QLatin1String("buttonStyle")) else if (androidControl == "buttonStyle"_L1)
return QPlatformTheme::ButtonPalette; return QPlatformTheme::ButtonPalette;
else if (androidControl == QLatin1String("checkboxStyle")) else if (androidControl == "checkboxStyle"_L1)
return QPlatformTheme::CheckBoxPalette; return QPlatformTheme::CheckBoxPalette;
else if (androidControl == QLatin1String("radioButtonStyle")) else if (androidControl == "radioButtonStyle"_L1)
return QPlatformTheme::RadioButtonPalette; return QPlatformTheme::RadioButtonPalette;
else if (androidControl == QLatin1String("simple_list_item_single_choice")) else if (androidControl == "simple_list_item_single_choice"_L1)
return QPlatformTheme::ItemViewPalette; return QPlatformTheme::ItemViewPalette;
else if (androidControl == QLatin1String("editTextStyle")) else if (androidControl == "editTextStyle"_L1)
return QPlatformTheme::TextLineEditPalette; return QPlatformTheme::TextLineEditPalette;
else if (androidControl == QLatin1String("spinnerStyle")) else if (androidControl == "spinnerStyle"_L1)
return QPlatformTheme::ComboBoxPalette; return QPlatformTheme::ComboBoxPalette;
return -1; return -1;
} }
@ -118,17 +120,17 @@ static void setPaletteColor(const QVariantMap &object,
// QPalette::Active -> ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET // QPalette::Active -> ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET
palette.setColor(QPalette::Active, palette.setColor(QPalette::Active,
role, role,
QRgb(object.value(QLatin1String("ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET")).toInt())); QRgb(object.value("ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET"_L1).toInt()));
// QPalette::Inactive -> ENABLED_STATE_SET // QPalette::Inactive -> ENABLED_STATE_SET
palette.setColor(QPalette::Inactive, palette.setColor(QPalette::Inactive,
role, role,
QRgb(object.value(QLatin1String("ENABLED_STATE_SET")).toInt())); QRgb(object.value("ENABLED_STATE_SET"_L1).toInt()));
// QPalette::Disabled -> EMPTY_STATE_SET // QPalette::Disabled -> EMPTY_STATE_SET
palette.setColor(QPalette::Disabled, palette.setColor(QPalette::Disabled,
role, role,
QRgb(object.value(QLatin1String("EMPTY_STATE_SET")).toInt())); QRgb(object.value("EMPTY_STATE_SET"_L1).toInt()));
palette.setColor(QPalette::Current, role, palette.color(QPalette::Active, role)); palette.setColor(QPalette::Current, role, palette.color(QPalette::Active, role));
@ -137,17 +139,17 @@ static void setPaletteColor(const QVariantMap &object,
// QPalette::Active -> PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET // QPalette::Active -> PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET
palette.setColor(QPalette::Active, palette.setColor(QPalette::Active,
QPalette::BrightText, QPalette::BrightText,
QRgb(object.value(QLatin1String("PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET")).toInt())); QRgb(object.value("PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET"_L1).toInt()));
// QPalette::Inactive -> PRESSED_ENABLED_STATE_SET // QPalette::Inactive -> PRESSED_ENABLED_STATE_SET
palette.setColor(QPalette::Inactive, palette.setColor(QPalette::Inactive,
QPalette::BrightText, QPalette::BrightText,
QRgb(object.value(QLatin1String("PRESSED_ENABLED_STATE_SET")).toInt())); QRgb(object.value("PRESSED_ENABLED_STATE_SET"_L1).toInt()));
// QPalette::Disabled -> PRESSED_STATE_SET // QPalette::Disabled -> PRESSED_STATE_SET
palette.setColor(QPalette::Disabled, palette.setColor(QPalette::Disabled,
QPalette::BrightText, QPalette::BrightText,
QRgb(object.value(QLatin1String("PRESSED_STATE_SET")).toInt())); QRgb(object.value("PRESSED_STATE_SET"_L1).toInt()));
palette.setColor(QPalette::Current, QPalette::BrightText, palette.color(QPalette::Active, QPalette::BrightText)); palette.setColor(QPalette::Current, QPalette::BrightText, palette.color(QPalette::Active, QPalette::BrightText));
@ -155,17 +157,17 @@ static void setPaletteColor(const QVariantMap &object,
// QPalette::Active -> ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET // QPalette::Active -> ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET
palette.setColor(QPalette::Active, palette.setColor(QPalette::Active,
QPalette::HighlightedText, QPalette::HighlightedText,
QRgb(object.value(QLatin1String("ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET")).toInt())); QRgb(object.value("ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET"_L1).toInt()));
// QPalette::Inactive -> ENABLED_SELECTED_STATE_SET // QPalette::Inactive -> ENABLED_SELECTED_STATE_SET
palette.setColor(QPalette::Inactive, palette.setColor(QPalette::Inactive,
QPalette::HighlightedText, QPalette::HighlightedText,
QRgb(object.value(QLatin1String("ENABLED_SELECTED_STATE_SET")).toInt())); QRgb(object.value("ENABLED_SELECTED_STATE_SET"_L1).toInt()));
// QPalette::Disabled -> SELECTED_STATE_SET // QPalette::Disabled -> SELECTED_STATE_SET
palette.setColor(QPalette::Disabled, palette.setColor(QPalette::Disabled,
QPalette::HighlightedText, QPalette::HighlightedText,
QRgb(object.value(QLatin1String("SELECTED_STATE_SET")).toInt())); QRgb(object.value("SELECTED_STATE_SET"_L1).toInt()));
palette.setColor(QPalette::Current, palette.setColor(QPalette::Current,
QPalette::HighlightedText, QPalette::HighlightedText,
@ -198,10 +200,10 @@ QJsonObject AndroidStyle::loadStyleData()
if (!androidTheme.isEmpty() && !androidTheme.endsWith(slashChar)) if (!androidTheme.isEmpty() && !androidTheme.endsWith(slashChar))
androidTheme += slashChar; androidTheme += slashChar;
if (!androidTheme.isEmpty() && QFileInfo::exists(stylePath + androidTheme + QLatin1String("style.json"))) if (!androidTheme.isEmpty() && QFileInfo::exists(stylePath + androidTheme + "style.json"_L1))
stylePath += androidTheme; stylePath += androidTheme;
QFile f(stylePath + QLatin1String("style.json")); QFile f(stylePath + "style.json"_L1);
if (!f.open(QIODevice::ReadOnly)) if (!f.open(QIODevice::ReadOnly))
return QJsonObject(); return QJsonObject();
@ -228,7 +230,7 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
return std::shared_ptr<AndroidStyle>(); return std::shared_ptr<AndroidStyle>();
{ {
QFont font(QLatin1String("Droid Sans Mono"), 14.0 * 100 / 72); QFont font("Droid Sans Mono"_L1, 14.0 * 100 / 72);
style->m_fonts.insert(QPlatformTheme::FixedFont, font); style->m_fonts.insert(QPlatformTheme::FixedFont, font);
} }
@ -242,7 +244,7 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
continue; continue;
} }
QJsonObject item = value.toObject(); QJsonObject item = value.toObject();
QJsonObject::const_iterator attributeIterator = item.find(QLatin1String("qtClass")); QJsonObject::const_iterator attributeIterator = item.find("qtClass"_L1);
QByteArray qtClassName; QByteArray qtClassName;
if (attributeIterator != item.constEnd()) { if (attributeIterator != item.constEnd()) {
// The item has palette and font information for a specific Qt Class (e.g. QWidget, QPushButton, etc.) // The item has palette and font information for a specific Qt Class (e.g. QWidget, QPushButton, etc.)
@ -254,12 +256,12 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
QFont font; QFont font;
// Font size (in pixels) // Font size (in pixels)
attributeIterator = item.find(QLatin1String("TextAppearance_textSize")); attributeIterator = item.find("TextAppearance_textSize"_L1);
if (attributeIterator != item.constEnd()) if (attributeIterator != item.constEnd())
font.setPixelSize(int(attributeIterator.value().toDouble() / pixelDensity)); font.setPixelSize(int(attributeIterator.value().toDouble() / pixelDensity));
// Font style // Font style
attributeIterator = item.find(QLatin1String("TextAppearance_textStyle")); attributeIterator = item.find("TextAppearance_textStyle"_L1);
if (attributeIterator != item.constEnd()) { if (attributeIterator != item.constEnd()) {
const int style = int(attributeIterator.value().toDouble()); const int style = int(attributeIterator.value().toDouble());
font.setBold(style & textStyle_bold); font.setBold(style & textStyle_bold);
@ -267,7 +269,7 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
} }
// Font typeface // Font typeface
attributeIterator = item.find(QLatin1String("TextAppearance_typeface")); attributeIterator = item.find("TextAppearance_typeface"_L1);
if (attributeIterator != item.constEnd()) { if (attributeIterator != item.constEnd()) {
QFont::StyleHint styleHint = QFont::AnyStyle; QFont::StyleHint styleHint = QFont::AnyStyle;
switch (int(attributeIterator.value().toDouble())) { switch (int(attributeIterator.value().toDouble())) {
@ -299,23 +301,23 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
// Extract palette information // Extract palette information
QPalette palette = *defaultPalette; QPalette palette = *defaultPalette;
attributeIterator = item.find(QLatin1String("defaultTextColorPrimary")); attributeIterator = item.find("defaultTextColorPrimary"_L1);
if (attributeIterator != item.constEnd()) if (attributeIterator != item.constEnd())
palette.setColor(QPalette::WindowText, QRgb(int(attributeIterator.value().toDouble()))); palette.setColor(QPalette::WindowText, QRgb(int(attributeIterator.value().toDouble())));
attributeIterator = item.find(QLatin1String("defaultBackgroundColor")); attributeIterator = item.find("defaultBackgroundColor"_L1);
if (attributeIterator != item.constEnd()) if (attributeIterator != item.constEnd())
palette.setColor(QPalette::Window, QRgb(int(attributeIterator.value().toDouble()))); palette.setColor(QPalette::Window, QRgb(int(attributeIterator.value().toDouble())));
attributeIterator = item.find(QLatin1String("TextAppearance_textColor")); attributeIterator = item.find("TextAppearance_textColor"_L1);
if (attributeIterator != item.constEnd()) if (attributeIterator != item.constEnd())
setPaletteColor(attributeIterator.value().toObject().toVariantMap(), palette, QPalette::WindowText); setPaletteColor(attributeIterator.value().toObject().toVariantMap(), palette, QPalette::WindowText);
attributeIterator = item.find(QLatin1String("TextAppearance_textColorLink")); attributeIterator = item.find("TextAppearance_textColorLink"_L1);
if (attributeIterator != item.constEnd()) if (attributeIterator != item.constEnd())
setPaletteColor(attributeIterator.value().toObject().toVariantMap(), palette, QPalette::Link); setPaletteColor(attributeIterator.value().toObject().toVariantMap(), palette, QPalette::Link);
attributeIterator = item.find(QLatin1String("TextAppearance_textColorHighlight")); attributeIterator = item.find("TextAppearance_textColorHighlight"_L1);
if (attributeIterator != item.constEnd()) if (attributeIterator != item.constEnd())
palette.setColor(QPalette::Highlight, QRgb(int(attributeIterator.value().toDouble()))); palette.setColor(QPalette::Highlight, QRgb(int(attributeIterator.value().toDouble())));
@ -369,7 +371,7 @@ QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *an
androidPlatformNativeInterface->m_androidStyle = m_androidStyleData; androidPlatformNativeInterface->m_androidStyle = m_androidStyleData;
// default in case the style has not set a font // default in case the style has not set a font
m_systemFont = QFont(QLatin1String("Roboto"), 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi m_systemFont = QFont("Roboto"_L1, 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi
} }
QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const
@ -463,9 +465,9 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
case StyleNames: case StyleNames:
if (qEnvironmentVariableIntValue("QT_USE_ANDROID_NATIVE_STYLE") if (qEnvironmentVariableIntValue("QT_USE_ANDROID_NATIVE_STYLE")
&& m_androidStyleData) { && m_androidStyleData) {
return QStringList(QLatin1String("android")); return QStringList("android"_L1);
} }
return QStringList(QLatin1String("Fusion")); return QStringList("Fusion"_L1);
case DialogButtonBoxLayout: case DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::AndroidLayout); return QVariant(QPlatformDialogHelper::AndroidLayout);
case MouseDoubleClickDistance: case MouseDoubleClickDistance:

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,8 @@
#define QT_POPEN_READ "r" #define QT_POPEN_READ "r"
#endif #endif
using namespace Qt::StringLiterals;
static bool checkJunit(const QByteArray &data) { static bool checkJunit(const QByteArray &data) {
QXmlStreamReader reader{data}; QXmlStreamReader reader{data};
while (!reader.atEnd()) { while (!reader.atEnd()) {
@ -70,12 +72,12 @@ static bool checkJunit(const QByteArray &data) {
} }
static bool checkTxt(const QByteArray &data) { static bool checkTxt(const QByteArray &data) {
if (data.indexOf(QLatin1String("\nFAIL! : ")) >= 0) if (data.indexOf("\nFAIL! : "_L1) >= 0)
return false; return false;
if (data.indexOf(QLatin1String("\nXPASS : ")) >= 0) if (data.indexOf("\nXPASS : "_L1) >= 0)
return false; return false;
// Look for "********* Finished testing of tst_QTestName *********" // Look for "********* Finished testing of tst_QTestName *********"
static const QRegularExpression testTail(QLatin1String("\\*+ +Finished testing of .+ +\\*+")); static const QRegularExpression testTail("\\*+ +Finished testing of .+ +\\*+"_L1);
return testTail.match(QLatin1String(data)).hasMatch(); return testTail.match(QLatin1String(data)).hasMatch();
} }
@ -118,7 +120,7 @@ static bool checkTeamcity(const QByteArray &data) {
const QList<QByteArray> lines = data.trimmed().split('\n'); const QList<QByteArray> lines = data.trimmed().split('\n');
if (lines.isEmpty()) if (lines.isEmpty())
return false; return false;
return lines.last().startsWith(QLatin1String("##teamcity[testSuiteFinished ")); return lines.last().startsWith("##teamcity[testSuiteFinished "_L1);
} }
static bool checkTap(const QByteArray &data) { static bool checkTap(const QByteArray &data) {
@ -127,7 +129,7 @@ static bool checkTap(const QByteArray &data) {
if (data.indexOf("\nnot ok ") >= 0) if (data.indexOf("\nnot ok ") >= 0)
return false; return false;
static const QRegularExpression testTail(QLatin1String("ok [0-9]* - cleanupTestCase\\(\\)")); static const QRegularExpression testTail("ok [0-9]* - cleanupTestCase\\(\\)"_L1);
return testTail.match(QLatin1String(data)).hasMatch(); return testTail.match(QLatin1String(data)).hasMatch();
} }