summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-04-13 11:42:38 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2022-05-04 10:00:35 +0200
commitceaa7d6341e666f6fe0d071ea34cad9877961a0e (patch)
tree7280a74e2e0e498720dcd141ac4f759df766a669 /src/plugins/platformthemes
parent5020d1b22a31f5fe45287547037c57fa5aeb06d7 (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/platformthemes')
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp4
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/main.cpp8
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp42
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp22
4 files changed, 42 insertions, 34 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
index 9ffd5fd496..e9d622c788 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
@@ -66,6 +66,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QGtk3Dialog : public QWindow
{
Q_OBJECT
@@ -524,7 +526,7 @@ void QGtk3FileDialogHelper::setNameFilters(const QStringList &filters)
const QString name = filter.left(filter.indexOf(u'('));
const QStringList extensions = cleanFilterList(filter);
- gtk_file_filter_set_name(gtkFilter, qUtf8Printable(name.isEmpty() ? extensions.join(QLatin1String(", ")) : name));
+ gtk_file_filter_set_name(gtkFilter, qUtf8Printable(name.isEmpty() ? extensions.join(", "_L1) : name));
foreach (const QString &ext, extensions)
gtk_file_filter_add_pattern(gtkFilter, qUtf8Printable(ext));
diff --git a/src/plugins/platformthemes/xdgdesktopportal/main.cpp b/src/plugins/platformthemes/xdgdesktopportal/main.cpp
index 64a03d479f..06565d876c 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/main.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/main.cpp
@@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QXdgDesktopPortalThemePlugin : public QPlatformThemePlugin
{
Q_OBJECT
@@ -54,9 +56,9 @@ public:
QPlatformTheme *QXdgDesktopPortalThemePlugin::create(const QString &key, const QStringList &params)
{
Q_UNUSED(params);
- if (!key.compare(QLatin1String("xdgdesktopportal"), Qt::CaseInsensitive) ||
- !key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive) ||
- !key.compare(QLatin1String("snap"), Qt::CaseInsensitive))
+ if (!key.compare("xdgdesktopportal"_L1, Qt::CaseInsensitive) ||
+ !key.compare("flatpak"_L1, Qt::CaseInsensitive) ||
+ !key.compare("snap"_L1, Qt::CaseInsensitive))
return new QXdgDesktopPortalTheme;
return nullptr;
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
index 92ac792b9c..5a51864d1c 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
@@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::FilterCondition &filterCondition)
{
arg.beginStructure();
@@ -182,29 +184,29 @@ void QXdgDesktopPortalFileDialog::openPortal()
{
Q_D(QXdgDesktopPortalFileDialog);
- QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
- QLatin1String("/org/freedesktop/portal/desktop"),
- QLatin1String("org.freedesktop.portal.FileChooser"),
- d->saveFile ? QLatin1String("SaveFile") : QLatin1String("OpenFile"));
- QString parentWindowId = QLatin1String("x11:") + QString::number(d->winId, 16);
+ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
+ "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.FileChooser"_L1,
+ d->saveFile ? "SaveFile"_L1 : "OpenFile"_L1);
+ QString parentWindowId = "x11:"_L1 + QString::number(d->winId, 16);
QVariantMap options;
if (!d->acceptLabel.isEmpty())
- options.insert(QLatin1String("accept_label"), d->acceptLabel);
+ options.insert("accept_label"_L1, d->acceptLabel);
- options.insert(QLatin1String("modal"), d->modal);
- options.insert(QLatin1String("multiple"), d->multipleFiles);
- options.insert(QLatin1String("directory"), d->directoryMode);
+ options.insert("modal"_L1, d->modal);
+ options.insert("multiple"_L1, d->multipleFiles);
+ options.insert("directory"_L1, d->directoryMode);
if (d->saveFile) {
if (!d->directory.isEmpty())
- options.insert(QLatin1String("current_folder"), QFile::encodeName(d->directory).append('\0'));
+ options.insert("current_folder"_L1, QFile::encodeName(d->directory).append('\0'));
if (!d->selectedFiles.isEmpty()) {
// current_file for the file to be pre-selected, current_name for the file name to be pre-filled
// current_file accepts absolute path while current_name accepts just file name
- options.insert(QLatin1String("current_file"), QFile::encodeName(d->selectedFiles.first()).append('\0'));
- options.insert(QLatin1String("current_name"), QFileInfo(d->selectedFiles.first()).fileName());
+ options.insert("current_file"_L1, QFile::encodeName(d->selectedFiles.first()).append('\0'));
+ options.insert("current_name"_L1, QFileInfo(d->selectedFiles.first()).fileName());
}
}
@@ -281,12 +283,12 @@ void QXdgDesktopPortalFileDialog::openPortal()
}
if (!filterList.isEmpty())
- options.insert(QLatin1String("filters"), QVariant::fromValue(filterList));
+ options.insert("filters"_L1, QVariant::fromValue(filterList));
if (selectedFilterIndex != -1)
- options.insert(QLatin1String("current_filter"), QVariant::fromValue(filterList[selectedFilterIndex]));
+ options.insert("current_filter"_L1, QVariant::fromValue(filterList[selectedFilterIndex]));
- options.insert(QLatin1String("handle_token"), QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate()));
+ options.insert("handle_token"_L1, QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate()));
// TODO choices a(ssa(ss)s)
// List of serialized combo boxes to add to the file chooser.
@@ -302,8 +304,8 @@ void QXdgDesktopPortalFileDialog::openPortal()
} else {
QDBusConnection::sessionBus().connect(nullptr,
reply.value().path(),
- QLatin1String("org.freedesktop.portal.Request"),
- QLatin1String("Response"),
+ "org.freedesktop.portal.Request"_L1,
+ "Response"_L1,
this,
SLOT(gotResponse(uint,QVariantMap)));
}
@@ -451,10 +453,10 @@ void QXdgDesktopPortalFileDialog::gotResponse(uint response, const QVariantMap &
Q_D(QXdgDesktopPortalFileDialog);
if (!response) {
- if (results.contains(QLatin1String("uris")))
- d->selectedFiles = results.value(QLatin1String("uris")).toStringList();
+ if (results.contains("uris"_L1))
+ d->selectedFiles = results.value("uris"_L1).toStringList();
- if (results.contains(QLatin1String("current_filter"))) {
+ if (results.contains("current_filter"_L1)) {
const Filter selectedFilter = qdbus_cast<Filter>(results.value(QStringLiteral("current_filter")));
if (!selectedFilter.filterConditions.empty() && selectedFilter.filterConditions[0].type == MimeType) {
// s.a. QXdgDesktopPortalFileDialog::openPortal which basically does the inverse
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
index 87b9f20a4c..0b9d211fa9 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
@@ -54,6 +54,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QXdgDesktopPortalThemePrivate : public QPlatformThemePrivate
{
public:
@@ -131,11 +133,11 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()
d->baseTheme = new QPlatformTheme;
// Get information about portal version
- QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
- QLatin1String("/org/freedesktop/portal/desktop"),
- QLatin1String("org.freedesktop.DBus.Properties"),
- QLatin1String("Get"));
- message << QLatin1String("org.freedesktop.portal.FileChooser") << QLatin1String("version");
+ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
+ "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.DBus.Properties"_L1,
+ "Get"_L1);
+ message << "org.freedesktop.portal.FileChooser"_L1 << "version"_L1;
QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall);
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, [d] (QDBusPendingCallWatcher *watcher) {
@@ -147,11 +149,11 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()
});
// Get information about system theme preference
- message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
- QLatin1String("/org/freedesktop/portal/desktop"),
- QLatin1String("org.freedesktop.portal.Settings"),
- QLatin1String("Read"));
- message << QLatin1String("org.freedesktop.appearance") << QLatin1String("color-scheme");
+ message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
+ "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.Settings"_L1,
+ "Read"_L1);
+ message << "org.freedesktop.appearance"_L1 << "color-scheme"_L1;
// this must not be asyncCall() because we have to set appearance now
QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(message);