diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-13 11:42:38 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-05-04 10:00:35 +0200 |
commit | ceaa7d6341e666f6fe0d071ea34cad9877961a0e (patch) | |
tree | 7280a74e2e0e498720dcd141ac4f759df766a669 /src/plugins/platforms/ios | |
parent | 5020d1b22a31f5fe45287547037c57fa5aeb06d7 (diff) |
Plugins: use _L1 for for creating Latin-1 string literals
As a drive-by, fix qsizetype -> int narrowing conversion warnings for
the touched lines.
Task-number: QTBUG-98434
Change-Id: I7fadd3cf27ad099028d70f05956303e3af62c0f5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios')
7 files changed, 31 insertions, 19 deletions
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm index 9cb38a3461..e41bba1fb1 100644 --- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + static QThreadStorage<QString> g_iteratorCurrentUrl; static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache; @@ -249,7 +251,7 @@ public: } if (!asset) - engine->setError(QFile::OpenError, QLatin1String("could not open image")); + engine->setError(QFile::OpenError, "could not open image"_L1); m_asset = [asset retain]; dispatch_semaphore_signal(semaphore); @@ -377,7 +379,7 @@ bool QIOSFileEngineAssetsLibrary::close() QAbstractFileEngine::FileFlags QIOSFileEngineAssetsLibrary::fileFlags(QAbstractFileEngine::FileFlags type) const { QAbstractFileEngine::FileFlags flags; - const bool isDir = (m_assetUrl == QLatin1String("assets-library://")); + const bool isDir = (m_assetUrl == "assets-library://"_L1); const bool exists = isDir || m_assetUrl == g_iteratorCurrentUrl.localData() || loadAsset(); if (!exists) @@ -452,11 +454,11 @@ void QIOSFileEngineAssetsLibrary::setFileName(const QString &file) // QUrl::fromLocalFile() will remove double slashes. Since the asset url is // passed around as a file name in the app (and converted to/from a file url, e.g // in QFileDialog), we need to ensure that m_assetUrl ends up being valid. - int index = file.indexOf(QLatin1String("/asset")); + qsizetype index = file.indexOf("/asset"_L1); if (index == -1) - m_assetUrl = QLatin1String("assets-library://"); + m_assetUrl = "assets-library://"_L1; else - m_assetUrl = QLatin1String("assets-library:/") + file.mid(index); + m_assetUrl = "assets-library:/"_L1 + file.mid(index); } #ifndef QT_NO_FILESYSTEMITERATOR diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index 83760f2f39..195660220e 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT @@ -54,8 +56,8 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive) - || !system.compare(QLatin1String("tvos"), Qt::CaseInsensitive)) { + if (!system.compare("ios"_L1, Qt::CaseInsensitive) + || !system.compare("tvos"_L1, Qt::CaseInsensitive)) { return new QIOSIntegration; } diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm index bf4e9cc900..73b60fbd33 100644 --- a/src/plugins/platforms/ios/qiosapplicationstate.mm +++ b/src/plugins/platforms/ios/qiosapplicationstate.mm @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + static void qRegisterApplicationStateNotifications() { NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; @@ -83,11 +85,11 @@ static void qRegisterApplicationStateNotifications() if (qt_apple_isApplicationExtension()) { // Extensions are not allowed to access UIApplication, so we assume the state is active QIOSApplicationState::handleApplicationStateChanged(UIApplicationStateActive, - QLatin1String("Extension loaded, assuming state is active")); + "Extension loaded, assuming state is active"_L1); } else { // Initialize correct startup state, which may not be the Qt default (inactive) UIApplicationState startupState = qt_apple_sharedApplication().applicationState; - QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application loaded")); + QIOSApplicationState::handleApplicationStateChanged(startupState, "Application loaded"_L1); } } Q_CONSTRUCTOR_FUNCTION(qRegisterApplicationStateNotifications) @@ -96,7 +98,7 @@ QIOSApplicationState::QIOSApplicationState() { if (!qt_apple_isApplicationExtension()) { UIApplicationState startupState = qt_apple_sharedApplication().applicationState; - QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application launched")); + QIOSApplicationState::handleApplicationStateChanged(startupState, "Application launched"_L1); } } diff --git a/src/plugins/platforms/ios/qiosfiledialog.mm b/src/plugins/platforms/ios/qiosfiledialog.mm index a56bf25c16..d9d7285910 100644 --- a/src/plugins/platforms/ios/qiosfiledialog.mm +++ b/src/plugins/platforms/ios/qiosfiledialog.mm @@ -50,6 +50,8 @@ #include "qiosoptionalplugininterface.h" #include "qiosdocumentpickercontroller.h" +using namespace Qt::StringLiterals; + QIOSFileDialog::QIOSFileDialog() : m_viewController(nullptr) { @@ -74,7 +76,7 @@ bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality window QString directory = options()->initialDirectory().toLocalFile(); if (acceptOpen) { - if (directory.startsWith(QLatin1String("assets-library:"))) + if (directory.startsWith("assets-library:"_L1)) return showImagePickerDialog(parent); else return showNativeDocumentPickerDialog(parent); diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 54ef5b2567..4aa1e4207f 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -70,6 +70,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + class QCoreTextFontEngine; QIOSIntegration *QIOSIntegration::instance() @@ -85,7 +87,7 @@ QIOSIntegration::QIOSIntegration() , m_inputContext(0) , m_platformServices(new QIOSServices) , m_accessibility(0) - , m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin"))) + , m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, "/platforms/darwin"_L1)) { if (Q_UNLIKELY(!qt_apple_isApplicationExtension() && !qt_apple_sharedApplication())) { qFatal("Error: You are creating QApplication before calling UIApplicationMain.\n" \ diff --git a/src/plugins/platforms/ios/qiosmessagedialog.mm b/src/plugins/platforms/ios/qiosmessagedialog.mm index 254922701a..334edddcfe 100644 --- a/src/plugins/platforms/ios/qiosmessagedialog.mm +++ b/src/plugins/platforms/ios/qiosmessagedialog.mm @@ -49,6 +49,8 @@ #include "quiview.h" #include "qiosmessagedialog.h" +using namespace Qt::StringLiterals; + QIOSMessageDialog::QIOSMessageDialog() : m_alertController(nullptr) { @@ -73,7 +75,7 @@ inline QString QIOSMessageDialog::messageTextPlain() if (!detailedText.isEmpty()) text += lineShift + detailedText; - text.replace(QLatin1String("<p>"), QStringLiteral("\n"), Qt::CaseInsensitive); + text.replace("<p>"_L1, QStringLiteral("\n"), Qt::CaseInsensitive); text.remove(QRegularExpression(QStringLiteral("<[^>]*>"))); return text; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 69ec393b12..6b1d6621a6 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -229,6 +229,8 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen) QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + /*! Returns the model identifier of the device. */ @@ -321,12 +323,10 @@ QIOSScreen::~QIOSScreen() QString QIOSScreen::name() const { - if (m_uiScreen == [UIScreen mainScreen]) { - return QString::fromNSString([UIDevice currentDevice].model) - + QLatin1String(" built-in display"); - } else { - return QLatin1String("External display"); - } + if (m_uiScreen == [UIScreen mainScreen]) + return QString::fromNSString([UIDevice currentDevice].model) + " built-in display"_L1; + else + return "External display"_L1; } void QIOSScreen::updateProperties() |