QtGui: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
852bb43605
commit
7b6b133746
File diff suppressed because it is too large
Load Diff
@ -53,11 +53,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/* note: do not change these to QStringLiteral;
|
||||
we are unloaded before QtDBus is done using the strings.
|
||||
*/
|
||||
#define A11Y_SERVICE QLatin1String("org.a11y.Bus")
|
||||
#define A11Y_PATH QLatin1String("/org/a11y/bus")
|
||||
#define A11Y_SERVICE "org.a11y.Bus"_L1
|
||||
#define A11Y_PATH "/org/a11y/bus"_L1
|
||||
|
||||
/*!
|
||||
\class DBusConnection
|
||||
@ -137,7 +139,7 @@ void DBusConnection::serviceRegistered()
|
||||
} else {
|
||||
QDBusConnection c = QDBusConnection::sessionBus();
|
||||
QDBusMessage m = QDBusMessage::createMethodCall(A11Y_SERVICE, A11Y_PATH, A11Y_SERVICE,
|
||||
QLatin1String("GetAddress"));
|
||||
"GetAddress"_L1);
|
||||
c.callWithCallback(m, this, SLOT(connectA11yBus(QString)), SLOT(dbusError(QDBusError)));
|
||||
}
|
||||
}
|
||||
@ -156,7 +158,7 @@ void DBusConnection::connectA11yBus(const QString &address)
|
||||
qWarning("Could not find Accessibility DBus address.");
|
||||
return;
|
||||
}
|
||||
m_a11yConnection = QDBusConnection(QDBusConnection::connectToBus(address, QLatin1String("a11y")));
|
||||
m_a11yConnection = QDBusConnection(QDBusConnection::connectToBus(address, "a11y"_L1));
|
||||
|
||||
if (m_enabled)
|
||||
emit enabledChanged(true);
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QSpiAccessibleBridge
|
||||
\internal
|
||||
@ -95,10 +97,10 @@ void QSpiAccessibleBridge::updateStatus()
|
||||
cache = new QSpiDBusCache(dbusConnection->connection(), this);
|
||||
dec = new DeviceEventControllerAdaptor(this);
|
||||
|
||||
dbusConnection->connection().registerObject(QLatin1String(ATSPI_DBUS_PATH_DEC), this, QDBusConnection::ExportAdaptors);
|
||||
dbusConnection->connection().registerObject(ATSPI_DBUS_PATH_DEC ""_L1, this, QDBusConnection::ExportAdaptors);
|
||||
|
||||
dbusAdaptor = new AtSpiAdaptor(dbusConnection, this);
|
||||
dbusConnection->connection().registerVirtualObject(QLatin1String(QSPI_OBJECT_PATH_ACCESSIBLE), dbusAdaptor, QDBusConnection::SubPath);
|
||||
dbusConnection->connection().registerVirtualObject(QSPI_OBJECT_PATH_ACCESSIBLE ""_L1, dbusAdaptor, QDBusConnection::SubPath);
|
||||
dbusAdaptor->registerApplication();
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QSpiDBusCache
|
||||
\internal
|
||||
@ -69,7 +71,7 @@ QSpiDBusCache::QSpiDBusCache(QDBusConnection c, QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
new CacheAdaptor(this);
|
||||
c.registerObject(QLatin1String(QSPI_OBJECT_PATH_CACHE), this, QDBusConnection::ExportAdaptors);
|
||||
c.registerObject(QSPI_OBJECT_PATH_CACHE ""_L1, this, QDBusConnection::ExportAdaptors);
|
||||
}
|
||||
|
||||
void QSpiDBusCache::emitAddAccessible(const QSpiAccessibleCacheItem& item)
|
||||
|
@ -59,6 +59,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
|
||||
|
||||
/*!
|
||||
@ -470,7 +472,7 @@ QAccessibleInterface::~QAccessibleInterface()
|
||||
|
||||
/* accessible widgets plugin discovery stuff */
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QAccessibleFactoryInterface_iid, QLatin1String("/accessible")))
|
||||
(QAccessibleFactoryInterface_iid, "/accessible"_L1))
|
||||
typedef QHash<QString, QAccessiblePlugin*> QAccessiblePluginsHash;
|
||||
Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins)
|
||||
|
||||
@ -1841,13 +1843,13 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
|
||||
QStringList stateStrings;
|
||||
QAccessible::State st = iface->state();
|
||||
if (st.focusable)
|
||||
stateStrings << QLatin1String("focusable");
|
||||
stateStrings << "focusable"_L1;
|
||||
if (st.focused)
|
||||
stateStrings << QLatin1String("focused");
|
||||
stateStrings << "focused"_L1;
|
||||
if (st.selected)
|
||||
stateStrings << QLatin1String("selected");
|
||||
stateStrings << "selected"_L1;
|
||||
if (st.invisible)
|
||||
stateStrings << QLatin1String("invisible");
|
||||
stateStrings << "invisible"_L1;
|
||||
|
||||
if (!stateStrings.isEmpty())
|
||||
d << stateStrings.join(u'|');
|
||||
|
@ -47,11 +47,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
/* accessiblebridge plugin discovery stuff */
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, bridgeloader,
|
||||
(QAccessibleBridgeFactoryInterface_iid, QLatin1String("/accessiblebridge")))
|
||||
(QAccessibleBridgeFactoryInterface_iid, "/accessiblebridge"_L1))
|
||||
|
||||
Q_GLOBAL_STATIC(QList<QAccessibleBridge *>, bridges)
|
||||
|
||||
|
@ -43,6 +43,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QAbstractFileIconEngine
|
||||
\brief Helper base class for retrieving icons for files for usage by QFileIconProvider and related.
|
||||
@ -128,7 +130,7 @@ QString QAbstractFileIconEngine::cacheKey() const
|
||||
return QString();
|
||||
|
||||
const QString &suffix = m_fileInfo.suffix();
|
||||
return QLatin1String("qt_.")
|
||||
return "qt_."_L1
|
||||
+ (suffix.isEmpty() ? m_fileInfo.fileName() : suffix); // handle "Makefile" ;)
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QAbstractFileIconProviderPrivate::QAbstractFileIconProviderPrivate(QAbstractFileIconProvider *q)
|
||||
: q_ptr(q)
|
||||
{}
|
||||
@ -114,22 +116,22 @@ QIcon QAbstractFileIconProviderPrivate::getIconThemeIcon(QAbstractFileIconProvid
|
||||
{
|
||||
switch (type) {
|
||||
case QAbstractFileIconProvider::Computer:
|
||||
return QIcon::fromTheme(QLatin1String("computer"));
|
||||
return QIcon::fromTheme("computer"_L1);
|
||||
case QAbstractFileIconProvider::Desktop:
|
||||
return QIcon::fromTheme(QLatin1String("user-desktop"));
|
||||
return QIcon::fromTheme("user-desktop"_L1);
|
||||
case QAbstractFileIconProvider::Trashcan:
|
||||
return QIcon::fromTheme(QLatin1String("user-trash"));
|
||||
return QIcon::fromTheme("user-trash"_L1);
|
||||
case QAbstractFileIconProvider::Network:
|
||||
return QIcon::fromTheme(QLatin1String("network-workgroup"));
|
||||
return QIcon::fromTheme("network-workgroup"_L1);
|
||||
case QAbstractFileIconProvider::Drive:
|
||||
return QIcon::fromTheme(QLatin1String("drive-harddisk"));
|
||||
return QIcon::fromTheme("drive-harddisk"_L1);
|
||||
case QAbstractFileIconProvider::Folder:
|
||||
return QIcon::fromTheme(QLatin1String("folder"));
|
||||
return QIcon::fromTheme("folder"_L1);
|
||||
case QAbstractFileIconProvider::File:
|
||||
return QIcon::fromTheme(QLatin1String("text-x-generic"));
|
||||
return QIcon::fromTheme("text-x-generic"_L1);
|
||||
// no default on purpose; we want warnings when the type enum is extended
|
||||
}
|
||||
return QIcon::fromTheme(QLatin1String("text-x-generic"));
|
||||
return QIcon::fromTheme("text-x-generic"_L1);
|
||||
}
|
||||
|
||||
static inline QPlatformTheme::IconOptions toThemeIconOptions(QAbstractFileIconProvider::Options options)
|
||||
@ -156,7 +158,7 @@ QIcon QAbstractFileIconProviderPrivate::getIconThemeIcon(const QFileInfo &info)
|
||||
#if QT_CONFIG(mimetype)
|
||||
return QIcon::fromTheme(mimeDatabase.mimeTypeForFile(info).iconName());
|
||||
#else
|
||||
return QIcon::fromTheme(QLatin1String("text-x-generic"));
|
||||
return QIcon::fromTheme("text-x-generic"_L1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,8 @@
|
||||
#ifndef QT_NO_ICON
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\enum QIcon::Mode
|
||||
|
||||
@ -320,7 +322,7 @@ QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIc
|
||||
if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
|
||||
actualSize.scale(size, Qt::KeepAspectRatio);
|
||||
|
||||
QString key = QLatin1String("qt_")
|
||||
QString key = "qt_"_L1
|
||||
% HexString<quint64>(pm.cacheKey())
|
||||
% HexString<uint>(pe ? pe->mode : QIcon::Normal)
|
||||
% HexString<quint64>(QGuiApplication::palette().cacheKey())
|
||||
@ -493,7 +495,7 @@ void QPixmapIconEngine::addFile(const QString &fileName, const QSize &size, QIco
|
||||
|
||||
QString QPixmapIconEngine::key() const
|
||||
{
|
||||
return QLatin1String("QPixmapIconEngine");
|
||||
return "QPixmapIconEngine"_L1;
|
||||
}
|
||||
|
||||
QIconEngine *QPixmapIconEngine::clone() const
|
||||
@ -550,7 +552,7 @@ bool QPixmapIconEngine::write(QDataStream &out) const
|
||||
}
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QIconEngineFactoryInterface_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive))
|
||||
(QIconEngineFactoryInterface_iid, "/iconengines"_L1, Qt::CaseInsensitive))
|
||||
|
||||
QFactoryLoader *qt_iconEngineFactoryLoader()
|
||||
{
|
||||
@ -1457,10 +1459,10 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
|
||||
icon = QIcon();
|
||||
QString key;
|
||||
s >> key;
|
||||
if (key == QLatin1String("QPixmapIconEngine")) {
|
||||
if (key == "QPixmapIconEngine"_L1) {
|
||||
icon.d = new QIconPrivate(new QPixmapIconEngine);
|
||||
icon.d->engine->read(s);
|
||||
} else if (key == QLatin1String("QIconLoaderEngine")) {
|
||||
} else if (key == "QIconLoaderEngine"_L1) {
|
||||
icon.d = new QIconPrivate(new QIconLoaderEngine());
|
||||
icon.d->engine->read(s);
|
||||
} else {
|
||||
@ -1567,7 +1569,7 @@ QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRati
|
||||
}
|
||||
|
||||
QString atNxfileName = baseFileName;
|
||||
atNxfileName.insert(dotIndex, QLatin1String("@2x"));
|
||||
atNxfileName.insert(dotIndex, "@2x"_L1);
|
||||
// Check for @Nx, ..., @3x, @2x file versions,
|
||||
for (int n = qMin(qCeil(targetDevicePixelRatio), 9); n > 1; --n) {
|
||||
atNxfileName[dotIndex + 1] = QLatin1Char('0' + n);
|
||||
|
@ -59,6 +59,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance)
|
||||
|
||||
/* Theme to use in last resort, if the theme does not have the icon, neither the parents */
|
||||
@ -122,7 +124,7 @@ void QIconLoader::ensureInitialized()
|
||||
|
||||
if (m_systemTheme.isEmpty())
|
||||
m_systemTheme = systemFallbackThemeName();
|
||||
if (qt_iconEngineFactoryLoader()->keyMap().key(QLatin1String("svg"), -1) != -1)
|
||||
if (qt_iconEngineFactoryLoader()->keyMap().key("svg"_L1, -1) != -1)
|
||||
m_supportsSvg = true;
|
||||
}
|
||||
}
|
||||
@ -187,7 +189,7 @@ QStringList QIconLoader::themeSearchPaths() const
|
||||
if (m_iconDirs.isEmpty()) {
|
||||
m_iconDirs = systemIconSearchPaths();
|
||||
// Always add resource directory as search path
|
||||
m_iconDirs.append(QLatin1String(":/icons"));
|
||||
m_iconDirs.append(":/icons"_L1);
|
||||
}
|
||||
return m_iconDirs;
|
||||
}
|
||||
@ -248,7 +250,7 @@ private:
|
||||
QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
|
||||
: m_isValid(false)
|
||||
{
|
||||
QFileInfo info(dirName + QLatin1String("/icon-theme.cache"));
|
||||
QFileInfo info(dirName + "/icon-theme.cache"_L1);
|
||||
if (!info.exists() || info.lastModified() < QFileInfo(dirName).lastModified())
|
||||
return;
|
||||
m_file.setFileName(info.absoluteFilePath());
|
||||
@ -357,7 +359,7 @@ QIconTheme::QIconTheme(const QString &themeName)
|
||||
}
|
||||
|
||||
if (!m_valid) {
|
||||
themeIndex.setFileName(themeDir + QLatin1String("/index.theme"));
|
||||
themeIndex.setFileName(themeDir + "/index.theme"_L1);
|
||||
if (themeIndex.exists())
|
||||
m_valid = true;
|
||||
}
|
||||
@ -367,47 +369,38 @@ QIconTheme::QIconTheme(const QString &themeName)
|
||||
const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
|
||||
const QStringList keys = indexReader.allKeys();
|
||||
for (const QString &key : keys) {
|
||||
if (key.endsWith(QLatin1String("/Size"))) {
|
||||
if (key.endsWith("/Size"_L1)) {
|
||||
// Note the QSettings ini-format does not accept
|
||||
// slashes in key names, hence we have to cheat
|
||||
if (int size = indexReader.value(key).toInt()) {
|
||||
QString directoryKey = key.left(key.size() - 5);
|
||||
QIconDirInfo dirInfo(directoryKey);
|
||||
dirInfo.size = size;
|
||||
QString type = indexReader.value(directoryKey +
|
||||
QLatin1String("/Type")
|
||||
).toString();
|
||||
QString type = indexReader.value(directoryKey + "/Type"_L1).toString();
|
||||
|
||||
if (type == QLatin1String("Fixed"))
|
||||
if (type == "Fixed"_L1)
|
||||
dirInfo.type = QIconDirInfo::Fixed;
|
||||
else if (type == QLatin1String("Scalable"))
|
||||
else if (type == "Scalable"_L1)
|
||||
dirInfo.type = QIconDirInfo::Scalable;
|
||||
else
|
||||
dirInfo.type = QIconDirInfo::Threshold;
|
||||
|
||||
dirInfo.threshold = indexReader.value(directoryKey +
|
||||
QLatin1String("/Threshold"),
|
||||
2).toInt();
|
||||
"/Threshold"_L1,
|
||||
2).toInt();
|
||||
|
||||
dirInfo.minSize = indexReader.value(directoryKey +
|
||||
QLatin1String("/MinSize"),
|
||||
size).toInt();
|
||||
dirInfo.minSize = indexReader.value(directoryKey + "/MinSize"_L1, size).toInt();
|
||||
|
||||
dirInfo.maxSize = indexReader.value(directoryKey +
|
||||
QLatin1String("/MaxSize"),
|
||||
size).toInt();
|
||||
dirInfo.maxSize = indexReader.value(directoryKey + "/MaxSize"_L1, size).toInt();
|
||||
|
||||
dirInfo.scale = indexReader.value(directoryKey +
|
||||
QLatin1String("/Scale"),
|
||||
1).toInt();
|
||||
dirInfo.scale = indexReader.value(directoryKey + "/Scale"_L1, 1).toInt();
|
||||
m_keyList.append(dirInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parent themes provide fallbacks for missing icons
|
||||
m_parents = indexReader.value(
|
||||
QLatin1String("Icon Theme/Inherits")).toStringList();
|
||||
m_parents = indexReader.value("Icon Theme/Inherits"_L1).toStringList();
|
||||
m_parents.removeAll(QString());
|
||||
|
||||
// Ensure a default platform fallback for all themes
|
||||
@ -418,8 +411,8 @@ QIconTheme::QIconTheme(const QString &themeName)
|
||||
}
|
||||
|
||||
// Ensure that all themes fall back to hicolor
|
||||
if (!m_parents.contains(QLatin1String("hicolor")))
|
||||
m_parents.append(QLatin1String("hicolor"));
|
||||
if (!m_parents.contains("hicolor"_L1))
|
||||
m_parents.append("hicolor"_L1);
|
||||
}
|
||||
#endif // settings
|
||||
}
|
||||
@ -447,8 +440,8 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
|
||||
|
||||
// Iterate through all icon's fallbacks in current theme
|
||||
while (info.entries.empty()) {
|
||||
const QString svgIconName = iconNameFallback + QLatin1String(".svg");
|
||||
const QString pngIconName = iconNameFallback + QLatin1String(".png");
|
||||
const QString svgIconName = iconNameFallback + ".svg"_L1;
|
||||
const QString pngIconName = iconNameFallback + ".png"_L1;
|
||||
|
||||
// Add all relevant files
|
||||
for (int i = 0; i < contentDirs.size(); ++i) {
|
||||
@ -533,9 +526,9 @@ QThemeIconInfo QIconLoader::lookupFallbackIcon(const QString &iconName) const
|
||||
{
|
||||
QThemeIconInfo info;
|
||||
|
||||
const QString pngIconName = iconName + QLatin1String(".png");
|
||||
const QString xpmIconName = iconName + QLatin1String(".xpm");
|
||||
const QString svgIconName = iconName + QLatin1String(".svg");
|
||||
const QString pngIconName = iconName + ".png"_L1;
|
||||
const QString xpmIconName = iconName + ".xpm"_L1;
|
||||
const QString svgIconName = iconName + ".svg"_L1;
|
||||
|
||||
const auto searchPaths = QIcon::fallbackSearchPaths();
|
||||
for (const QString &iconDir: searchPaths) {
|
||||
@ -766,7 +759,7 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
|
||||
if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
|
||||
actualSize.scale(size, Qt::KeepAspectRatio);
|
||||
|
||||
QString key = QLatin1String("$qt_theme_")
|
||||
QString key = "$qt_theme_"_L1
|
||||
% HexString<qint64>(basePixmap.cacheKey())
|
||||
% HexString<int>(mode)
|
||||
% HexString<qint64>(QGuiApplication::palette().cacheKey())
|
||||
@ -815,7 +808,7 @@ QPixmap QIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode,
|
||||
|
||||
QString QIconLoaderEngine::key() const
|
||||
{
|
||||
return QLatin1String("QIconLoaderEngine");
|
||||
return "QIconLoaderEngine"_L1;
|
||||
}
|
||||
|
||||
QString QIconLoaderEngine::iconName()
|
||||
|
@ -81,6 +81,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
// MSVC 19.28 does show spurious warning "C4723: potential divide by 0" for code that divides
|
||||
// by height() in release builds. Anyhow, all the code paths in this file are only executed
|
||||
// for valid QImage's, where height() cannot be 0. Therefore disable the warning.
|
||||
@ -4182,7 +4184,7 @@ QString QImage::text(const QString &key) const
|
||||
|
||||
QString tmp;
|
||||
for (auto it = d->text.begin(), end = d->text.end(); it != end; ++it)
|
||||
tmp += it.key() + QLatin1String(": ") + it.value().simplified() + QLatin1String("\n\n");
|
||||
tmp += it.key() + ": "_L1 + it.value().simplified() + "\n\n"_L1;
|
||||
if (!tmp.isEmpty())
|
||||
tmp.chop(2); // remove final \n\n
|
||||
return tmp;
|
||||
@ -5707,7 +5709,7 @@ QMap<QString, QString> qt_getImageTextFromDescription(const QString &description
|
||||
int index = pair.indexOf(u':');
|
||||
if (index >= 0 && pair.indexOf(u' ') < index) {
|
||||
if (!pair.trimmed().isEmpty())
|
||||
text.insert(QLatin1String("Description"), pair.toString().simplified());
|
||||
text.insert("Description"_L1, pair.toString().simplified());
|
||||
} else {
|
||||
const auto key = pair.left(index);
|
||||
if (!key.trimmed().isEmpty())
|
||||
|
@ -45,12 +45,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace QImageReaderWriterHelpers {
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMATPLUGIN
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats")))
|
||||
(QImageIOHandlerFactoryInterface_iid, "/imageformats"_L1))
|
||||
Q_GLOBAL_STATIC(QMutex, loaderMutex)
|
||||
|
||||
static void appendImagePluginFormats(QFactoryLoader *loader,
|
||||
@ -85,8 +87,8 @@ static void appendImagePluginMimeTypes(QFactoryLoader *loader,
|
||||
const int pluginCount = metaDataList.size();
|
||||
for (int i = 0; i < pluginCount; ++i) {
|
||||
const QCborMap metaData = metaDataList.at(i).value(QtPluginMetaDataKeys::MetaData).toMap();
|
||||
const QCborArray keys = metaData.value(QLatin1String("Keys")).toArray();
|
||||
const QCborArray mimeTypes = metaData.value(QLatin1String("MimeTypes")).toArray();
|
||||
const QCborArray keys = metaData.value("Keys"_L1).toArray();
|
||||
const QCborArray mimeTypes = metaData.value("MimeTypes"_L1).toArray();
|
||||
QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(loader->instance(i));
|
||||
const int keyCount = keys.size();
|
||||
for (int k = 0; k < keyCount; ++k) {
|
||||
|
@ -133,6 +133,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
|
||||
const QByteArray &format)
|
||||
{
|
||||
@ -646,8 +648,8 @@ QImageIOHandler::Transformations QImageWriter::transformation() const
|
||||
void QImageWriter::setText(const QString &key, const QString &text)
|
||||
{
|
||||
if (!d->description.isEmpty())
|
||||
d->description += QLatin1String("\n\n");
|
||||
d->description += key.simplified() + QLatin1String(": ") + text.simplified();
|
||||
d->description += "\n\n"_L1;
|
||||
d->description += key.simplified() + ": "_L1 + text.simplified();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -72,6 +72,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
// MSVC 19.28 does show spurious warning "C4723: potential divide by 0" for code that divides
|
||||
// by height() in release builds. Anyhow, all the code paths in this file are only executed
|
||||
// for valid QPixmap's, where height() cannot be 0. Therefore disable the warning.
|
||||
@ -744,7 +746,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
|
||||
if (info.completeSuffix().isEmpty() || info.exists()) {
|
||||
const bool inGuiThread = qApp->thread() == QThread::currentThread();
|
||||
|
||||
QString key = QLatin1String("qt_pixmap")
|
||||
QString key = "qt_pixmap"_L1
|
||||
% info.absoluteFilePath()
|
||||
% HexString<uint>(info.lastModified().toSecsSinceEpoch())
|
||||
% HexString<quint64>(info.size())
|
||||
|
@ -81,6 +81,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcImageIo)
|
||||
|
||||
// avoid going through QImage::scanLine() which calls detach
|
||||
@ -525,8 +527,8 @@ void QPngHandlerPrivate::readPngTexts(png_info *info)
|
||||
value = QString::fromLatin1(text_ptr->text, int(text_ptr->text_length));
|
||||
}
|
||||
if (!description.isEmpty())
|
||||
description += QLatin1String("\n\n");
|
||||
description += key + QLatin1String(": ") + value.simplified();
|
||||
description += "\n\n"_L1;
|
||||
description += key + ": "_L1 + value.simplified();
|
||||
readTexts.append(key);
|
||||
readTexts.append(value);
|
||||
text_ptr++;
|
||||
|
@ -51,6 +51,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false);
|
||||
Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot()
|
||||
@ -162,7 +164,7 @@ void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStr
|
||||
#if QT_CONFIG(filesystemwatcher)
|
||||
if (files.isEmpty()
|
||||
&& !path.isEmpty()
|
||||
&& !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
|
||||
&& !path.startsWith("//"_L1) /*don't watch UNC path*/) {
|
||||
if (!watchedDirectories().contains(path))
|
||||
watchPaths(QStringList(path));
|
||||
}
|
||||
|
@ -59,6 +59,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\enum QFileSystemModel::Roles
|
||||
\value FileIconRole
|
||||
@ -314,17 +316,17 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QM
|
||||
static QString qt_GetLongPathName(const QString &strShortPath)
|
||||
{
|
||||
if (strShortPath.isEmpty()
|
||||
|| strShortPath == QLatin1String(".") || strShortPath == QLatin1String(".."))
|
||||
|| strShortPath == "."_L1 || strShortPath == ".."_L1)
|
||||
return strShortPath;
|
||||
if (strShortPath.length() == 2 && strShortPath.endsWith(u':'))
|
||||
return strShortPath.toUpper();
|
||||
const QString absPath = QDir(strShortPath).absolutePath();
|
||||
if (absPath.startsWith(QLatin1String("//"))
|
||||
|| absPath.startsWith(QLatin1String("\\\\"))) // unc
|
||||
if (absPath.startsWith("//"_L1)
|
||||
|| absPath.startsWith("\\\\"_L1)) // unc
|
||||
return QDir::fromNativeSeparators(absPath);
|
||||
if (absPath.startsWith(u'/'))
|
||||
return QString();
|
||||
const QString inputString = QLatin1String("\\\\?\\") + QDir::toNativeSeparators(absPath);
|
||||
const QString inputString = "\\\\?\\"_L1 + QDir::toNativeSeparators(absPath);
|
||||
QVarLengthArray<TCHAR, MAX_PATH> buffer(MAX_PATH);
|
||||
DWORD result = ::GetLongPathName((wchar_t*)inputString.utf16(),
|
||||
buffer.data(),
|
||||
@ -373,7 +375,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
QStringList pathElements = absolutePath.split(u'/', Qt::SkipEmptyParts);
|
||||
if ((pathElements.isEmpty())
|
||||
#if !defined(Q_OS_WIN)
|
||||
&& QDir::fromNativeSeparators(longPath) != QLatin1String("/")
|
||||
&& QDir::fromNativeSeparators(longPath) != "/"_L1
|
||||
#endif
|
||||
)
|
||||
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
|
||||
@ -382,14 +384,14 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
QChar separator = u'/';
|
||||
QString trailingSeparator;
|
||||
#if defined(Q_OS_WIN)
|
||||
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
|
||||
QString host = QLatin1String("\\\\") + pathElements.constFirst();
|
||||
if (absolutePath.startsWith("//"_L1)) { // UNC path
|
||||
QString host = "\\\\"_L1 + pathElements.constFirst();
|
||||
if (absolutePath == QDir::fromNativeSeparators(host))
|
||||
absolutePath.append(u'/');
|
||||
if (longPath.endsWith(u'/') && !absolutePath.endsWith(u'/'))
|
||||
absolutePath.append(u'/');
|
||||
if (absolutePath.endsWith(u'/'))
|
||||
trailingSeparator = QLatin1String("\\");
|
||||
trailingSeparator = "\\"_L1;
|
||||
int r = 0;
|
||||
auto rootNode = const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
|
||||
auto it = root.children.constFind(host);
|
||||
@ -423,7 +425,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
#else
|
||||
// add the "/" item, since it is a valid path element on Unix
|
||||
if (absolutePath[0] == u'/')
|
||||
pathElements.prepend(QLatin1String("/"));
|
||||
pathElements.prepend("/"_L1);
|
||||
#endif
|
||||
|
||||
QFileSystemModelPrivate::QFileSystemNode *parent = node(index);
|
||||
@ -774,9 +776,9 @@ QString QFileSystemModelPrivate::size(const QModelIndex &index) const
|
||||
const QFileSystemNode *n = node(index);
|
||||
if (n->isDir()) {
|
||||
#ifdef Q_OS_MAC
|
||||
return QLatin1String("--");
|
||||
return "--"_L1;
|
||||
#else
|
||||
return QLatin1String("");
|
||||
return ""_L1;
|
||||
#endif
|
||||
// Windows - ""
|
||||
// OS X - "--"
|
||||
@ -1173,7 +1175,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order)
|
||||
*/
|
||||
QStringList QFileSystemModel::mimeTypes() const
|
||||
{
|
||||
return QStringList(QLatin1String("text/uri-list"));
|
||||
return QStringList("text/uri-list"_L1);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1505,7 +1507,7 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
|
||||
return d->index(rootPath());
|
||||
|
||||
//We remove the watcher on the previous path
|
||||
if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) {
|
||||
if (!rootPath().isEmpty() && rootPath() != "."_L1) {
|
||||
//This remove the watcher for the old rootPath
|
||||
#if QT_CONFIG(filesystemwatcher)
|
||||
d->fileInfoGatherer.removePath(rootPath());
|
||||
@ -1521,7 +1523,7 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
|
||||
QModelIndex newRootIndex;
|
||||
if (showDrives) {
|
||||
// otherwise dir will become '.'
|
||||
d->rootDir.setPath(QLatin1String(""));
|
||||
d->rootDir.setPath(""_L1);
|
||||
} else {
|
||||
newRootIndex = d->index(d->rootDir.path());
|
||||
}
|
||||
@ -2125,8 +2127,8 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
|
||||
const bool hideDotDot = (filters & QDir::NoDotDot);
|
||||
|
||||
// Note that we match the behavior of entryList and not QFileInfo on this.
|
||||
bool isDot = (node->fileName == QLatin1String("."));
|
||||
bool isDotDot = (node->fileName == QLatin1String(".."));
|
||||
bool isDot = (node->fileName == "."_L1);
|
||||
bool isDotDot = (node->fileName == ".."_L1);
|
||||
if ( (hideHidden && !(isDot || isDotDot) && node->isHidden())
|
||||
|| (hideSystem && node->isSystem())
|
||||
|| (hideDirs && node->isDir())
|
||||
|
@ -59,12 +59,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*
|
||||
internal: guesses a descriptive text from a text suited for a menu entry
|
||||
*/
|
||||
static QString qt_strippedText(QString s)
|
||||
{
|
||||
s.remove(QLatin1String("..."));
|
||||
s.remove("..."_L1);
|
||||
for (int i = 0; i < s.size(); ++i) {
|
||||
if (s.at(i) == u'&')
|
||||
s.remove(i, 1);
|
||||
@ -654,7 +656,7 @@ QString QAction::text() const
|
||||
QString s = d->text;
|
||||
if (s.isEmpty()) {
|
||||
s = d->iconText;
|
||||
s.replace(u'&', QLatin1String("&&"));
|
||||
s.replace(u'&', "&&"_L1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -54,6 +54,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QClipboard
|
||||
\brief The QClipboard class provides access to the window system clipboard.
|
||||
@ -270,22 +272,22 @@ QString QClipboard::text(QString &subtype, Mode mode) const
|
||||
|
||||
const QStringList formats = data->formats();
|
||||
if (subtype.isEmpty()) {
|
||||
if (formats.contains(QLatin1String("text/plain")))
|
||||
subtype = QLatin1String("plain");
|
||||
if (formats.contains("text/plain"_L1))
|
||||
subtype = "plain"_L1;
|
||||
else {
|
||||
for (int i = 0; i < formats.size(); ++i)
|
||||
if (formats.at(i).startsWith(QLatin1String("text/"))) {
|
||||
if (formats.at(i).startsWith("text/"_L1)) {
|
||||
subtype = formats.at(i).mid(5);
|
||||
break;
|
||||
}
|
||||
if (subtype.isEmpty())
|
||||
return QString();
|
||||
}
|
||||
} else if (!formats.contains(QLatin1String("text/") + subtype)) {
|
||||
} else if (!formats.contains("text/"_L1 + subtype)) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QByteArray rawData = data->data(QLatin1String("text/") + subtype);
|
||||
const QByteArray rawData = data->data("text/"_L1 + subtype);
|
||||
auto encoding = QStringConverter::encodingForData(rawData);
|
||||
if (!encoding)
|
||||
encoding = QStringConverter::Utf8;
|
||||
|
@ -46,9 +46,10 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QGenericPluginFactoryInterface_iid,
|
||||
QLatin1String("/generic"), Qt::CaseInsensitive))
|
||||
(QGenericPluginFactoryInterface_iid, "/generic"_L1, Qt::CaseInsensitive))
|
||||
|
||||
/*!
|
||||
\class QGenericPluginFactory
|
||||
|
@ -134,6 +134,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
// Helper macro for static functions to check on the existence of the application class.
|
||||
#define CHECK_QAPP_INSTANCE(...) \
|
||||
if (Q_LIKELY(QCoreApplication::instance())) { \
|
||||
@ -230,7 +232,7 @@ static bool qt_detectRTLLanguage()
|
||||
(QGuiApplication::tr("QT_LAYOUT_DIRECTION",
|
||||
"Translate this string to the string 'LTR' in left-to-right"
|
||||
" languages or to 'RTL' in right-to-left languages (such as Hebrew"
|
||||
" and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
|
||||
" and Arabic) to get proper widget layout.") == "RTL"_L1);
|
||||
}
|
||||
|
||||
static void initFontUnlocked()
|
||||
@ -260,7 +262,7 @@ static void initThemeHints()
|
||||
static bool checkNeedPortalSupport()
|
||||
{
|
||||
#if QT_CONFIG(dbus)
|
||||
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() || qEnvironmentVariableIsSet("SNAP");
|
||||
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty() || qEnvironmentVariableIsSet("SNAP");
|
||||
#else
|
||||
return false;
|
||||
#endif // QT_CONFIG(dbus)
|
||||
@ -1247,7 +1249,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
||||
"Reinstalling the application may fix this problem.\n");
|
||||
|
||||
if (!availablePlugins.isEmpty())
|
||||
fatalMessage += QStringLiteral("\nAvailable platform plugins are: %1.\n").arg(availablePlugins.join(QLatin1String(", ")));
|
||||
fatalMessage += QStringLiteral("\nAvailable platform plugins are: %1.\n").arg(availablePlugins.join(", "_L1));
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
// Windows: Display message box unless it is a console application
|
||||
@ -1586,11 +1588,11 @@ void QGuiApplicationPrivate::init()
|
||||
} else if (strncmp(arg, "-psn_", 5) == 0) {
|
||||
// eat "-psn_xxxx" on Mac, which is passed when starting an app from Finder.
|
||||
// special hack to change working directory (for an app bundle) when running from finder
|
||||
if (QDir::currentPath() == QLatin1String("/")) {
|
||||
if (QDir::currentPath() == "/"_L1) {
|
||||
QCFType<CFURLRef> bundleURL(CFBundleCopyBundleURL(CFBundleGetMainBundle()));
|
||||
QString qbundlePath = QCFString(CFURLCopyFileSystemPath(bundleURL,
|
||||
kCFURLPOSIXPathStyle));
|
||||
if (qbundlePath.endsWith(QLatin1String(".app")))
|
||||
if (qbundlePath.endsWith(".app"_L1))
|
||||
QDir::setCurrent(qbundlePath.section(u'/', 0, -2));
|
||||
}
|
||||
#endif
|
||||
|
@ -48,6 +48,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QInputDevice
|
||||
\brief The QInputDevice class describes a device from which a QInputEvent originates.
|
||||
@ -323,7 +325,7 @@ const QInputDevice *QInputDevice::primaryKeyboard(const QString& seatName)
|
||||
qCDebug(lcQpaInputDevices) << "no keyboards registered for seat" << seatName
|
||||
<< "The platform plugin should have provided one via "
|
||||
"QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
|
||||
ret = new QInputDevice(QLatin1String("core keyboard"), 0, DeviceType::Keyboard, seatName, QCoreApplication::instance());
|
||||
ret = new QInputDevice("core keyboard"_L1, 0, DeviceType::Keyboard, seatName, QCoreApplication::instance());
|
||||
QInputDevicePrivate::registerDevice(ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -46,15 +46,17 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
|
||||
{
|
||||
QStringList formats;
|
||||
formats.reserve(imageFormats.size());
|
||||
for (const auto &format : imageFormats)
|
||||
formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
|
||||
formats.append("image/"_L1 + QLatin1String(format.toLower()));
|
||||
|
||||
//put png at the front because it is best
|
||||
int pngIndex = formats.indexOf(QLatin1String("image/png"));
|
||||
int pngIndex = formats.indexOf("image/png"_L1);
|
||||
if (pngIndex != -1 && pngIndex != 0)
|
||||
formats.move(pngIndex, 0);
|
||||
|
||||
@ -83,7 +85,7 @@ QInternalMimeData::~QInternalMimeData()
|
||||
bool QInternalMimeData::hasFormat(const QString &mimeType) const
|
||||
{
|
||||
bool foundFormat = hasFormat_sys(mimeType);
|
||||
if (!foundFormat && mimeType == QLatin1String("application/x-qt-image")) {
|
||||
if (!foundFormat && mimeType == "application/x-qt-image"_L1) {
|
||||
QStringList imageFormats = imageReadMimeFormats();
|
||||
for (int i = 0; i < imageFormats.size(); ++i) {
|
||||
if ((foundFormat = hasFormat_sys(imageFormats.at(i))))
|
||||
@ -96,11 +98,11 @@ bool QInternalMimeData::hasFormat(const QString &mimeType) const
|
||||
QStringList QInternalMimeData::formats() const
|
||||
{
|
||||
QStringList realFormats = formats_sys();
|
||||
if (!realFormats.contains(QLatin1String("application/x-qt-image"))) {
|
||||
if (!realFormats.contains("application/x-qt-image"_L1)) {
|
||||
QStringList imageFormats = imageReadMimeFormats();
|
||||
for (int i = 0; i < imageFormats.size(); ++i) {
|
||||
if (realFormats.contains(imageFormats.at(i))) {
|
||||
realFormats += QLatin1String("application/x-qt-image");
|
||||
realFormats += "application/x-qt-image"_L1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -111,7 +113,7 @@ QStringList QInternalMimeData::formats() const
|
||||
QVariant QInternalMimeData::retrieveData(const QString &mimeType, QMetaType type) const
|
||||
{
|
||||
QVariant data = retrieveData_sys(mimeType, type);
|
||||
if (mimeType == QLatin1String("application/x-qt-image")) {
|
||||
if (mimeType == "application/x-qt-image"_L1) {
|
||||
if (data.isNull() || (data.metaType().id() == QMetaType::QByteArray && data.toByteArray().isEmpty())) {
|
||||
// try to find an image
|
||||
QStringList imageFormats = imageReadMimeFormats();
|
||||
@ -128,7 +130,7 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QMetaType type
|
||||
&& (typeId == QMetaType::QImage || typeId == QMetaType::QPixmap || typeId == QMetaType::QBitmap))
|
||||
data = QImage::fromData(data.toByteArray());
|
||||
|
||||
} else if (mimeType == QLatin1String("application/x-color") && data.metaType().id() == QMetaType::QByteArray) {
|
||||
} else if (mimeType == "application/x-color"_L1 && data.metaType().id() == QMetaType::QByteArray) {
|
||||
QColor c;
|
||||
QByteArray ba = data.toByteArray();
|
||||
if (ba.size() == 8) {
|
||||
@ -160,7 +162,7 @@ bool QInternalMimeData::canReadData(const QString &mimeType)
|
||||
QStringList QInternalMimeData::formatsHelper(const QMimeData *data)
|
||||
{
|
||||
QStringList realFormats = data->formats();
|
||||
if (realFormats.contains(QLatin1String("application/x-qt-image"))) {
|
||||
if (realFormats.contains("application/x-qt-image"_L1)) {
|
||||
// add all supported image formats
|
||||
QStringList imageFormats = imageWriteMimeFormats();
|
||||
for (int i = 0; i < imageFormats.size(); ++i) {
|
||||
@ -176,14 +178,14 @@ bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData
|
||||
|
||||
bool foundFormat = data->hasFormat(mimeType);
|
||||
if (!foundFormat) {
|
||||
if (mimeType == QLatin1String("application/x-qt-image")) {
|
||||
if (mimeType == "application/x-qt-image"_L1) {
|
||||
// check all supported image formats
|
||||
QStringList imageFormats = imageWriteMimeFormats();
|
||||
for (int i = 0; i < imageFormats.size(); ++i) {
|
||||
if ((foundFormat = data->hasFormat(imageFormats.at(i))))
|
||||
break;
|
||||
}
|
||||
} else if (mimeType.startsWith(QLatin1String("image/"))) {
|
||||
} else if (mimeType.startsWith("image/"_L1)) {
|
||||
return data->hasImage() && imageWriteMimeFormats().contains(mimeType);
|
||||
}
|
||||
}
|
||||
@ -193,7 +195,7 @@ bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData
|
||||
QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QMimeData *data)
|
||||
{
|
||||
QByteArray ba;
|
||||
if (mimeType == QLatin1String("application/x-color")) {
|
||||
if (mimeType == "application/x-color"_L1) {
|
||||
/* QMimeData can only provide colors as QColor or the name
|
||||
of a color as a QByteArray or a QString. So we need to do
|
||||
the conversion to application/x-color here.
|
||||
@ -215,13 +217,13 @@ QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QM
|
||||
} else {
|
||||
ba = data->data(mimeType);
|
||||
if (ba.isEmpty()) {
|
||||
if (mimeType == QLatin1String("application/x-qt-image") && data->hasImage()) {
|
||||
if (mimeType == "application/x-qt-image"_L1 && data->hasImage()) {
|
||||
QImage image = qvariant_cast<QImage>(data->imageData());
|
||||
QBuffer buf(&ba);
|
||||
buf.open(QBuffer::WriteOnly);
|
||||
// would there not be PNG ??
|
||||
image.save(&buf, "PNG");
|
||||
} else if (mimeType.startsWith(QLatin1String("image/")) && data->hasImage()) {
|
||||
} else if (mimeType.startsWith("image/"_L1) && data->hasImage()) {
|
||||
QImage image = qvariant_cast<QImage>(data->imageData());
|
||||
QBuffer buf(&ba);
|
||||
buf.open(QBuffer::WriteOnly);
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#if defined(Q_OS_MACOS) || defined(Q_CLANG_QDOC)
|
||||
static bool qt_sequence_no_mnemonics = true;
|
||||
struct MacSpecialKey {
|
||||
@ -1097,20 +1099,20 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
|
||||
*gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode));
|
||||
*gmodifs << QModifKeyName(Qt::SHIFT, QChar(kShiftUnicode));
|
||||
#endif
|
||||
*gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+"))
|
||||
<< QModifKeyName(Qt::SHIFT, QLatin1String("shift+"))
|
||||
<< QModifKeyName(Qt::ALT, QLatin1String("alt+"))
|
||||
<< QModifKeyName(Qt::META, QLatin1String("meta+"))
|
||||
<< QModifKeyName(Qt::KeypadModifier, QLatin1String("num+"));
|
||||
*gmodifs << QModifKeyName(Qt::CTRL, "ctrl+"_L1)
|
||||
<< QModifKeyName(Qt::SHIFT, "shift+"_L1)
|
||||
<< QModifKeyName(Qt::ALT, "alt+"_L1)
|
||||
<< QModifKeyName(Qt::META, "meta+"_L1)
|
||||
<< QModifKeyName(Qt::KeypadModifier, "num+"_L1);
|
||||
}
|
||||
} else {
|
||||
gmodifs = globalPortableModifs();
|
||||
if (gmodifs->isEmpty()) {
|
||||
*gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+"))
|
||||
<< QModifKeyName(Qt::SHIFT, QLatin1String("shift+"))
|
||||
<< QModifKeyName(Qt::ALT, QLatin1String("alt+"))
|
||||
<< QModifKeyName(Qt::META, QLatin1String("meta+"))
|
||||
<< QModifKeyName(Qt::KeypadModifier, QLatin1String("num+"));
|
||||
*gmodifs << QModifKeyName(Qt::CTRL, "ctrl+"_L1)
|
||||
<< QModifKeyName(Qt::SHIFT, "shift+"_L1)
|
||||
<< QModifKeyName(Qt::ALT, "alt+"_L1)
|
||||
<< QModifKeyName(Qt::META, "meta+"_L1)
|
||||
<< QModifKeyName(Qt::KeypadModifier, "num+"_L1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1546,7 +1548,7 @@ QString QKeySequence::toString(SequenceFormat format) const
|
||||
int end = count();
|
||||
for (int i = 0; i < end; ++i) {
|
||||
finalString += d->encodeString(d->key[i], format);
|
||||
finalString += QLatin1String(", ");
|
||||
finalString += ", "_L1;
|
||||
}
|
||||
finalString.truncate(finalString.length() - 2);
|
||||
return finalString;
|
||||
@ -1576,7 +1578,7 @@ QList<QKeySequence> QKeySequence::listFromString(const QString &str, SequenceFor
|
||||
{
|
||||
QList<QKeySequence> result;
|
||||
|
||||
const QStringList strings = str.split(QLatin1String("; "));
|
||||
const QStringList strings = str.split("; "_L1);
|
||||
result.reserve(strings.count());
|
||||
for (const QString &string : strings) {
|
||||
result << fromString(string, format);
|
||||
@ -1599,7 +1601,7 @@ QString QKeySequence::listToString(const QList<QKeySequence> &list, SequenceForm
|
||||
|
||||
for (const QKeySequence &sequence : list) {
|
||||
result += sequence.toString(format);
|
||||
result += QLatin1String("; ");
|
||||
result += "; "_L1;
|
||||
}
|
||||
result.truncate(result.length() - 2);
|
||||
|
||||
|
@ -50,6 +50,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QOffscreenSurface
|
||||
\inmodule QtGui
|
||||
@ -162,7 +164,7 @@ void QOffscreenSurface::create()
|
||||
// violate the minimum title bar width on the platform.
|
||||
d->offscreenWindow->setFlags(d->offscreenWindow->flags()
|
||||
| Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||
d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface"));
|
||||
d->offscreenWindow->setObjectName("QOffscreenSurface"_L1);
|
||||
// Remove this window from the global list since we do not want it to be destroyed when closing the app.
|
||||
// The QOffscreenSurface has to be usable even after exiting the event loop.
|
||||
QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QPlatformDialogHelper::StandardButton,
|
||||
QPlatformDialogHelper__StandardButton)
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QPlatformDialogHelper::ButtonRole,
|
||||
@ -299,7 +301,7 @@ void QColorDialogStaticData::readSettings()
|
||||
#if QT_CONFIG(settings)
|
||||
const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
|
||||
for (int i = 0; i < int(CustomColorCount); ++i) {
|
||||
const QVariant v = settings.value(QLatin1String("Qt/customColors/") + QString::number(i));
|
||||
const QVariant v = settings.value("Qt/customColors/"_L1 + QString::number(i));
|
||||
if (v.isValid())
|
||||
customRgb[i] = v.toUInt();
|
||||
}
|
||||
@ -313,7 +315,7 @@ void QColorDialogStaticData::writeSettings() const
|
||||
const_cast<QColorDialogStaticData*>(this)->customSet = false;
|
||||
QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
|
||||
for (int i = 0; i < int(CustomColorCount); ++i)
|
||||
settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
|
||||
settings.setValue("Qt/customColors/"_L1 + QString::number(i), customRgb[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -48,9 +48,11 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#if QT_CONFIG(settings)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QPlatformInputContextFactoryInterface_iid, QLatin1String("/platforminputcontexts"), Qt::CaseInsensitive))
|
||||
(QPlatformInputContextFactoryInterface_iid, "/platforminputcontexts"_L1, Qt::CaseInsensitive))
|
||||
#endif
|
||||
|
||||
QStringList QPlatformInputContextFactory::keys()
|
||||
|
@ -48,8 +48,10 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))
|
||||
(QPlatformIntegrationFactoryInterface_iid, "/platforms"_L1, Qt::CaseInsensitive))
|
||||
|
||||
QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList ¶mList, int &argc, char **argv, const QString &platformPluginPath)
|
||||
{
|
||||
|
@ -48,8 +48,10 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
(QPlatformThemeFactoryInterface_iid, QLatin1String("/platformthemes"), Qt::CaseInsensitive))
|
||||
(QPlatformThemeFactoryInterface_iid, "/platformthemes"_L1, Qt::CaseInsensitive))
|
||||
|
||||
QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath)
|
||||
{
|
||||
|
@ -51,6 +51,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcPointerGrab, "qt.pointer.grab");
|
||||
|
||||
/*!
|
||||
@ -149,7 +151,7 @@ Q_LOGGING_CATEGORY(lcPointerGrab, "qt.pointer.grab");
|
||||
Creates a new invalid pointing device instance as a child of \a parent.
|
||||
*/
|
||||
QPointingDevice::QPointingDevice(QObject *parent)
|
||||
: QInputDevice(*(new QPointingDevicePrivate(QLatin1String("unknown"), -1,
|
||||
: QInputDevice(*(new QPointingDevicePrivate("unknown"_L1, -1,
|
||||
DeviceType::Unknown, PointerType::Unknown,
|
||||
Capability::None, 0, 0)), parent)
|
||||
{
|
||||
@ -303,7 +305,7 @@ const QPointingDevice *QPointingDevice::primaryPointingDevice(const QString& sea
|
||||
qCDebug(lcQpaInputDevices) << "no mouse-like devices registered for seat" << seatName
|
||||
<< "The platform plugin should have provided one via "
|
||||
"QWindowSystemInterface::registerInputDevice(). Creating a default mouse for now.";
|
||||
mouse = new QPointingDevice(QLatin1String("core pointer"), 1, DeviceType::Mouse,
|
||||
mouse = new QPointingDevice("core pointer"_L1, 1, DeviceType::Mouse,
|
||||
PointerType::Generic, Capability::Position, 1, 3, seatName,
|
||||
QPointingDeviceUniqueId(), QCoreApplication::instance());
|
||||
QInputDevicePrivate::registerDevice(mouse);
|
||||
@ -669,9 +671,9 @@ const QPointingDevice *QPointingDevicePrivate::tabletDevice(QInputDevice::Device
|
||||
<< deviceType << pointerType << Qt::hex << uniqueId.numericId()
|
||||
<< "The platform plugin should have provided one via "
|
||||
"QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
|
||||
dev = new QPointingDevice(QLatin1String("fake tablet"), 2, deviceType, pointerType,
|
||||
QInputDevice::Capability::Position | QInputDevice::Capability::Pressure,
|
||||
1, 1, QString(), uniqueId, QCoreApplication::instance());
|
||||
dev = new QPointingDevice("fake tablet"_L1, 2, deviceType, pointerType,
|
||||
QInputDevice::Capability::Position | QInputDevice::Capability::Pressure,
|
||||
1, 1, QString(), uniqueId, QCoreApplication::instance());
|
||||
QInputDevicePrivate::registerDevice(dev);
|
||||
}
|
||||
return dev;
|
||||
|
@ -58,6 +58,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices")
|
||||
|
||||
QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
|
||||
@ -1229,7 +1231,7 @@ namespace QTest
|
||||
QInputDevice::Capabilities caps = QInputDevice::Capability::Position)
|
||||
{
|
||||
static qint64 nextId = 0x100000000;
|
||||
QPointingDevice *ret = new QPointingDevice(QLatin1String("test touch device"), nextId++,
|
||||
QPointingDevice *ret = new QPointingDevice("test touch device"_L1, nextId++,
|
||||
devType, QPointingDevice::PointerType::Finger,
|
||||
caps, 8, 0);
|
||||
QWindowSystemInterface::registerInputDevice(ret);
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#if defined(QT_OPENGL_3)
|
||||
typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
|
||||
#endif
|
||||
@ -210,8 +212,8 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v)
|
||||
if (!v.isObject())
|
||||
return result;
|
||||
const QJsonObject o = v.toObject();
|
||||
result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString());
|
||||
const QString opS = o.value(QLatin1String("op")).toString();
|
||||
result.number = QVersionNumber::fromString(o.value("value"_L1).toString());
|
||||
const QString opS = o.value("op"_L1).toString();
|
||||
for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) {
|
||||
if (opS == QLatin1String(operators[i])) {
|
||||
result.op = static_cast<Operator>(i);
|
||||
@ -282,9 +284,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v)
|
||||
if (!v.isObject())
|
||||
return result;
|
||||
const QJsonObject o = v.toObject();
|
||||
result.type = o.value(QLatin1String("type")).toString();
|
||||
result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version")));
|
||||
result.release = o.value(QLatin1String("release")).toArray();
|
||||
result.type = o.value("type"_L1).toString();
|
||||
result.versionTerm = VersionTerm::fromJson(o.value("version"_L1));
|
||||
result.release = o.value("release"_L1).toArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -308,8 +310,8 @@ QString OsTypeTerm::hostOs()
|
||||
static QString msgSyntaxWarning(const QJsonObject &object, const QString &what)
|
||||
{
|
||||
QString result;
|
||||
QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt()
|
||||
<< " (\"" << object.value(QLatin1String("description")).toString()
|
||||
QTextStream(&result) << "Id " << object.value("id"_L1).toInt()
|
||||
<< " (\"" << object.value("description"_L1).toString()
|
||||
<< "\"): " << what;
|
||||
return result;
|
||||
}
|
||||
@ -323,11 +325,11 @@ static bool matches(const QJsonObject &object,
|
||||
const QString &osRelease,
|
||||
const QOpenGLConfig::Gpu &gpu)
|
||||
{
|
||||
const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os")));
|
||||
const OsTypeTerm os = OsTypeTerm::fromJson(object.value("os"_L1));
|
||||
if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease))
|
||||
return false;
|
||||
|
||||
const QJsonValue exceptionsV = object.value(QLatin1String("exceptions"));
|
||||
const QJsonValue exceptionsV = object.value("exceptions"_L1);
|
||||
if (exceptionsV.isArray()) {
|
||||
const QJsonArray exceptionsA = exceptionsV.toArray();
|
||||
for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) {
|
||||
@ -336,20 +338,20 @@ static bool matches(const QJsonObject &object,
|
||||
}
|
||||
}
|
||||
|
||||
const QJsonValue vendorV = object.value(QLatin1String("vendor_id"));
|
||||
const QJsonValue vendorV = object.value("vendor_id"_L1);
|
||||
if (vendorV.isString()) {
|
||||
if (gpu.vendorId != vendorV.toString().toUInt(nullptr, /* base */ 0))
|
||||
return false;
|
||||
} else {
|
||||
if (object.contains(QLatin1String("gl_vendor"))) {
|
||||
const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8();
|
||||
if (object.contains("gl_vendor"_L1)) {
|
||||
const QByteArray glVendorV = object.value("gl_vendor"_L1).toString().toUtf8();
|
||||
if (!gpu.glVendor.contains(glVendorV))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (gpu.deviceId) {
|
||||
const QJsonValue deviceIdV = object.value(QLatin1String("device_id"));
|
||||
const QJsonValue deviceIdV = object.value("device_id"_L1);
|
||||
switch (deviceIdV.type()) {
|
||||
case QJsonValue::Array:
|
||||
if (!contains(deviceIdV.toArray(), gpu.deviceId))
|
||||
@ -360,12 +362,11 @@ static bool matches(const QJsonObject &object,
|
||||
break;
|
||||
default:
|
||||
qWarning().noquote()
|
||||
<< msgSyntaxWarning(object,
|
||||
QLatin1String("Device ID must be of type array."));
|
||||
<< msgSyntaxWarning(object, "Device ID must be of type array."_L1);
|
||||
}
|
||||
}
|
||||
if (!gpu.driverVersion.isNull()) {
|
||||
const QJsonValue driverVersionV = object.value(QLatin1String("driver_version"));
|
||||
const QJsonValue driverVersionV = object.value("driver_version"_L1);
|
||||
switch (driverVersionV.type()) {
|
||||
case QJsonValue::Object:
|
||||
if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion))
|
||||
@ -376,13 +377,12 @@ static bool matches(const QJsonObject &object,
|
||||
break;
|
||||
default:
|
||||
qWarning().noquote()
|
||||
<< msgSyntaxWarning(object,
|
||||
QLatin1String("Driver version must be of type object."));
|
||||
<< msgSyntaxWarning(object, "Driver version must be of type object."_L1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gpu.driverDescription.isEmpty()) {
|
||||
const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description"));
|
||||
const QJsonValue driverDescriptionV = object.value("driver_description"_L1);
|
||||
if (driverDescriptionV.isString()) {
|
||||
if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8()))
|
||||
return false;
|
||||
@ -402,9 +402,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
|
||||
{
|
||||
result->clear();
|
||||
errorMessage->clear();
|
||||
const QJsonValue entriesV = doc.object().value(QLatin1String("entries"));
|
||||
const QJsonValue entriesV = doc.object().value("entries"_L1);
|
||||
if (!entriesV.isArray()) {
|
||||
*errorMessage = QLatin1String("No entries read.");
|
||||
*errorMessage = "No entries read."_L1;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
|
||||
if (eit->isObject()) {
|
||||
const QJsonObject object = eit->toObject();
|
||||
if (matches(object, osName, kernelVersion, osRelease, gpu)) {
|
||||
const QJsonValue featuresListV = object.value(QLatin1String("features"));
|
||||
const QJsonValue featuresListV = object.value("features"_L1);
|
||||
if (featuresListV.isArray()) {
|
||||
const QJsonArray featuresListA = featuresListV.toArray();
|
||||
for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit)
|
||||
@ -465,9 +465,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
|
||||
}
|
||||
const bool success = readGpuFeatures(gpu, osName, kernelVersion, osRelease, file.readAll(), result, errorMessage);
|
||||
if (!success) {
|
||||
errorMessage->prepend(QLatin1String("Error reading \"")
|
||||
errorMessage->prepend("Error reading \""_L1
|
||||
+ QDir::toNativeSeparators(fileName)
|
||||
+ QLatin1String("\": "));
|
||||
+ "\": "_L1);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
|
||||
#define QT_OPENGL_FUNCTION_NAMES(ret, name, args) \
|
||||
"gl"#name"\0"
|
||||
@ -431,9 +433,9 @@ static int qt_gl_resolve_extensions()
|
||||
QString *deviceName =
|
||||
static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName"));
|
||||
static bool wrongfullyReportsBgra8888Support = deviceName != 0
|
||||
&& (deviceName->compare(QLatin1String("samsung SM-T211"), Qt::CaseInsensitive) == 0
|
||||
|| deviceName->compare(QLatin1String("samsung SM-T210"), Qt::CaseInsensitive) == 0
|
||||
|| deviceName->compare(QLatin1String("samsung SM-T215"), Qt::CaseInsensitive) == 0);
|
||||
&& (deviceName->compare("samsung SM-T211"_L1, Qt::CaseInsensitive) == 0
|
||||
|| deviceName->compare("samsung SM-T210"_L1, Qt::CaseInsensitive) == 0
|
||||
|| deviceName->compare("samsung SM-T215"_L1, Qt::CaseInsensitive) == 0);
|
||||
if (wrongfullyReportsBgra8888Support)
|
||||
extensions &= ~QOpenGLExtensions::BGRATextureFormat;
|
||||
#endif
|
||||
|
@ -54,6 +54,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcOpenGLProgramDiskCache, "qt.opengl.diskcache")
|
||||
|
||||
#ifndef GL_CONTEXT_LOST
|
||||
@ -117,7 +119,7 @@ static inline bool qt_ensureWritableDir(const QString &name)
|
||||
QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache()
|
||||
: m_cacheWritable(false)
|
||||
{
|
||||
const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + u'/';
|
||||
const QString subPath = "/qtshadercache-"_L1 + QSysInfo::buildAbi() + u'/';
|
||||
const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
|
||||
m_globalCacheDir = sharedCachePath + subPath;
|
||||
m_localCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + subPath;
|
||||
|
@ -44,6 +44,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QBackingStoreDefaultCompositor::~QBackingStoreDefaultCompositor()
|
||||
{
|
||||
reset();
|
||||
@ -349,8 +351,8 @@ static QRhiGraphicsPipeline *createGraphicsPipeline(QRhi *rhi,
|
||||
}
|
||||
|
||||
ps->setShaderStages({
|
||||
{ QRhiShaderStage::Vertex, getShader(QLatin1String(":/qt-project.org/gui/painting/shaders/backingstorecompose.vert.qsb")) },
|
||||
{ QRhiShaderStage::Fragment, getShader(QLatin1String(":/qt-project.org/gui/painting/shaders/backingstorecompose.frag.qsb")) }
|
||||
{ QRhiShaderStage::Vertex, getShader(":/qt-project.org/gui/painting/shaders/backingstorecompose.vert.qsb"_L1) },
|
||||
{ QRhiShaderStage::Fragment, getShader(":/qt-project.org/gui/painting/shaders/backingstorecompose.frag.qsb"_L1) }
|
||||
});
|
||||
QRhiVertexInputLayout inputLayout;
|
||||
inputLayout.setBindings({ { 5 * sizeof(float) } });
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
|
||||
// Avoid an ABI break due to the QScopedPointer->std::unique_ptr change
|
||||
static_assert(sizeof(QBrush::DataPtr) == sizeof(QScopedPointer<QBrushData, QBrushDataPointerDeleter>));
|
||||
@ -114,7 +116,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
|
||||
{
|
||||
|
||||
QPixmap pm;
|
||||
QString key = QLatin1String("$qt-brush$")
|
||||
QString key = "$qt-brush$"_L1
|
||||
% HexString<uint>(brushStyle)
|
||||
% QLatin1Char(invert ? '1' : '0');
|
||||
if (!QPixmapCache::find(key, &pm)) {
|
||||
|
@ -48,6 +48,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QT_IMPL_METATYPE_EXTERN(QPageSize)
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QPageSize::PageSizeId, QPageSize__PageSizeId)
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QPageSize::Unit, QPageSize__Unit)
|
||||
@ -405,9 +407,9 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match
|
||||
return QPageSize::Custom;
|
||||
QStringView key(ppdKey);
|
||||
// Remove any Rotated or Tranverse modifiers
|
||||
if (key.endsWith(QLatin1String("Rotated")))
|
||||
if (key.endsWith("Rotated"_L1))
|
||||
key.chop(7);
|
||||
else if (key.endsWith(QLatin1String(".Transverse")))
|
||||
else if (key.endsWith(".Transverse"_L1))
|
||||
key.chop(11);
|
||||
for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) {
|
||||
if (QLatin1String(qt_pageSizes[i].mediaOption) == key) {
|
||||
|
@ -78,6 +78,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
// We changed the type from QScopedPointer to unique_ptr, make sure it's binary compatible:
|
||||
static_assert(sizeof(QScopedPointer<QPainterPrivate>) == sizeof(std::unique_ptr<QPainterPrivate>));
|
||||
|
||||
@ -5925,7 +5927,7 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
|
||||
{
|
||||
const qreal radiusBase = qMax(qreal(1), maxRadius);
|
||||
|
||||
QString key = QLatin1String("WaveUnderline-")
|
||||
QString key = "WaveUnderline-"_L1
|
||||
% pen.color().name()
|
||||
% HexString<qreal>(radiusBase)
|
||||
% HexString<qreal>(pen.widthF());
|
||||
|
@ -78,6 +78,8 @@ static void initResources()
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
inline QPaintEngine::PaintEngineFeatures qt_pdf_decide_features()
|
||||
{
|
||||
QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures;
|
||||
@ -1735,11 +1737,11 @@ int QPdfEnginePrivate::writeXmpDcumentMetaData()
|
||||
else if (offset > 0)
|
||||
tzStr = QString::asprintf("+%02d:%02d", hours , mins);
|
||||
else
|
||||
tzStr = QLatin1String("Z");
|
||||
tzStr = "Z"_L1;
|
||||
|
||||
const QString metaDataDate = timeStr + tzStr;
|
||||
|
||||
QFile metaDataFile(QLatin1String(":/qpdf/qpdfa_metadata.xml"));
|
||||
QFile metaDataFile(":/qpdf/qpdfa_metadata.xml"_L1);
|
||||
metaDataFile.open(QIODevice::ReadOnly);
|
||||
metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(),
|
||||
title.toHtmlEscaped(),
|
||||
@ -1765,7 +1767,7 @@ int QPdfEnginePrivate::writeOutputIntent()
|
||||
{
|
||||
const int colorProfile = addXrefEntry(-1);
|
||||
{
|
||||
QFile colorProfileFile(QLatin1String(":/qpdf/sRGB2014.icc"));
|
||||
QFile colorProfileFile(":/qpdf/sRGB2014.icc"_L1);
|
||||
colorProfileFile.open(QIODevice::ReadOnly);
|
||||
const QByteArray colorProfileData = colorProfileFile.readAll();
|
||||
|
||||
@ -1860,8 +1862,7 @@ void QPdfEnginePrivate::writeAttachmentRoot()
|
||||
, attachmentID);
|
||||
if (!attachment.mimeType.isEmpty())
|
||||
xprintf("/Subtype/%s\n",
|
||||
attachment.mimeType.replace(QLatin1String("/"),
|
||||
QLatin1String("#2F")).toLatin1().constData());
|
||||
attachment.mimeType.replace("/"_L1, "#2F"_L1).toLatin1().constData());
|
||||
xprintf(">>\nendobj\n");
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
typedef QList<QMacInternalPasteboardMime*> MimeList;
|
||||
Q_GLOBAL_STATIC(MimeList, globalMimeList)
|
||||
Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList)
|
||||
@ -203,23 +205,23 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeAny::convertorName()
|
||||
{
|
||||
return QLatin1String("Any-Mime");
|
||||
return "Any-Mime"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeAny::flavorFor(const QString &mime)
|
||||
{
|
||||
// do not handle the mime type name in the drag pasteboard
|
||||
if (mime == QLatin1String("application/x-qt-mime-type-name"))
|
||||
if (mime == "application/x-qt-mime-type-name"_L1)
|
||||
return QString();
|
||||
QString ret = QLatin1String("com.trolltech.anymime.") + mime;
|
||||
return ret.replace(u'/', QLatin1String("--"));
|
||||
QString ret = "com.trolltech.anymime."_L1 + mime;
|
||||
return ret.replace(u'/', "--"_L1);
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeAny::mimeFor(QString flav)
|
||||
{
|
||||
const QString any_prefix = QLatin1String("com.trolltech.anymime.");
|
||||
const QString any_prefix = "com.trolltech.anymime."_L1;
|
||||
if (flav.size() > any_prefix.length() && flav.startsWith(any_prefix))
|
||||
return flav.mid(any_prefix.length()).replace(QLatin1String("--"), QLatin1String("/"));
|
||||
return flav.mid(any_prefix.length()).replace("--"_L1, "/"_L1);
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -233,7 +235,7 @@ QVariant QMacPasteboardMimeAny::convertToMime(const QString &mime, QList<QByteAr
|
||||
if (data.count() > 1)
|
||||
qWarning("QMacPasteboardMimeAny: Cannot handle multiple member data");
|
||||
QVariant ret;
|
||||
if (mime == QLatin1String("text/plain"))
|
||||
if (mime == "text/plain"_L1)
|
||||
ret = QString::fromUtf8(data.first());
|
||||
else
|
||||
ret = data.first();
|
||||
@ -243,7 +245,7 @@ QVariant QMacPasteboardMimeAny::convertToMime(const QString &mime, QList<QByteAr
|
||||
QList<QByteArray> QMacPasteboardMimeAny::convertFromMime(const QString &mime, QVariant data, QString)
|
||||
{
|
||||
QList<QByteArray> ret;
|
||||
if (mime == QLatin1String("text/plain"))
|
||||
if (mime == "text/plain"_L1)
|
||||
ret.append(data.toString().toUtf8());
|
||||
else
|
||||
ret.append(data.toByteArray());
|
||||
@ -269,13 +271,13 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeTypeName::convertorName()
|
||||
{
|
||||
return QLatin1String("Qt-Mime-Type");
|
||||
return "Qt-Mime-Type"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeTypeName::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime == QLatin1String("application/x-qt-mime-type-name"))
|
||||
return QLatin1String("com.trolltech.qt.MimeTypeName");
|
||||
if (mime == "application/x-qt-mime-type-name"_L1)
|
||||
return "com.trolltech.qt.MimeTypeName"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -298,7 +300,7 @@ QVariant QMacPasteboardMimeTypeName::convertToMime(const QString &, QList<QByteA
|
||||
QList<QByteArray> QMacPasteboardMimeTypeName::convertFromMime(const QString &, QVariant, QString)
|
||||
{
|
||||
QList<QByteArray> ret;
|
||||
ret.append(QString(QLatin1String("x-qt-mime-type-name")).toUtf8());
|
||||
ret.append(QString("x-qt-mime-type-name"_L1).toUtf8());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -316,20 +318,20 @@ public:
|
||||
|
||||
QString QMacPasteboardMimePlainTextFallback::convertorName()
|
||||
{
|
||||
return QLatin1String("PlainText (public.text)");
|
||||
return "PlainText (public.text)"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimePlainTextFallback::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime == QLatin1String("text/plain"))
|
||||
return QLatin1String("public.text");
|
||||
if (mime == "text/plain"_L1)
|
||||
return "public.text"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimePlainTextFallback::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.text"))
|
||||
return QLatin1String("text/plain");
|
||||
if (flav == "public.text"_L1)
|
||||
return "text/plain"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -343,7 +345,7 @@ QVariant QMacPasteboardMimePlainTextFallback::convertToMime(const QString &mimet
|
||||
if (data.count() > 1)
|
||||
qWarning("QMacPasteboardMimePlainTextFallback: Cannot handle multiple member data");
|
||||
|
||||
if (flavor == QLatin1String("public.text")) {
|
||||
if (flavor == "public.text"_L1) {
|
||||
// Note that public.text is documented by Apple to have an undefined encoding. From
|
||||
// testing it seems that utf8 is normally used, at least by Safari on iOS.
|
||||
const QByteArray &firstData = data.first();
|
||||
@ -360,7 +362,7 @@ QList<QByteArray> QMacPasteboardMimePlainTextFallback::convertFromMime(const QSt
|
||||
{
|
||||
QList<QByteArray> ret;
|
||||
QString string = data.toString();
|
||||
if (flavor == QLatin1String("public.text"))
|
||||
if (flavor == "public.text"_L1)
|
||||
ret.append(string.toUtf8());
|
||||
return ret;
|
||||
}
|
||||
@ -379,39 +381,38 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeUnicodeText::convertorName()
|
||||
{
|
||||
return QLatin1String("UnicodeText");
|
||||
return "UnicodeText"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeUnicodeText::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime == QLatin1String("text/plain"))
|
||||
return QLatin1String("public.utf16-plain-text");
|
||||
int i = mime.indexOf(QLatin1String("charset="));
|
||||
if (mime == "text/plain"_L1)
|
||||
return "public.utf16-plain-text"_L1;
|
||||
int i = mime.indexOf("charset="_L1);
|
||||
if (i >= 0) {
|
||||
QString cs(mime.mid(i+8).toLower());
|
||||
i = cs.indexOf(u';');
|
||||
if (i>=0)
|
||||
cs = cs.left(i);
|
||||
if (cs == QLatin1String("system"))
|
||||
return QLatin1String("public.utf8-plain-text");
|
||||
else if (cs == QLatin1String("iso-10646-ucs-2")
|
||||
|| cs == QLatin1String("utf16"))
|
||||
return QLatin1String("public.utf16-plain-text");
|
||||
if (cs == "system"_L1)
|
||||
return "public.utf8-plain-text"_L1;
|
||||
else if (cs == "iso-10646-ucs-2"_L1 || cs == "utf16"_L1)
|
||||
return "public.utf16-plain-text"_L1;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeUnicodeText::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.utf16-plain-text") || flav == QLatin1String("public.utf8-plain-text"))
|
||||
return QLatin1String("text/plain");
|
||||
if (flav == "public.utf16-plain-text"_L1 || flav == "public.utf8-plain-text"_L1)
|
||||
return "text/plain"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool QMacPasteboardMimeUnicodeText::canConvert(const QString &mime, QString flav)
|
||||
{
|
||||
return (mime == QLatin1String("text/plain")
|
||||
&& (flav == QLatin1String("public.utf8-plain-text") || (flav == QLatin1String("public.utf16-plain-text"))));
|
||||
return (mime == "text/plain"_L1
|
||||
&& (flav == "public.utf8-plain-text"_L1 || (flav == "public.utf16-plain-text"_L1)));
|
||||
}
|
||||
|
||||
QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, QList<QByteArray> data, QString flavor)
|
||||
@ -421,9 +422,9 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
|
||||
const QByteArray &firstData = data.first();
|
||||
// I can only handle two types (system and unicode) so deal with them that way
|
||||
QVariant ret;
|
||||
if (flavor == QLatin1String("public.utf8-plain-text")) {
|
||||
if (flavor == "public.utf8-plain-text"_L1) {
|
||||
ret = QString::fromUtf8(firstData);
|
||||
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
|
||||
} else if (flavor == "public.utf16-plain-text"_L1) {
|
||||
QString str = QStringDecoder(QStringDecoder::Utf16)(firstData);
|
||||
ret = str;
|
||||
} else {
|
||||
@ -436,9 +437,9 @@ QList<QByteArray> QMacPasteboardMimeUnicodeText::convertFromMime(const QString &
|
||||
{
|
||||
QList<QByteArray> ret;
|
||||
QString string = data.toString();
|
||||
if (flavor == QLatin1String("public.utf8-plain-text"))
|
||||
if (flavor == "public.utf8-plain-text"_L1)
|
||||
ret.append(string.toUtf8());
|
||||
else if (flavor == QLatin1String("public.utf16-plain-text")) {
|
||||
else if (flavor == "public.utf16-plain-text"_L1) {
|
||||
QStringEncoder::Flags f;
|
||||
#if defined(Q_OS_MACOS)
|
||||
// Some applications such as Microsoft Excel, don't deal well with
|
||||
@ -472,20 +473,20 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeHTMLText::convertorName()
|
||||
{
|
||||
return QLatin1String("HTML");
|
||||
return "HTML"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeHTMLText::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime == QLatin1String("text/html"))
|
||||
return QLatin1String("public.html");
|
||||
if (mime == "text/html"_L1)
|
||||
return "public.html"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeHTMLText::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.html"))
|
||||
return QLatin1String("text/html");
|
||||
if (flav == "public.html"_L1)
|
||||
return "text/html"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -526,20 +527,20 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeRtfText::convertorName()
|
||||
{
|
||||
return QLatin1String("Rtf");
|
||||
return "Rtf"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeRtfText::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime == QLatin1String("text/html"))
|
||||
return QLatin1String("public.rtf");
|
||||
if (mime == "text/html"_L1)
|
||||
return "public.rtf"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeRtfText::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.rtf"))
|
||||
return QLatin1String("text/html");
|
||||
if (flav == "public.rtf"_L1)
|
||||
return "text/html"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -602,26 +603,26 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeFileUri::convertorName()
|
||||
{
|
||||
return QLatin1String("FileURL");
|
||||
return "FileURL"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeFileUri::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime == QLatin1String("text/uri-list"))
|
||||
return QLatin1String("public.file-url");
|
||||
if (mime == "text/uri-list"_L1)
|
||||
return "public.file-url"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeFileUri::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.file-url"))
|
||||
return QLatin1String("text/uri-list");
|
||||
if (flav == "public.file-url"_L1)
|
||||
return "text/uri-list"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool QMacPasteboardMimeFileUri::canConvert(const QString &mime, QString flav)
|
||||
{
|
||||
return mime == QLatin1String("text/uri-list") && flav == QLatin1String("public.file-url");
|
||||
return mime == "text/uri-list"_L1 && flav == "public.file-url"_L1;
|
||||
}
|
||||
|
||||
QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
|
||||
@ -642,7 +643,7 @@ QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QBy
|
||||
url = QUrl::fromNSURL(nsurl);
|
||||
}
|
||||
|
||||
if (url.host().toLower() == QLatin1String("localhost"))
|
||||
if (url.host().toLower() == "localhost"_L1)
|
||||
url.setHost(QString());
|
||||
|
||||
url.setPath(url.path().normalized(QString::NormalizationForm_C));
|
||||
@ -660,10 +661,10 @@ QList<QByteArray> QMacPasteboardMimeFileUri::convertFromMime(const QString &mime
|
||||
for (int i = 0; i < urls.size(); ++i) {
|
||||
QUrl url = urls.at(i).toUrl();
|
||||
if (url.scheme().isEmpty())
|
||||
url.setScheme(QLatin1String("file"));
|
||||
if (url.scheme() == QLatin1String("file")) {
|
||||
url.setScheme("file"_L1);
|
||||
if (url.scheme() == "file"_L1) {
|
||||
if (url.host().isEmpty())
|
||||
url.setHost(QLatin1String("localhost"));
|
||||
url.setHost("localhost"_L1);
|
||||
url.setPath(url.path().normalized(QString::NormalizationForm_D));
|
||||
}
|
||||
if (url.isLocalFile())
|
||||
@ -691,27 +692,27 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeUrl::convertorName()
|
||||
{
|
||||
return QLatin1String("URL");
|
||||
return "URL"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeUrl::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime.startsWith(QLatin1String("text/uri-list")))
|
||||
return QLatin1String("public.url");
|
||||
if (mime.startsWith("text/uri-list"_L1))
|
||||
return "public.url"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeUrl::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.url"))
|
||||
return QLatin1String("text/uri-list");
|
||||
if (flav == "public.url"_L1)
|
||||
return "text/uri-list"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool QMacPasteboardMimeUrl::canConvert(const QString &mime, QString flav)
|
||||
{
|
||||
return flav == QLatin1String("public.url")
|
||||
&& mime == QLatin1String("text/uri-list");
|
||||
return flav == "public.url"_L1
|
||||
&& mime == "text/uri-list"_L1;
|
||||
}
|
||||
|
||||
QVariant QMacPasteboardMimeUrl::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
|
||||
@ -722,7 +723,7 @@ QVariant QMacPasteboardMimeUrl::convertToMime(const QString &mime, QList<QByteAr
|
||||
QList<QVariant> ret;
|
||||
for (int i=0; i<data.size(); ++i) {
|
||||
QUrl url = QUrl::fromEncoded(data.at(i));
|
||||
if (url.host().toLower() == QLatin1String("localhost"))
|
||||
if (url.host().toLower() == "localhost"_L1)
|
||||
url.setHost(QString());
|
||||
url.setPath(url.path().normalized(QString::NormalizationForm_C));
|
||||
ret.append(url);
|
||||
@ -740,10 +741,10 @@ QList<QByteArray> QMacPasteboardMimeUrl::convertFromMime(const QString &mime, QV
|
||||
for (int i=0; i<urls.size(); ++i) {
|
||||
QUrl url = urls.at(i).toUrl();
|
||||
if (url.scheme().isEmpty())
|
||||
url.setScheme(QLatin1String("file"));
|
||||
if (url.scheme() == QLatin1String("file")) {
|
||||
url.setScheme("file"_L1);
|
||||
if (url.scheme() == "file"_L1) {
|
||||
if (url.host().isEmpty())
|
||||
url.setHost(QLatin1String("localhost"));
|
||||
url.setHost("localhost"_L1);
|
||||
url.setPath(url.path().normalized(QString::NormalizationForm_D));
|
||||
}
|
||||
ret.append(url.toEncoded());
|
||||
@ -766,7 +767,7 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeVCard::convertorName()
|
||||
{
|
||||
return QLatin1String("VCard");
|
||||
return "VCard"_L1;
|
||||
}
|
||||
|
||||
bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav)
|
||||
@ -776,22 +777,22 @@ bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav)
|
||||
|
||||
QString QMacPasteboardMimeVCard::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime.startsWith(QLatin1String("text/vcard")))
|
||||
return QLatin1String("public.vcard");
|
||||
if (mime.startsWith("text/vcard"_L1))
|
||||
return "public.vcard"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeVCard::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.vcard"))
|
||||
return QLatin1String("text/vcard");
|
||||
if (flav == "public.vcard"_L1)
|
||||
return "text/vcard"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByteArray> data, QString)
|
||||
{
|
||||
QByteArray cards;
|
||||
if (mime == QLatin1String("text/vcard")) {
|
||||
if (mime == "text/vcard"_L1) {
|
||||
for (int i=0; i<data.size(); ++i)
|
||||
cards += data[i];
|
||||
}
|
||||
@ -801,7 +802,7 @@ QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByte
|
||||
QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime, QVariant data, QString)
|
||||
{
|
||||
QList<QByteArray> ret;
|
||||
if (mime == QLatin1String("text/vcard"))
|
||||
if (mime == "text/vcard"_L1)
|
||||
ret.append(data.toString().toUtf8());
|
||||
return ret;
|
||||
}
|
||||
@ -823,26 +824,26 @@ public:
|
||||
|
||||
QString QMacPasteboardMimeTiff::convertorName()
|
||||
{
|
||||
return QLatin1String("Tiff");
|
||||
return "Tiff"_L1;
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeTiff::flavorFor(const QString &mime)
|
||||
{
|
||||
if (mime.startsWith(QLatin1String("application/x-qt-image")))
|
||||
return QLatin1String("public.tiff");
|
||||
if (mime.startsWith("application/x-qt-image"_L1))
|
||||
return "public.tiff"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeTiff::mimeFor(QString flav)
|
||||
{
|
||||
if (flav == QLatin1String("public.tiff"))
|
||||
return QLatin1String("application/x-qt-image");
|
||||
if (flav == "public.tiff"_L1)
|
||||
return "application/x-qt-image"_L1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool QMacPasteboardMimeTiff::canConvert(const QString &mime, QString flav)
|
||||
{
|
||||
return flav == QLatin1String("public.tiff") && mime == QLatin1String("application/x-qt-image");
|
||||
return flav == "public.tiff"_L1 && mime == "application/x-qt-image"_L1;
|
||||
}
|
||||
|
||||
QVariant QMacPasteboardMimeTiff::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
|
||||
|
@ -59,6 +59,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QDBusMenuAdaptor::QDBusMenuAdaptor(QDBusPlatformMenu *topLevelMenu)
|
||||
: QDBusAbstractAdaptor(topLevelMenu)
|
||||
, m_topLevelMenu(topLevelMenu)
|
||||
@ -73,12 +75,12 @@ QDBusMenuAdaptor::~QDBusMenuAdaptor()
|
||||
QString QDBusMenuAdaptor::status() const
|
||||
{
|
||||
qCDebug(qLcMenu);
|
||||
return QLatin1String("normal");
|
||||
return "normal"_L1;
|
||||
}
|
||||
|
||||
QString QDBusMenuAdaptor::textDirection() const
|
||||
{
|
||||
return QLocale().textDirection() == Qt::RightToLeft ? QLatin1String("rtl") : QLatin1String("ltr");
|
||||
return QLocale().textDirection() == Qt::RightToLeft ? "rtl"_L1 : "ltr"_L1;
|
||||
}
|
||||
|
||||
uint QDBusMenuAdaptor::version() const
|
||||
@ -117,12 +119,12 @@ void QDBusMenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(timestamp);
|
||||
QDBusPlatformMenuItem *item = QDBusPlatformMenuItem::byId(id);
|
||||
qCDebug(qLcMenu) << id << (item ? item->text() : QLatin1String("")) << eventId;
|
||||
if (item && eventId == QLatin1String("clicked"))
|
||||
qCDebug(qLcMenu) << id << (item ? item->text() : ""_L1) << eventId;
|
||||
if (item && eventId == "clicked"_L1)
|
||||
item->trigger();
|
||||
if (item && eventId == QLatin1String("hovered"))
|
||||
if (item && eventId == "hovered"_L1)
|
||||
emit item->hovered();
|
||||
if (eventId == QLatin1String("closed")) {
|
||||
if (eventId == "closed"_L1) {
|
||||
// There is no explicit AboutToHide method, so map closed event to aboutToHide method
|
||||
const QDBusPlatformMenu *menu = nullptr;
|
||||
if (item)
|
||||
|
@ -42,11 +42,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/* note: do not change these to QStringLiteral;
|
||||
we are unloaded before QtDBus is done using the strings.
|
||||
*/
|
||||
#define REGISTRAR_SERVICE QLatin1String("com.canonical.AppMenu.Registrar")
|
||||
#define REGISTRAR_PATH QLatin1String("/com/canonical/AppMenu/Registrar")
|
||||
#define REGISTRAR_SERVICE "com.canonical.AppMenu.Registrar"_L1
|
||||
#define REGISTRAR_PATH "/com/canonical/AppMenu/Registrar"_L1
|
||||
|
||||
QDBusMenuBar::QDBusMenuBar()
|
||||
: QPlatformMenuBar()
|
||||
|
@ -55,12 +55,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(qLcMenu)
|
||||
|
||||
const QString StatusNotifierWatcherService = QLatin1String("org.kde.StatusNotifierWatcher");
|
||||
const QString StatusNotifierWatcherPath = QLatin1String("/StatusNotifierWatcher");
|
||||
const QString StatusNotifierItemPath = QLatin1String("/StatusNotifierItem");
|
||||
const QString MenuBarPath = QLatin1String("/MenuBar");
|
||||
const QString StatusNotifierWatcherService = "org.kde.StatusNotifierWatcher"_L1;
|
||||
const QString StatusNotifierWatcherPath = "/StatusNotifierWatcher"_L1;
|
||||
const QString StatusNotifierItemPath = "/StatusNotifierItem"_L1;
|
||||
const QString MenuBarPath = "/MenuBar"_L1;
|
||||
|
||||
/*!
|
||||
\class QDBusMenuConnection
|
||||
@ -131,7 +133,7 @@ bool QDBusMenuConnection::registerTrayIconWithWatcher(QDBusTrayIcon *item)
|
||||
Q_UNUSED(item);
|
||||
QDBusMessage registerMethod = QDBusMessage::createMethodCall(
|
||||
StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService,
|
||||
QLatin1String("RegisterStatusNotifierItem"));
|
||||
"RegisterStatusNotifierItem"_L1);
|
||||
registerMethod.setArguments(QVariantList() << m_connection.baseService());
|
||||
return m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError)));
|
||||
}
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QT_IMPL_METATYPE_EXTERN(QDBusMenuItem)
|
||||
QT_IMPL_METATYPE_EXTERN(QDBusMenuItemList)
|
||||
QT_IMPL_METATYPE_EXTERN(QDBusMenuItemKeys)
|
||||
@ -103,7 +105,7 @@ uint QDBusMenuLayoutItem::populate(int id, int depth, const QStringList &propert
|
||||
qCDebug(qLcMenu) << id << "depth" << depth << propertyNames;
|
||||
m_id = id;
|
||||
if (id == 0) {
|
||||
m_properties.insert(QLatin1String("children-display"), QLatin1String("submenu"));
|
||||
m_properties.insert("children-display"_L1, "submenu"_L1);
|
||||
if (topLevelMenu)
|
||||
populate(topLevelMenu, depth, propertyNames);
|
||||
return 1; // revision
|
||||
@ -192,34 +194,34 @@ QDBusMenuItem::QDBusMenuItem(const QDBusPlatformMenuItem *item)
|
||||
: m_id(item->dbusID())
|
||||
{
|
||||
if (item->isSeparator()) {
|
||||
m_properties.insert(QLatin1String("type"), QLatin1String("separator"));
|
||||
m_properties.insert("type"_L1, "separator"_L1);
|
||||
} else {
|
||||
m_properties.insert(QLatin1String("label"), convertMnemonic(item->text()));
|
||||
m_properties.insert("label"_L1, convertMnemonic(item->text()));
|
||||
if (item->menu())
|
||||
m_properties.insert(QLatin1String("children-display"), QLatin1String("submenu"));
|
||||
m_properties.insert(QLatin1String("enabled"), item->isEnabled());
|
||||
m_properties.insert("children-display"_L1, "submenu"_L1);
|
||||
m_properties.insert("enabled"_L1, item->isEnabled());
|
||||
if (item->isCheckable()) {
|
||||
QString toggleType = item->hasExclusiveGroup() ? QLatin1String("radio") : QLatin1String("checkmark");
|
||||
m_properties.insert(QLatin1String("toggle-type"), toggleType);
|
||||
m_properties.insert(QLatin1String("toggle-state"), item->isChecked() ? 1 : 0);
|
||||
QString toggleType = item->hasExclusiveGroup() ? "radio"_L1 : "checkmark"_L1;
|
||||
m_properties.insert("toggle-type"_L1, toggleType);
|
||||
m_properties.insert("toggle-state"_L1, item->isChecked() ? 1 : 0);
|
||||
}
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
const QKeySequence &scut = item->shortcut();
|
||||
if (!scut.isEmpty()) {
|
||||
QDBusMenuShortcut shortcut = convertKeySequence(scut);
|
||||
m_properties.insert(QLatin1String("shortcut"), QVariant::fromValue(shortcut));
|
||||
m_properties.insert("shortcut"_L1, QVariant::fromValue(shortcut));
|
||||
}
|
||||
#endif
|
||||
const QIcon &icon = item->icon();
|
||||
if (!icon.name().isEmpty()) {
|
||||
m_properties.insert(QLatin1String("icon-name"), icon.name());
|
||||
m_properties.insert("icon-name"_L1, icon.name());
|
||||
} else if (!icon.isNull()) {
|
||||
QBuffer buf;
|
||||
icon.pixmap(16).save(&buf, "PNG");
|
||||
m_properties.insert(QLatin1String("icon-data"), buf.data());
|
||||
m_properties.insert("icon-data"_L1, buf.data());
|
||||
}
|
||||
}
|
||||
m_properties.insert(QLatin1String("visible"), item->isVisible());
|
||||
m_properties.insert("visible"_L1, item->isVisible());
|
||||
}
|
||||
|
||||
QDBusMenuItemList QDBusMenuItem::items(const QList<int> &ids, const QStringList &propertyNames)
|
||||
@ -264,9 +266,9 @@ QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence
|
||||
tokens << QStringLiteral("Num");
|
||||
|
||||
QString keyName = QKeySequencePrivate::keyName(key, QKeySequence::PortableText);
|
||||
if (keyName == QLatin1String("+"))
|
||||
if (keyName == "+"_L1)
|
||||
tokens << QStringLiteral("plus");
|
||||
else if (keyName == QLatin1String("-"))
|
||||
else if (keyName == "-"_L1)
|
||||
tokens << QStringLiteral("minus");
|
||||
else
|
||||
tokens << keyName;
|
||||
|
@ -72,6 +72,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray")
|
||||
|
||||
static QString iconTempPath()
|
||||
@ -79,8 +81,8 @@ static QString iconTempPath()
|
||||
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
|
||||
if (!tempPath.isEmpty()) {
|
||||
QString flatpakId = qEnvironmentVariable("FLATPAK_ID");
|
||||
if (!flatpakId.isEmpty() && QFileInfo::exists(QLatin1String("/.flatpak-info")))
|
||||
tempPath += QLatin1String("/app/") + flatpakId;
|
||||
if (!flatpakId.isEmpty() && QFileInfo::exists("/.flatpak-info"_L1))
|
||||
tempPath += "/app/"_L1 + flatpakId;
|
||||
return tempPath;
|
||||
}
|
||||
|
||||
@ -110,7 +112,7 @@ static int instanceCount = 0;
|
||||
|
||||
static inline QString tempFileTemplate()
|
||||
{
|
||||
static const QString TempFileTemplate = iconTempPath() + QLatin1String("/qt-trayicon-XXXXXX.png");
|
||||
static const QString TempFileTemplate = iconTempPath() + "/qt-trayicon-XXXXXX.png"_L1;
|
||||
return TempFileTemplate;
|
||||
}
|
||||
|
||||
@ -212,7 +214,7 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
|
||||
QDBusConnection session = QDBusConnection::sessionBus();
|
||||
uint pid = session.interface()->servicePid(KDEWatcherService).value();
|
||||
QString processName = QLockFilePrivate::processNameByPid(pid);
|
||||
necessary = processName.endsWith(QLatin1String("indicator-application-service"));
|
||||
necessary = processName.endsWith("indicator-application-service"_L1);
|
||||
if (!necessary) {
|
||||
necessary = session.interface()->isServiceRegistered(
|
||||
QStringLiteral("com.canonical.indicator.application"));
|
||||
@ -346,7 +348,7 @@ void QDBusTrayIcon::showMessage(const QString &title, const QString &msg, const
|
||||
int urgency = static_cast<int>(iconType) - 1;
|
||||
if (urgency < 0) // no icon
|
||||
urgency = 0;
|
||||
hints.insert(QLatin1String("urgency"), QVariant(urgency));
|
||||
hints.insert("urgency"_L1, QVariant(urgency));
|
||||
m_notifier->notify(QCoreApplication::applicationName(), 0,
|
||||
m_attentionIconName, title, msg, notificationActions, hints, msecs);
|
||||
}
|
||||
|
@ -73,6 +73,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#if QT_CONFIG(multiprocess)
|
||||
|
||||
enum { debug = 0 };
|
||||
@ -146,7 +148,7 @@ static inline bool detectWebBrowser(const QByteArray &desktop,
|
||||
return true;
|
||||
// Konqueror launcher
|
||||
if (checkExecutable(QStringLiteral("kfmclient"), browser)) {
|
||||
browser->append(QLatin1String(" exec"));
|
||||
browser->append(" exec"_L1);
|
||||
return true;
|
||||
}
|
||||
} else if (desktop == QByteArray("GNOME")) {
|
||||
@ -166,7 +168,7 @@ static inline bool launch(const QString &launcher, const QUrl &url)
|
||||
if (debug)
|
||||
qDebug("Launching %s", qPrintable(command));
|
||||
#if !QT_CONFIG(process)
|
||||
const bool ok = ::system(qPrintable(command + QLatin1String(" &")));
|
||||
const bool ok = ::system(qPrintable(command + " &"_L1));
|
||||
#else
|
||||
QStringList args = QProcess::splitCommand(command);
|
||||
bool ok = false;
|
||||
@ -183,7 +185,7 @@ static inline bool launch(const QString &launcher, const QUrl &url)
|
||||
#if QT_CONFIG(dbus)
|
||||
static inline bool checkNeedPortalSupport()
|
||||
{
|
||||
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() || qEnvironmentVariableIsSet("SNAP");
|
||||
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty() || qEnvironmentVariableIsSet("SNAP");
|
||||
}
|
||||
|
||||
static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
||||
@ -200,15 +202,15 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
||||
#ifdef O_PATH
|
||||
const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_PATH);
|
||||
if (fd != -1) {
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
|
||||
QLatin1String("/org/freedesktop/portal/desktop"),
|
||||
QLatin1String("org.freedesktop.portal.OpenURI"),
|
||||
QLatin1String("OpenFile"));
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
|
||||
"/org/freedesktop/portal/desktop"_L1,
|
||||
"org.freedesktop.portal.OpenURI"_L1,
|
||||
"OpenFile"_L1);
|
||||
|
||||
QDBusUnixFileDescriptor descriptor;
|
||||
descriptor.giveFileDescriptor(fd);
|
||||
|
||||
const QVariantMap options = {{QLatin1String("writable"), true}};
|
||||
const QVariantMap options = {{"writable"_L1, true}};
|
||||
|
||||
// FIXME parent_window_id
|
||||
message << QString() << QVariant::fromValue(descriptor) << options;
|
||||
@ -235,10 +237,10 @@ static inline QDBusMessage xdgDesktopPortalOpenUrl(const QUrl &url)
|
||||
// This key only takes effect the uri points to a local file that is exported in the document portal,
|
||||
// and the chosen application is sandboxed itself.
|
||||
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
|
||||
QLatin1String("/org/freedesktop/portal/desktop"),
|
||||
QLatin1String("org.freedesktop.portal.OpenURI"),
|
||||
QLatin1String("OpenURI"));
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
|
||||
"/org/freedesktop/portal/desktop"_L1,
|
||||
"org.freedesktop.portal.OpenURI"_L1,
|
||||
"OpenURI"_L1);
|
||||
// FIXME parent_window_id and handle writable option
|
||||
message << QString() << url.toString() << QVariantMap();
|
||||
|
||||
@ -259,14 +261,14 @@ static inline QDBusMessage xdgDesktopPortalSendEmail(const QUrl &url)
|
||||
|
||||
QUrlQuery urlQuery(url);
|
||||
QVariantMap options;
|
||||
options.insert(QLatin1String("address"), url.path());
|
||||
options.insert(QLatin1String("subject"), urlQuery.queryItemValue(QLatin1String("subject")));
|
||||
options.insert(QLatin1String("body"), urlQuery.queryItemValue(QLatin1String("body")));
|
||||
options.insert("address"_L1, url.path());
|
||||
options.insert("subject"_L1, urlQuery.queryItemValue("subject"_L1));
|
||||
options.insert("body"_L1, urlQuery.queryItemValue("body"_L1));
|
||||
|
||||
// O_PATH seems to be present since Linux 2.6.39, which is not case of RHEL 6
|
||||
#ifdef O_PATH
|
||||
QList<QDBusUnixFileDescriptor> attachments;
|
||||
const QStringList attachmentUris = urlQuery.allQueryItemValues(QLatin1String("attachment"));
|
||||
const QStringList attachmentUris = urlQuery.allQueryItemValues("attachment"_L1);
|
||||
|
||||
for (const QString &attachmentUri : attachmentUris) {
|
||||
const int fd = qt_safe_open(QFile::encodeName(attachmentUri), O_PATH);
|
||||
@ -277,13 +279,13 @@ static inline QDBusMessage xdgDesktopPortalSendEmail(const QUrl &url)
|
||||
}
|
||||
}
|
||||
|
||||
options.insert(QLatin1String("attachment_fds"), QVariant::fromValue(attachments));
|
||||
options.insert("attachment_fds"_L1, QVariant::fromValue(attachments));
|
||||
#endif
|
||||
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
|
||||
QLatin1String("/org/freedesktop/portal/desktop"),
|
||||
QLatin1String("org.freedesktop.portal.Email"),
|
||||
QLatin1String("ComposeEmail"));
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
|
||||
"/org/freedesktop/portal/desktop"_L1,
|
||||
"org.freedesktop.portal.Email"_L1,
|
||||
"ComposeEmail"_L1);
|
||||
|
||||
// FIXME parent_window_id
|
||||
message << QString() << options;
|
||||
@ -300,7 +302,7 @@ QByteArray QGenericUnixServices::desktopEnvironment() const
|
||||
|
||||
bool QGenericUnixServices::openUrl(const QUrl &url)
|
||||
{
|
||||
if (url.scheme() == QLatin1String("mailto")) {
|
||||
if (url.scheme() == "mailto"_L1) {
|
||||
#if QT_CONFIG(dbus)
|
||||
if (checkNeedPortalSupport()) {
|
||||
QDBusError error = xdgDesktopPortalSendEmail(url);
|
||||
|
@ -78,6 +78,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(qLcTray)
|
||||
|
||||
ResourceHelper::ResourceHelper()
|
||||
@ -173,7 +175,7 @@ QStringList QGenericUnixTheme::xdgIconThemePaths()
|
||||
{
|
||||
QStringList paths;
|
||||
// Add home directory first in search path
|
||||
const QFileInfo homeIconDir(QDir::homePath() + QLatin1String("/.icons"));
|
||||
const QFileInfo homeIconDir(QDir::homePath() + "/.icons"_L1);
|
||||
if (homeIconDir.isDir())
|
||||
paths.prepend(homeIconDir.absoluteFilePath());
|
||||
|
||||
@ -274,8 +276,8 @@ public:
|
||||
static QString kdeGlobals(const QString &kdeDir, int kdeVersion)
|
||||
{
|
||||
if (kdeVersion > 4)
|
||||
return kdeDir + QLatin1String("/kdeglobals");
|
||||
return kdeDir + QLatin1String("/share/config/kdeglobals");
|
||||
return kdeDir + "/kdeglobals"_L1;
|
||||
return kdeDir + "/share/config/kdeglobals"_L1;
|
||||
}
|
||||
|
||||
void refresh();
|
||||
@ -350,11 +352,11 @@ void QKdeThemePrivate::refresh()
|
||||
const QVariant toolbarStyleValue = readKdeSetting(QStringLiteral("Toolbar style/ToolButtonStyle"), kdeDirs, kdeVersion, kdeSettings);
|
||||
if (toolbarStyleValue.isValid()) {
|
||||
const QString toolBarStyle = toolbarStyleValue.toString();
|
||||
if (toolBarStyle == QLatin1String("TextBesideIcon"))
|
||||
if (toolBarStyle == "TextBesideIcon"_L1)
|
||||
toolButtonStyle = Qt::ToolButtonTextBesideIcon;
|
||||
else if (toolBarStyle == QLatin1String("TextOnly"))
|
||||
else if (toolBarStyle == "TextOnly"_L1)
|
||||
toolButtonStyle = Qt::ToolButtonTextOnly;
|
||||
else if (toolBarStyle == QLatin1String("TextUnderIcon"))
|
||||
else if (toolBarStyle == "TextUnderIcon"_L1)
|
||||
toolButtonStyle = Qt::ToolButtonTextUnderIcon;
|
||||
}
|
||||
|
||||
@ -645,22 +647,22 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
|
||||
if (!kdeDirsVar.isEmpty())
|
||||
kdeDirs += kdeDirsVar.split(u':', Qt::SkipEmptyParts);
|
||||
|
||||
const QString kdeVersionHomePath = QDir::homePath() + QLatin1String("/.kde") + QLatin1String(kdeVersionBA);
|
||||
const QString kdeVersionHomePath = QDir::homePath() + "/.kde"_L1 + QLatin1String(kdeVersionBA);
|
||||
if (QFileInfo(kdeVersionHomePath).isDir())
|
||||
kdeDirs += kdeVersionHomePath;
|
||||
|
||||
const QString kdeHomePath = QDir::homePath() + QLatin1String("/.kde");
|
||||
const QString kdeHomePath = QDir::homePath() + "/.kde"_L1;
|
||||
if (QFileInfo(kdeHomePath).isDir())
|
||||
kdeDirs += kdeHomePath;
|
||||
|
||||
const QString kdeRcPath = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA) + QLatin1String("rc");
|
||||
const QString kdeRcPath = "/etc/kde"_L1 + QLatin1String(kdeVersionBA) + "rc"_L1;
|
||||
if (QFileInfo(kdeRcPath).isReadable()) {
|
||||
QSettings kdeSettings(kdeRcPath, QSettings::IniFormat);
|
||||
kdeSettings.beginGroup(QStringLiteral("Directories-default"));
|
||||
kdeDirs += kdeSettings.value(QStringLiteral("prefixes")).toStringList();
|
||||
}
|
||||
|
||||
const QString kdeVersionPrefix = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA);
|
||||
const QString kdeVersionPrefix = "/etc/kde"_L1 + QLatin1String(kdeVersionBA);
|
||||
if (QFileInfo(kdeVersionPrefix).isDir())
|
||||
kdeDirs += kdeVersionPrefix;
|
||||
|
||||
@ -878,7 +880,7 @@ QStringList QGenericUnixTheme::themeNames()
|
||||
// unknown, but lowercase the name (our standard practice) and
|
||||
// remove any "x-" prefix
|
||||
QString s = QString::fromLatin1(desktopName.toLower());
|
||||
result.push_back(s.startsWith(QLatin1String("x-")) ? s.mid(2) : s);
|
||||
result.push_back(s.startsWith("x-"_L1) ? s.mid(2) : s);
|
||||
}
|
||||
}
|
||||
} // desktopSettingsAware
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
static QScreen *findScreenForVirtualDesktop(int virtualDesktopNumber)
|
||||
{
|
||||
const auto screens = QGuiApplication::screens();
|
||||
@ -95,7 +97,7 @@ QX11Info::QX11Info()
|
||||
*/
|
||||
bool QX11Info::isPlatformX11()
|
||||
{
|
||||
return QGuiApplication::platformName() == QLatin1String("xcb");
|
||||
return QGuiApplication::platformName() == "xcb"_L1;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -50,6 +50,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*
|
||||
Direct3D 11 backend. Provides a double-buffered flip model swapchain.
|
||||
Textures and "static" buffers are USAGE_DEFAULT, leaving it to
|
||||
@ -159,9 +161,9 @@ QRhiD3D11::QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *import
|
||||
static QString comErrorMessage(HRESULT hr)
|
||||
{
|
||||
const _com_error comError(hr);
|
||||
QString result = QLatin1String("Error 0x") + QString::number(ulong(hr), 16);
|
||||
QString result = "Error 0x"_L1 + QString::number(ulong(hr), 16);
|
||||
if (const wchar_t *msg = comError.ErrorMessage())
|
||||
result += QLatin1String(": ") + QString::fromWCharArray(msg);
|
||||
result += ": "_L1 + QString::fromWCharArray(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QCFType<CGFontRef>, QCFType_CGFontRef)
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QCFType<CFURLRef>, QCFType_CFURLRef)
|
||||
|
||||
@ -537,7 +539,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
|
||||
Q_UNUSED(style);
|
||||
|
||||
qCDebug(lcQpaFonts).nospace() << "Resolving fallbacks families for"
|
||||
<< (!family.isEmpty() ? qPrintable(QLatin1String(" family '%1' with").arg(family)) : "")
|
||||
<< (!family.isEmpty() ? qPrintable(" family '%1' with"_L1.arg(family)) : "")
|
||||
<< " style hint " << styleHint;
|
||||
|
||||
QMacAutoReleasePool pool;
|
||||
@ -653,7 +655,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
|
||||
|
||||
bool QCoreTextFontDatabase::isPrivateFontFamily(const QString &family) const
|
||||
{
|
||||
if (family.startsWith(u'.') || family == QLatin1String("LastResort"))
|
||||
if (family.startsWith(u'.') || family == "LastResort"_L1)
|
||||
return true;
|
||||
|
||||
return QPlatformFontDatabase::isPrivateFontFamily(family);
|
||||
|
@ -89,6 +89,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#define FLOOR(x) ((x) & -64)
|
||||
#define CEIL(x) (((x)+63) & -64)
|
||||
#define TRUNC(x) ((x) >> 6)
|
||||
@ -804,7 +806,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
|
||||
PS_FontInfoRec psrec;
|
||||
// don't assume that type1 fonts are symbol fonts by default
|
||||
if (FT_Get_PS_Font_Info(freetype->face, &psrec) == FT_Err_Ok) {
|
||||
symbol = !fontDef.families.isEmpty() && bool(fontDef.families.first().contains(QLatin1String("symbol"), Qt::CaseInsensitive));
|
||||
symbol = !fontDef.families.isEmpty() && bool(fontDef.families.first().contains("symbol"_L1, Qt::CaseInsensitive));
|
||||
}
|
||||
|
||||
freetype->computeSize(fontDef, &xsize, &ysize, &defaultGlyphSet.outline_drawing, &scalableBitmapScaleFactor);
|
||||
@ -867,7 +869,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
|
||||
metrics.ascender = face->size->metrics.ascender;
|
||||
metrics.descender = face->size->metrics.descender;
|
||||
if (metrics.descender > 0
|
||||
&& QString::fromUtf8(face->family_name) == QLatin1String("Courier New")) {
|
||||
&& QString::fromUtf8(face->family_name) == "Courier New"_L1) {
|
||||
metrics.descender *= -1;
|
||||
}
|
||||
metrics.height = metrics.ascender - metrics.descender + leading;
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
void QFreeTypeFontDatabase::populateFontDatabase()
|
||||
{
|
||||
QString fontpath = fontDir();
|
||||
@ -69,11 +71,11 @@ void QFreeTypeFontDatabase::populateFontDatabase()
|
||||
}
|
||||
|
||||
QStringList nameFilters;
|
||||
nameFilters << QLatin1String("*.ttf")
|
||||
<< QLatin1String("*.ttc")
|
||||
<< QLatin1String("*.pfa")
|
||||
<< QLatin1String("*.pfb")
|
||||
<< QLatin1String("*.otf");
|
||||
nameFilters << "*.ttf"_L1
|
||||
<< "*.ttc"_L1
|
||||
<< "*.pfa"_L1
|
||||
<< "*.pfb"_L1
|
||||
<< "*.otf"_L1;
|
||||
|
||||
const auto fis = dir.entryInfoList(nameFilters, QDir::Files);
|
||||
for (const QFileInfo &fi : fis) {
|
||||
|
@ -55,6 +55,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QCss::BackgroundData, QCss__BackgroundData)
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QCss::LengthData, QCss__LengthData)
|
||||
QT_IMPL_METATYPE_EXTERN_TAGGED(QCss::BorderData, QCss__BorderData)
|
||||
@ -734,7 +736,7 @@ static ColorData parseColorValue(QCss::Value v)
|
||||
return ColorData();
|
||||
|
||||
const QString &identifier = lst.at(0);
|
||||
if ((identifier.compare(QLatin1String("palette"), Qt::CaseInsensitive)) == 0) {
|
||||
if ((identifier.compare("palette"_L1, Qt::CaseInsensitive)) == 0) {
|
||||
int role = findKnownValue(lst.at(1).trimmed(), values, NumKnownValues);
|
||||
if (role >= Value_FirstColorRole && role <= Value_LastColorRole)
|
||||
return (QPalette::ColorRole)(role-Value_FirstColorRole);
|
||||
@ -742,9 +744,9 @@ static ColorData parseColorValue(QCss::Value v)
|
||||
return ColorData();
|
||||
}
|
||||
|
||||
const bool rgb = identifier.startsWith(QLatin1String("rgb"));
|
||||
const bool hsv = !rgb && identifier.startsWith(QLatin1String("hsv"));
|
||||
const bool hsl = !rgb && !hsv && identifier.startsWith(QLatin1String("hsl"));
|
||||
const bool rgb = identifier.startsWith("rgb"_L1);
|
||||
const bool hsv = !rgb && identifier.startsWith("hsv"_L1);
|
||||
const bool hsl = !rgb && !hsv && identifier.startsWith("hsl"_L1);
|
||||
|
||||
if (!rgb && !hsv && !hsl)
|
||||
return ColorData();
|
||||
@ -831,7 +833,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
|
||||
return BrushData();
|
||||
|
||||
QStringList gradFuncs;
|
||||
gradFuncs << QLatin1String("qlineargradient") << QLatin1String("qradialgradient") << QLatin1String("qconicalgradient") << QLatin1String("qgradient");
|
||||
gradFuncs << "qlineargradient"_L1 << "qradialgradient"_L1 << "qconicalgradient"_L1 << "qgradient"_L1;
|
||||
int gradType = -1;
|
||||
|
||||
if ((gradType = gradFuncs.indexOf(lst.at(0).toLower())) == -1)
|
||||
@ -842,7 +844,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
|
||||
|
||||
int spread = -1;
|
||||
QStringList spreads;
|
||||
spreads << QLatin1String("pad") << QLatin1String("reflect") << QLatin1String("repeat");
|
||||
spreads << "pad"_L1 << "reflect"_L1 << "repeat"_L1;
|
||||
|
||||
bool dependsOnThePalette = false;
|
||||
Parser parser(lst.at(1));
|
||||
@ -855,7 +857,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
|
||||
if (!parser.test(COLON))
|
||||
return BrushData();
|
||||
parser.skipSpace();
|
||||
if (attr.compare(QLatin1String("stop"), Qt::CaseInsensitive) == 0) {
|
||||
if (attr.compare("stop"_L1, Qt::CaseInsensitive) == 0) {
|
||||
QCss::Value stop, color;
|
||||
parser.next();
|
||||
if (!parser.parseTerm(&stop)) return BrushData();
|
||||
@ -870,7 +872,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
|
||||
parser.next();
|
||||
QCss::Value value;
|
||||
(void)parser.parseTerm(&value);
|
||||
if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0) {
|
||||
if (attr.compare("spread"_L1, Qt::CaseInsensitive) == 0) {
|
||||
spread = spreads.indexOf(value.variant.toString());
|
||||
} else {
|
||||
vars[attr] = value.variant.toReal();
|
||||
@ -881,8 +883,8 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
|
||||
}
|
||||
|
||||
if (gradType == 0) {
|
||||
QLinearGradient lg(vars.value(QLatin1String("x1")), vars.value(QLatin1String("y1")),
|
||||
vars.value(QLatin1String("x2")), vars.value(QLatin1String("y2")));
|
||||
QLinearGradient lg(vars.value("x1"_L1), vars.value("y1"_L1),
|
||||
vars.value("x2"_L1), vars.value("y2"_L1));
|
||||
lg.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
lg.setStops(stops);
|
||||
if (spread != -1)
|
||||
@ -894,9 +896,9 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
|
||||
}
|
||||
|
||||
if (gradType == 1) {
|
||||
QRadialGradient rg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
|
||||
vars.value(QLatin1String("radius")), vars.value(QLatin1String("fx")),
|
||||
vars.value(QLatin1String("fy")));
|
||||
QRadialGradient rg(vars.value("cx"_L1), vars.value("cy"_L1),
|
||||
vars.value("radius"_L1), vars.value("fx"_L1),
|
||||
vars.value("fy"_L1));
|
||||
rg.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
rg.setStops(stops);
|
||||
if (spread != -1)
|
||||
@ -908,8 +910,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
|
||||
}
|
||||
|
||||
if (gradType == 2) {
|
||||
QConicalGradient cg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
|
||||
vars.value(QLatin1String("angle")));
|
||||
QConicalGradient cg(vars.value("cx"_L1), vars.value("cy"_L1), vars.value("angle"_L1));
|
||||
cg.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
cg.setStops(stops);
|
||||
if (spread != -1)
|
||||
@ -1145,14 +1146,14 @@ static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAd
|
||||
|
||||
bool valid = false;
|
||||
QString s = value.variant.toString();
|
||||
if (s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)) {
|
||||
if (s.endsWith("pt"_L1, Qt::CaseInsensitive)) {
|
||||
s.chop(2);
|
||||
value.variant = s;
|
||||
if (value.variant.convert(QMetaType::fromType<qreal>())) {
|
||||
font->setPointSizeF(qBound(qreal(0), value.variant.toReal(), qreal(1 << 24) - 1));
|
||||
valid = true;
|
||||
}
|
||||
} else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
|
||||
} else if (s.endsWith("px"_L1, Qt::CaseInsensitive)) {
|
||||
s.chop(2);
|
||||
value.variant = s;
|
||||
if (value.variant.convert(QMetaType::fromType<int>())) {
|
||||
@ -1264,12 +1265,12 @@ static void setLetterSpacingFromValue(const QCss::Value &value, QFont *font)
|
||||
QString s = value.variant.toString();
|
||||
qreal val;
|
||||
bool ok = false;
|
||||
if (s.endsWith(QLatin1String("em"), Qt::CaseInsensitive)) {
|
||||
if (s.endsWith("em"_L1, Qt::CaseInsensitive)) {
|
||||
s.chop(2);
|
||||
val = s.toDouble(&ok);
|
||||
if (ok)
|
||||
font->setLetterSpacing(QFont::PercentageSpacing, (val + 1.0) * 100);
|
||||
} else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
|
||||
} else if (s.endsWith("px"_L1, Qt::CaseInsensitive)) {
|
||||
s.chop(2);
|
||||
val = s.toDouble(&ok);
|
||||
if (ok)
|
||||
@ -1280,7 +1281,7 @@ static void setLetterSpacingFromValue(const QCss::Value &value, QFont *font)
|
||||
static void setWordSpacingFromValue(const QCss::Value &value, QFont *font)
|
||||
{
|
||||
QString s = value.variant.toString();
|
||||
if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
|
||||
if (s.endsWith("px"_L1, Qt::CaseInsensitive)) {
|
||||
s.chop(2);
|
||||
qreal val;
|
||||
bool ok = false;
|
||||
@ -1650,7 +1651,7 @@ QRect Declaration::rectValue() const
|
||||
if (v.type != Value::Function)
|
||||
return QRect();
|
||||
const QStringList func = v.variant.toStringList();
|
||||
if (func.count() != 2 || func.at(0).compare(QLatin1String("rect")) != 0)
|
||||
if (func.count() != 2 || func.at(0).compare("rect"_L1) != 0)
|
||||
return QRect();
|
||||
const auto args = QStringView{func[1]}.split(u' ', Qt::SkipEmptyParts);
|
||||
if (args.count() != 4)
|
||||
@ -1835,7 +1836,7 @@ bool Declaration::borderCollapseValue() const
|
||||
if (d->values.count() != 1)
|
||||
return false;
|
||||
else
|
||||
return d->values.at(0).toString() == QLatin1String("collapse");
|
||||
return d->values.at(0).toString() == "collapse"_L1;
|
||||
}
|
||||
|
||||
QIcon Declaration::iconValue() const
|
||||
@ -1993,7 +1994,7 @@ bool StyleSelector::nodeNameEquals(NodePtr node, const QString& nodeName) const
|
||||
|
||||
QStringList StyleSelector::nodeIds(NodePtr node) const
|
||||
{
|
||||
return QStringList(attributeValue(node, QCss::AttributeSelector{QLatin1String("id"), {}, AttributeSelector::NoMatch}));
|
||||
return QStringList(attributeValue(node, QCss::AttributeSelector{"id"_L1, {}, AttributeSelector::NoMatch}));
|
||||
}
|
||||
|
||||
bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
|
||||
@ -2357,7 +2358,7 @@ void Parser::init(const QString &css, bool isFile)
|
||||
|
||||
bool Parser::parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity)
|
||||
{
|
||||
if (testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("charset"))) {
|
||||
if (testTokenAndEndsWith(ATKEYWORD_SYM, "charset"_L1)) {
|
||||
while (test(S) || test(CDO) || test(CDC)) {}
|
||||
if (!next(STRING)) return false;
|
||||
if (!next(SEMICOLON)) return false;
|
||||
@ -2621,7 +2622,7 @@ bool Parser::parseSimpleSelector(BasicSelector *basicSel)
|
||||
} else if (testClass()) {
|
||||
onceMore = true;
|
||||
AttributeSelector a;
|
||||
a.name = QLatin1String("class");
|
||||
a.name = "class"_L1;
|
||||
a.valueMatchCriterium = AttributeSelector::MatchIncludes;
|
||||
if (!parseClass(&a.value)) return false;
|
||||
basicSel->attributeSelectors.append(a);
|
||||
@ -2732,7 +2733,7 @@ bool Parser::testPrio()
|
||||
index = rewind;
|
||||
return false;
|
||||
}
|
||||
if (lexem().compare(QLatin1String("important"), Qt::CaseInsensitive) != 0) {
|
||||
if (lexem().compare("important"_L1, Qt::CaseInsensitive) != 0) {
|
||||
index = rewind;
|
||||
return false;
|
||||
}
|
||||
@ -2835,7 +2836,7 @@ bool Parser::parseTerm(Value *value)
|
||||
} else if (testFunction()) {
|
||||
QString name, args;
|
||||
if (!parseFunction(&name, &args)) return false;
|
||||
if (name == QLatin1String("url")) {
|
||||
if (name == "url"_L1) {
|
||||
value->type = Value::Uri;
|
||||
removeOptionalQuotes(&args);
|
||||
if (QFileInfo(args).isRelative() && !sourcePath.isEmpty()) {
|
||||
@ -2896,7 +2897,7 @@ bool Parser::testAndParseUri(QString *uri)
|
||||
index = rewind;
|
||||
return false;
|
||||
}
|
||||
if (name.compare(QLatin1String("url"), Qt::CaseInsensitive) != 0) {
|
||||
if (name.compare("url"_L1, Qt::CaseInsensitive) != 0) {
|
||||
index = rewind;
|
||||
return false;
|
||||
}
|
||||
|
@ -45,6 +45,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcDistanceField, "qt.distanceField");
|
||||
|
||||
namespace
|
||||
@ -796,7 +798,7 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f)
|
||||
if (!font.isValid())
|
||||
return false;
|
||||
|
||||
QList<quint32> glyphIndices = font.glyphIndexesForString(QLatin1String("O"));
|
||||
QList<quint32> glyphIndices = font.glyphIndexesForString("O"_L1);
|
||||
if (glyphIndices.isEmpty() || glyphIndices[0] == 0)
|
||||
return false;
|
||||
|
||||
|
@ -68,6 +68,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcFontDb, "qt.text.font.db")
|
||||
Q_LOGGING_CATEGORY(lcFontMatch, "qt.text.font.match")
|
||||
|
||||
@ -94,41 +96,40 @@ static int getFontWeight(const QString &weightString)
|
||||
//
|
||||
// A simple string test is the cheapest, so let's do that first.
|
||||
// Test in decreasing order of commonness
|
||||
if (s == QLatin1String("normal") || s == QLatin1String("regular"))
|
||||
if (s == "normal"_L1 || s == "regular"_L1)
|
||||
return QFont::Normal;
|
||||
if (s == QLatin1String("bold"))
|
||||
if (s == "bold"_L1)
|
||||
return QFont::Bold;
|
||||
if (s == QLatin1String("semibold") || s == QLatin1String("semi bold")
|
||||
|| s == QLatin1String("demibold") || s == QLatin1String("demi bold"))
|
||||
if (s == "semibold"_L1 || s == "semi bold"_L1 || s == "demibold"_L1 || s == "demi bold"_L1)
|
||||
return QFont::DemiBold;
|
||||
if (s == QLatin1String("medium"))
|
||||
if (s == "medium"_L1)
|
||||
return QFont::Medium;
|
||||
if (s == QLatin1String("black"))
|
||||
if (s == "black"_L1)
|
||||
return QFont::Black;
|
||||
if (s == QLatin1String("light"))
|
||||
if (s == "light"_L1)
|
||||
return QFont::Light;
|
||||
if (s == QLatin1String("thin"))
|
||||
if (s == "thin"_L1)
|
||||
return QFont::Thin;
|
||||
const QStringView s2 = QStringView{s}.mid(2);
|
||||
if (s.startsWith(QLatin1String("ex")) || s.startsWith(QLatin1String("ul"))) {
|
||||
if (s2 == QLatin1String("tralight") || s == QLatin1String("tra light"))
|
||||
if (s.startsWith("ex"_L1) || s.startsWith("ul"_L1)) {
|
||||
if (s2 == "tralight"_L1 || s == "tra light"_L1)
|
||||
return QFont::ExtraLight;
|
||||
if (s2 == QLatin1String("trabold") || s2 == QLatin1String("tra bold"))
|
||||
if (s2 == "trabold"_L1 || s2 == "tra bold"_L1)
|
||||
return QFont::ExtraBold;
|
||||
}
|
||||
|
||||
// Next up, let's see if contains() matches: slightly more expensive, but
|
||||
// still fast enough.
|
||||
if (s.contains(QLatin1String("bold"))) {
|
||||
if (s.contains(QLatin1String("demi")))
|
||||
if (s.contains("bold"_L1)) {
|
||||
if (s.contains("demi"_L1))
|
||||
return QFont::DemiBold;
|
||||
return QFont::Bold;
|
||||
}
|
||||
if (s.contains(QLatin1String("thin")))
|
||||
if (s.contains("thin"_L1))
|
||||
return QFont::Thin;
|
||||
if (s.contains(QLatin1String("light")))
|
||||
if (s.contains("light"_L1))
|
||||
return QFont::Light;
|
||||
if (s.contains(QLatin1String("black")))
|
||||
if (s.contains("black"_L1))
|
||||
return QFont::Black;
|
||||
|
||||
// Now, we perform string translations & comparisons with those.
|
||||
@ -185,9 +186,9 @@ QtFontStyle::Key::Key(const QString &styleString)
|
||||
|
||||
if (!styleString.isEmpty()) {
|
||||
// First the straightforward no-translation checks, these are fast.
|
||||
if (styleString.contains(QLatin1String("Italic")))
|
||||
if (styleString.contains("Italic"_L1))
|
||||
style = QFont::StyleItalic;
|
||||
else if (styleString.contains(QLatin1String("Oblique")))
|
||||
else if (styleString.contains("Oblique"_L1))
|
||||
style = QFont::StyleOblique;
|
||||
|
||||
// Then the translation checks. These aren't as fast.
|
||||
@ -502,7 +503,7 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe
|
||||
QString family;
|
||||
family = desc.family->name;
|
||||
if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
|
||||
family += QLatin1String(" [") + desc.foundry->name + u']';
|
||||
family += " ["_L1 + desc.foundry->name + u']';
|
||||
fontDef->families = QStringList(family);
|
||||
|
||||
if (desc.style->smoothScalable
|
||||
@ -669,7 +670,7 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
|
||||
for (int k = 0; k < foundry->count; ++k) {
|
||||
QString name = foundry->name.isEmpty()
|
||||
? f->name
|
||||
: f->name + QLatin1String(" [") + foundry->name + u']';
|
||||
: f->name + " ["_L1 + foundry->name + u']';
|
||||
if (style == foundry->styles[k]->key.style)
|
||||
preferredFallbacks.append(name);
|
||||
else
|
||||
@ -1469,7 +1470,7 @@ QStringList QFontDatabase::families(WritingSystem writingSystem)
|
||||
QString str = f->name;
|
||||
QString foundry = f->foundries[j]->name;
|
||||
if (!foundry.isEmpty()) {
|
||||
str += QLatin1String(" [");
|
||||
str += " ["_L1;
|
||||
str += foundry;
|
||||
str += u']';
|
||||
}
|
||||
@ -2179,7 +2180,7 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
|
||||
}
|
||||
|
||||
if (font.fileName.isEmpty() && !fontData.isEmpty())
|
||||
font.fileName = QLatin1String(":qmemoryfonts/") + QString::number(i);
|
||||
font.fileName = ":qmemoryfonts/"_L1 + QString::number(i);
|
||||
|
||||
auto *platformFontDatabase = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
|
||||
platformFontDatabase->addApplicationFont(font.data, font.fileName, &font);
|
||||
@ -2387,7 +2388,7 @@ QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &req,
|
||||
|
||||
#if defined(QT_BUILD_INTERNAL)
|
||||
// For testing purpose only, emulates an exact-matching monospace font
|
||||
if (qt_enable_test_font && request.families.first() == QLatin1String("__Qt__Box__Engine__")) {
|
||||
if (qt_enable_test_font && request.families.first() == "__Qt__Box__Engine__"_L1) {
|
||||
engine = new QTestFontEngine(request.pixelSize);
|
||||
engine->fontDef = request;
|
||||
return engine;
|
||||
@ -2471,7 +2472,7 @@ QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &req,
|
||||
if (!engine) {
|
||||
QtFontDesc desc;
|
||||
do {
|
||||
index = match(multi ? QChar::Script_Common : script, def, def.families.first(), QLatin1String(""), &desc, blackListed);
|
||||
index = match(multi ? QChar::Script_Common : script, def, def.families.first(), ""_L1, &desc, blackListed);
|
||||
if (index >= 0) {
|
||||
QFontDef loadDef = def;
|
||||
if (loadDef.families.isEmpty())
|
||||
|
@ -49,6 +49,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#ifndef QT_NO_PDF
|
||||
|
||||
// This map is used for symbol fonts to get the correct glyph names for the latin range
|
||||
@ -639,7 +641,7 @@ static QTtfTable generateName(const qttf_name_table &name)
|
||||
list.append(rec);
|
||||
rec.nameId = 4;
|
||||
rec.value = name.family;
|
||||
if (name.subfamily != QLatin1String("Regular"))
|
||||
if (name.subfamily != "Regular"_L1)
|
||||
rec.value += u' ' + name.subfamily;
|
||||
list.append(rec);
|
||||
rec.nameId = 6;
|
||||
@ -1244,11 +1246,11 @@ QByteArray QFontSubset::toTruetype() const
|
||||
if (name_table.data.isEmpty()) {
|
||||
qttf_name_table name;
|
||||
if (noEmbed)
|
||||
name.copyright = QLatin1String("Fake font");
|
||||
name.copyright = "Fake font"_L1;
|
||||
else
|
||||
name.copyright = QLatin1String(properties.copyright);
|
||||
name.family = fontEngine->fontDef.families.first();
|
||||
name.subfamily = QLatin1String("Regular"); // ######
|
||||
name.subfamily = "Regular"_L1; // ######
|
||||
name.postscript_name = QLatin1String(properties.postscriptName);
|
||||
name_table = generateName(name);
|
||||
}
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts")
|
||||
|
||||
void qt_registerFont(const QString &familyname, const QString &stylename,
|
||||
@ -357,7 +359,7 @@ QString QPlatformFontDatabase::fontDir() const
|
||||
{
|
||||
QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR"));
|
||||
if (fontpath.isEmpty())
|
||||
fontpath = QLibraryInfo::path(QLibraryInfo::LibrariesPath) + QLatin1String("/fonts");
|
||||
fontpath = QLibraryInfo::path(QLibraryInfo::LibrariesPath) + "/fonts"_L1;
|
||||
|
||||
return fontpath;
|
||||
}
|
||||
@ -381,7 +383,7 @@ bool QPlatformFontDatabase::isPrivateFontFamily(const QString &family) const
|
||||
|
||||
QFont QPlatformFontDatabase::defaultFont() const
|
||||
{
|
||||
return QFont(QLatin1String("Helvetica"));
|
||||
return QFont("Helvetica"_L1);
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -49,6 +49,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
QTextCopyHelper::QTextCopyHelper(const QTextCursor &_source, const QTextCursor &_destination, bool forceCharFormat, const QTextCharFormat &fmt)
|
||||
#if defined(Q_CC_DIAB) // compiler bug
|
||||
: formatCollection(*_destination.d->priv->formatCollection()), originalText((const QString)_source.d->priv->buffer())
|
||||
@ -445,14 +447,14 @@ QTextHtmlImporter::QTextHtmlImporter(QTextDocument *_doc, const QString &_html,
|
||||
wsm = QTextHtmlParserNode::WhiteSpaceNormal;
|
||||
|
||||
QString html = _html;
|
||||
const int startFragmentPos = html.indexOf(QLatin1String("<!--StartFragment-->"));
|
||||
const int startFragmentPos = html.indexOf("<!--StartFragment-->"_L1);
|
||||
if (startFragmentPos != -1) {
|
||||
const QLatin1String qt3RichTextHeader("<meta name=\"qrichtext\" content=\"1\" />");
|
||||
const auto qt3RichTextHeader = "<meta name=\"qrichtext\" content=\"1\" />"_L1;
|
||||
|
||||
// Hack for Qt3
|
||||
const bool hasQtRichtextMetaTag = html.contains(qt3RichTextHeader);
|
||||
|
||||
const int endFragmentPos = html.indexOf(QLatin1String("<!--EndFragment-->"));
|
||||
const int endFragmentPos = html.indexOf("<!--EndFragment-->"_L1);
|
||||
if (startFragmentPos < endFragmentPos)
|
||||
html = html.mid(startFragmentPos, endFragmentPos - startFragmentPos);
|
||||
else
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
// see also tst_qtextdocumentfragment.cpp
|
||||
#define MAX_ENTITY 258
|
||||
static const struct QTextHtmlEntity { const char name[9]; char16_t code; } entities[]= {
|
||||
@ -479,7 +481,7 @@ int QTextHtmlParser::lookupElement(const QString &element)
|
||||
static QString quoteNewline(const QString &s)
|
||||
{
|
||||
QString n = s;
|
||||
n.replace(u'\n', QLatin1String("\\n"));
|
||||
n.replace(u'\n', "\\n"_L1);
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -787,7 +789,7 @@ void QTextHtmlParser::parseExclamationTag()
|
||||
if (hasPrefix(u'-') && hasPrefix(u'-', 1)) {
|
||||
pos += 2;
|
||||
// eat comments
|
||||
int end = txt.indexOf(QLatin1String("-->"), pos);
|
||||
int end = txt.indexOf("-->"_L1, pos);
|
||||
pos = (end >= 0 ? end + 3 : len);
|
||||
} else {
|
||||
// eat internal tags
|
||||
@ -849,7 +851,7 @@ QString QTextHtmlParser::parseEntity()
|
||||
}
|
||||
error:
|
||||
pos = recover;
|
||||
return QLatin1String("&");
|
||||
return "&"_L1;
|
||||
}
|
||||
|
||||
// parses one word, possibly quoted, and returns it
|
||||
@ -916,13 +918,13 @@ QTextHtmlParserNode *QTextHtmlParser::resolveParent()
|
||||
QTextHtmlParserNode *table = nodes[nodes.count() - 3];
|
||||
table->parent = p;
|
||||
table->id = Html_table;
|
||||
table->tag = QLatin1String("table");
|
||||
table->tag = "table"_L1;
|
||||
table->children.append(nodes.count() - 2); // add row as child
|
||||
|
||||
QTextHtmlParserNode *row = nodes[nodes.count() - 2];
|
||||
row->parent = nodes.count() - 3; // table as parent
|
||||
row->id = Html_tr;
|
||||
row->tag = QLatin1String("tr");
|
||||
row->tag = "tr"_L1;
|
||||
|
||||
p = nodes.count() - 2;
|
||||
node = nodes.last(); // re-initialize pointer
|
||||
@ -939,7 +941,7 @@ QTextHtmlParserNode *QTextHtmlParser::resolveParent()
|
||||
QTextHtmlParserNode *table = nodes[nodes.count() - 2];
|
||||
table->parent = p;
|
||||
table->id = Html_table;
|
||||
table->tag = QLatin1String("table");
|
||||
table->tag = "table"_L1;
|
||||
p = nodes.count() - 2;
|
||||
node = nodes.last(); // re-initialize pointer
|
||||
}
|
||||
@ -1065,7 +1067,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
|
||||
case Html_a:
|
||||
for (int i = 0; i < attributes.count(); i += 2) {
|
||||
const QString key = attributes.at(i);
|
||||
if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
|
||||
if (key.compare("href"_L1, Qt::CaseInsensitive) == 0
|
||||
&& !attributes.at(i + 1).isEmpty()) {
|
||||
hasHref = true;
|
||||
}
|
||||
@ -1272,13 +1274,13 @@ void QTextHtmlParserNode::applyCssDeclarations(const QList<QCss::Declaration> &d
|
||||
case QCss::QtLineHeightType: {
|
||||
QString lineHeightTypeName = decl.d->values.first().variant.toString();
|
||||
QTextBlockFormat::LineHeightTypes lineHeightType;
|
||||
if (lineHeightTypeName.compare(QLatin1String("proportional"), Qt::CaseInsensitive) == 0)
|
||||
if (lineHeightTypeName.compare("proportional"_L1, Qt::CaseInsensitive) == 0)
|
||||
lineHeightType = QTextBlockFormat::ProportionalHeight;
|
||||
else if (lineHeightTypeName.compare(QLatin1String("fixed"), Qt::CaseInsensitive) == 0)
|
||||
else if (lineHeightTypeName.compare("fixed"_L1, Qt::CaseInsensitive) == 0)
|
||||
lineHeightType = QTextBlockFormat::FixedHeight;
|
||||
else if (lineHeightTypeName.compare(QLatin1String("minimum"), Qt::CaseInsensitive) == 0)
|
||||
else if (lineHeightTypeName.compare("minimum"_L1, Qt::CaseInsensitive) == 0)
|
||||
lineHeightType = QTextBlockFormat::MinimumHeight;
|
||||
else if (lineHeightTypeName.compare(QLatin1String("line-distance"), Qt::CaseInsensitive) == 0)
|
||||
else if (lineHeightTypeName.compare("line-distance"_L1, Qt::CaseInsensitive) == 0)
|
||||
lineHeightType = QTextBlockFormat::LineDistanceHeight;
|
||||
else
|
||||
lineHeightType = QTextBlockFormat::SingleHeight;
|
||||
@ -1331,13 +1333,13 @@ void QTextHtmlParserNode::applyCssDeclarations(const QList<QCss::Declaration> &d
|
||||
hasCssListIndent = true;
|
||||
break;
|
||||
case QCss::QtParagraphType:
|
||||
if (decl.d->values.first().variant.toString().compare(QLatin1String("empty"), Qt::CaseInsensitive) == 0)
|
||||
if (decl.d->values.first().variant.toString().compare("empty"_L1, Qt::CaseInsensitive) == 0)
|
||||
isEmptyParagraph = true;
|
||||
break;
|
||||
case QCss::QtTableType:
|
||||
if (decl.d->values.first().variant.toString().compare(QLatin1String("frame"), Qt::CaseInsensitive) == 0)
|
||||
if (decl.d->values.first().variant.toString().compare("frame"_L1, Qt::CaseInsensitive) == 0)
|
||||
isTextFrame = true;
|
||||
else if (decl.d->values.first().variant.toString().compare(QLatin1String("root"), Qt::CaseInsensitive) == 0) {
|
||||
else if (decl.d->values.first().variant.toString().compare("root"_L1, Qt::CaseInsensitive) == 0) {
|
||||
isTextFrame = true;
|
||||
isRootFrame = true;
|
||||
}
|
||||
@ -1567,7 +1569,7 @@ static void setWidthAttribute(QTextLength *width, const QString &valueStr)
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
void QTextHtmlParserNode::parseStyleAttribute(const QString &value, const QTextDocument *resourceProvider)
|
||||
{
|
||||
const QString css = QLatin1String("* {") + value + u'}';
|
||||
const QString css = "* {"_L1 + value + u'}';
|
||||
QCss::Parser parser(css);
|
||||
QCss::StyleSheet sheet;
|
||||
parser.parse(&sheet, Qt::CaseInsensitive);
|
||||
@ -1585,7 +1587,7 @@ QStringList QTextHtmlParser::parseAttributes()
|
||||
if (hasPrefix(u'>') || hasPrefix(u'/'))
|
||||
break;
|
||||
QString key = parseWord().toLower();
|
||||
QString value = QLatin1String("1");
|
||||
QString value = "1"_L1;
|
||||
if (key.size() == 0)
|
||||
break;
|
||||
eatSpace();
|
||||
@ -1621,12 +1623,12 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
switch (node->id) {
|
||||
case Html_font:
|
||||
// the infamous font tag
|
||||
if (key == QLatin1String("size") && value.size()) {
|
||||
if (key == "size"_L1 && value.size()) {
|
||||
int n = value.toInt();
|
||||
if (value.at(0) != u'+' && value.at(0) != u'-')
|
||||
n -= 3;
|
||||
node->charFormat.setProperty(QTextFormat::FontSizeAdjustment, n);
|
||||
} else if (key == QLatin1String("face")) {
|
||||
} else if (key == "face"_L1) {
|
||||
if (value.contains(u',')) {
|
||||
const QStringList values = value.split(u',');
|
||||
QStringList families;
|
||||
@ -1636,7 +1638,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
} else {
|
||||
node->charFormat.setFontFamilies(QStringList(value));
|
||||
}
|
||||
} else if (key == QLatin1String("color")) {
|
||||
} else if (key == "color"_L1) {
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
@ -1645,153 +1647,147 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
break;
|
||||
case Html_ol:
|
||||
case Html_ul:
|
||||
if (key == QLatin1String("type")) {
|
||||
if (key == "type"_L1) {
|
||||
node->hasOwnListStyle = true;
|
||||
if (value == QLatin1String("1")) {
|
||||
if (value == "1"_L1) {
|
||||
node->listStyle = QTextListFormat::ListDecimal;
|
||||
} else if (value == QLatin1String("a")) {
|
||||
} else if (value == "a"_L1) {
|
||||
node->listStyle = QTextListFormat::ListLowerAlpha;
|
||||
} else if (value == QLatin1String("A")) {
|
||||
} else if (value == "A"_L1) {
|
||||
node->listStyle = QTextListFormat::ListUpperAlpha;
|
||||
} else if (value == QLatin1String("i")) {
|
||||
} else if (value == "i"_L1) {
|
||||
node->listStyle = QTextListFormat::ListLowerRoman;
|
||||
} else if (value == QLatin1String("I")) {
|
||||
} else if (value == "I"_L1) {
|
||||
node->listStyle = QTextListFormat::ListUpperRoman;
|
||||
} else {
|
||||
value = std::move(value).toLower();
|
||||
if (value == QLatin1String("square"))
|
||||
if (value == "square"_L1)
|
||||
node->listStyle = QTextListFormat::ListSquare;
|
||||
else if (value == QLatin1String("disc"))
|
||||
else if (value == "disc"_L1)
|
||||
node->listStyle = QTextListFormat::ListDisc;
|
||||
else if (value == QLatin1String("circle"))
|
||||
else if (value == "circle"_L1)
|
||||
node->listStyle = QTextListFormat::ListCircle;
|
||||
else if (value == QLatin1String("none"))
|
||||
else if (value == "none"_L1)
|
||||
node->listStyle = QTextListFormat::ListStyleUndefined;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Html_a:
|
||||
if (key == QLatin1String("href"))
|
||||
if (key == "href"_L1)
|
||||
node->charFormat.setAnchorHref(value);
|
||||
else if (key == QLatin1String("name"))
|
||||
else if (key == "name"_L1)
|
||||
node->charFormat.setAnchorNames({value});
|
||||
break;
|
||||
case Html_img:
|
||||
if (key == QLatin1String("src") || key == QLatin1String("source")) {
|
||||
if (key == "src"_L1 || key == "source"_L1) {
|
||||
node->imageName = value;
|
||||
} else if (key == QLatin1String("width")) {
|
||||
} else if (key == "width"_L1) {
|
||||
node->imageWidth = -2; // register that there is a value for it.
|
||||
setFloatAttribute(&node->imageWidth, value);
|
||||
} else if (key == QLatin1String("height")) {
|
||||
} else if (key == "height"_L1) {
|
||||
node->imageHeight = -2; // register that there is a value for it.
|
||||
setFloatAttribute(&node->imageHeight, value);
|
||||
} else if (key == QLatin1String("alt")) {
|
||||
} else if (key == "alt"_L1) {
|
||||
node->imageAlt = value;
|
||||
} else if (key == QLatin1String("title")) {
|
||||
} else if (key == "title"_L1) {
|
||||
node->text = value;
|
||||
}
|
||||
break;
|
||||
case Html_tr:
|
||||
case Html_body:
|
||||
if (key == QLatin1String("bgcolor")) {
|
||||
if (key == "bgcolor"_L1) {
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->charFormat.setBackground(c);
|
||||
} else if (key == QLatin1String("background")) {
|
||||
} else if (key == "background"_L1) {
|
||||
node->applyBackgroundImage(value, resourceProvider);
|
||||
}
|
||||
break;
|
||||
case Html_th:
|
||||
case Html_td:
|
||||
if (key == QLatin1String("width")) {
|
||||
if (key == "width"_L1) {
|
||||
setWidthAttribute(&node->width, value);
|
||||
} else if (key == QLatin1String("bgcolor")) {
|
||||
} else if (key == "bgcolor"_L1) {
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->charFormat.setBackground(c);
|
||||
} else if (key == QLatin1String("background")) {
|
||||
} else if (key == "background"_L1) {
|
||||
node->applyBackgroundImage(value, resourceProvider);
|
||||
} else if (key == QLatin1String("rowspan")) {
|
||||
} else if (key == "rowspan"_L1) {
|
||||
if (setIntAttribute(&node->tableCellRowSpan, value))
|
||||
node->tableCellRowSpan = qMax(1, node->tableCellRowSpan);
|
||||
} else if (key == QLatin1String("colspan")) {
|
||||
} else if (key == "colspan"_L1) {
|
||||
if (setIntAttribute(&node->tableCellColSpan, value))
|
||||
node->tableCellColSpan = qBound(1, node->tableCellColSpan, 20480);
|
||||
}
|
||||
break;
|
||||
case Html_table:
|
||||
if (key == QLatin1String("border")) {
|
||||
if (key == "border"_L1) {
|
||||
setFloatAttribute(&node->tableBorder, value);
|
||||
} else if (key == QLatin1String("bgcolor")) {
|
||||
} else if (key == "bgcolor"_L1) {
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->charFormat.setBackground(c);
|
||||
} else if (key == QLatin1String("bordercolor")) {
|
||||
} else if (key == "bordercolor"_L1) {
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->borderBrush = c;
|
||||
} else if (key == QLatin1String("background")) {
|
||||
} else if (key == "background"_L1) {
|
||||
node->applyBackgroundImage(value, resourceProvider);
|
||||
} else if (key == QLatin1String("cellspacing")) {
|
||||
} else if (key == "cellspacing"_L1) {
|
||||
setFloatAttribute(&node->tableCellSpacing, value);
|
||||
} else if (key == QLatin1String("cellpadding")) {
|
||||
} else if (key == "cellpadding"_L1) {
|
||||
setFloatAttribute(&node->tableCellPadding, value);
|
||||
} else if (key == QLatin1String("width")) {
|
||||
} else if (key == "width"_L1) {
|
||||
setWidthAttribute(&node->width, value);
|
||||
} else if (key == QLatin1String("height")) {
|
||||
} else if (key == "height"_L1) {
|
||||
setWidthAttribute(&node->height, value);
|
||||
}
|
||||
break;
|
||||
case Html_meta:
|
||||
if (key == QLatin1String("name")
|
||||
&& value == QLatin1String("qrichtext")) {
|
||||
if (key == "name"_L1 && value == "qrichtext"_L1)
|
||||
seenQt3Richtext = true;
|
||||
}
|
||||
|
||||
if (key == QLatin1String("content")
|
||||
&& value == QLatin1String("1")
|
||||
&& seenQt3Richtext) {
|
||||
|
||||
if (key == "content"_L1 && value == "1"_L1 && seenQt3Richtext)
|
||||
textEditMode = true;
|
||||
}
|
||||
break;
|
||||
case Html_hr:
|
||||
if (key == QLatin1String("width"))
|
||||
if (key == "width"_L1)
|
||||
setWidthAttribute(&node->width, value);
|
||||
break;
|
||||
case Html_link:
|
||||
if (key == QLatin1String("href"))
|
||||
if (key == "href"_L1)
|
||||
linkHref = value;
|
||||
else if (key == QLatin1String("type"))
|
||||
else if (key == "type"_L1)
|
||||
linkType = value;
|
||||
break;
|
||||
case Html_pre:
|
||||
if (key == QLatin1String("class") && value.startsWith(QLatin1String("language-")))
|
||||
if (key == "class"_L1 && value.startsWith("language-"_L1))
|
||||
node->blockFormat.setProperty(QTextFormat::BlockCodeLanguage, value.mid(9));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (key == QLatin1String("style")) {
|
||||
if (key == "style"_L1) {
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
node->parseStyleAttribute(value, resourceProvider);
|
||||
#endif
|
||||
} else if (key == QLatin1String("align")) {
|
||||
} else if (key == "align"_L1) {
|
||||
value = std::move(value).toLower();
|
||||
bool alignmentSet = true;
|
||||
|
||||
if (value == QLatin1String("left"))
|
||||
if (value == "left"_L1)
|
||||
node->blockFormat.setAlignment(Qt::AlignLeft|Qt::AlignAbsolute);
|
||||
else if (value == QLatin1String("right"))
|
||||
else if (value == "right"_L1)
|
||||
node->blockFormat.setAlignment(Qt::AlignRight|Qt::AlignAbsolute);
|
||||
else if (value == QLatin1String("center"))
|
||||
else if (value == "center"_L1)
|
||||
node->blockFormat.setAlignment(Qt::AlignHCenter);
|
||||
else if (value == QLatin1String("justify"))
|
||||
else if (value == "justify"_L1)
|
||||
node->blockFormat.setAlignment(Qt::AlignJustify);
|
||||
else
|
||||
alignmentSet = false;
|
||||
@ -1803,36 +1799,36 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
node->cssFloat = QTextFrameFormat::FloatLeft;
|
||||
else if (node->blockFormat.alignment() & Qt::AlignRight)
|
||||
node->cssFloat = QTextFrameFormat::FloatRight;
|
||||
} else if (value == QLatin1String("middle")) {
|
||||
} else if (value == "middle"_L1) {
|
||||
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle);
|
||||
} else if (value == QLatin1String("top")) {
|
||||
} else if (value == "top"_L1) {
|
||||
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignTop);
|
||||
}
|
||||
}
|
||||
} else if (key == QLatin1String("valign")) {
|
||||
} else if (key == "valign"_L1) {
|
||||
value = std::move(value).toLower();
|
||||
if (value == QLatin1String("top"))
|
||||
if (value == "top"_L1)
|
||||
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignTop);
|
||||
else if (value == QLatin1String("middle"))
|
||||
else if (value == "middle"_L1)
|
||||
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle);
|
||||
else if (value == QLatin1String("bottom"))
|
||||
else if (value == "bottom"_L1)
|
||||
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignBottom);
|
||||
} else if (key == QLatin1String("dir")) {
|
||||
} else if (key == "dir"_L1) {
|
||||
value = std::move(value).toLower();
|
||||
if (value == QLatin1String("ltr"))
|
||||
if (value == "ltr"_L1)
|
||||
node->blockFormat.setLayoutDirection(Qt::LeftToRight);
|
||||
else if (value == QLatin1String("rtl"))
|
||||
else if (value == "rtl"_L1)
|
||||
node->blockFormat.setLayoutDirection(Qt::RightToLeft);
|
||||
} else if (key == QLatin1String("title")) {
|
||||
} else if (key == "title"_L1) {
|
||||
node->charFormat.setToolTip(value);
|
||||
} else if (key == QLatin1String("id")) {
|
||||
} else if (key == "id"_L1) {
|
||||
node->charFormat.setAnchor(true);
|
||||
node->charFormat.setAnchorNames({value});
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
if (resourceProvider && !linkHref.isEmpty() && linkType == QLatin1String("text/css"))
|
||||
if (resourceProvider && !linkHref.isEmpty() && linkType == "text/css"_L1)
|
||||
importStyleSheet(linkHref);
|
||||
#endif
|
||||
}
|
||||
@ -1934,8 +1930,7 @@ void QTextHtmlParser::resolveStyleSheetImports(const QCss::StyleSheet &sheet)
|
||||
{
|
||||
for (int i = 0; i < sheet.importRules.count(); ++i) {
|
||||
const QCss::ImportRule &rule = sheet.importRules.at(i);
|
||||
if (rule.media.isEmpty()
|
||||
|| rule.media.contains(QLatin1String("screen"), Qt::CaseInsensitive))
|
||||
if (rule.media.isEmpty() || rule.media.contains("screen"_L1, Qt::CaseInsensitive))
|
||||
importStyleSheet(rule.href);
|
||||
}
|
||||
}
|
||||
@ -1977,13 +1972,13 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
if (node.id == Html_a) {
|
||||
for (int i = 0; i < node.attributes.count(); i += 2) {
|
||||
const QString key = node.attributes.at(i);
|
||||
if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
|
||||
if (key.compare("href"_L1, Qt::CaseInsensitive) == 0
|
||||
&& !node.attributes.at(i + 1).isEmpty()) {
|
||||
needsUnderline = true;
|
||||
decl.d->property = QLatin1String("color");
|
||||
decl.d->property = "color"_L1;
|
||||
decl.d->propertyId = QCss::Color;
|
||||
val.type = QCss::Value::Function;
|
||||
val.variant = QStringList() << QLatin1String("palette") << QLatin1String("link");
|
||||
val.variant = QStringList() << "palette"_L1 << "link"_L1;
|
||||
decl.d->values = QList<QCss::Value> { val };
|
||||
decl.d->inheritable = true;
|
||||
decls << decl;
|
||||
@ -1993,7 +1988,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
}
|
||||
if (needsUnderline) {
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("text-decoration");
|
||||
decl.d->property = "text-decoration"_L1;
|
||||
decl.d->propertyId = QCss::TextDecoration;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
val.variant = QVariant(QCss::Value_Underline);
|
||||
@ -2012,7 +2007,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_h5:
|
||||
case Html_th:
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("font-weight");
|
||||
decl.d->property = "font-weight"_L1;
|
||||
decl.d->propertyId = QCss::FontWeight;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
val.variant = QVariant(QCss::Value_Bold);
|
||||
@ -2026,7 +2021,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_small:
|
||||
if (node.id != Html_th) {
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("font-size");
|
||||
decl.d->property = "font-size"_L1;
|
||||
decl.d->propertyId = QCss::FontSize;
|
||||
decl.d->inheritable = false;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
@ -2046,7 +2041,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_center:
|
||||
case Html_td:
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("text-align");
|
||||
decl.d->property = "text-align"_L1;
|
||||
decl.d->propertyId = QCss::TextAlignment;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
val.variant = (node.id == Html_td) ? QVariant(QCss::Value_Left) : QVariant(QCss::Value_Center);
|
||||
@ -2056,7 +2051,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
break;
|
||||
case Html_s:
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("text-decoration");
|
||||
decl.d->property = "text-decoration"_L1;
|
||||
decl.d->propertyId = QCss::TextDecoration;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
val.variant = QVariant(QCss::Value_LineThrough);
|
||||
@ -2071,7 +2066,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_var:
|
||||
case Html_dfn:
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("font-style");
|
||||
decl.d->property = "font-style"_L1;
|
||||
decl.d->propertyId = QCss::FontStyle;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
val.variant = QVariant(QCss::Value_Italic);
|
||||
@ -2082,7 +2077,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_sub:
|
||||
case Html_sup:
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("vertical-align");
|
||||
decl.d->property = "vertical-align"_L1;
|
||||
decl.d->propertyId = QCss::VerticalAlignment;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
val.variant = (node.id == Html_sub) ? QVariant(QCss::Value_Sub) : QVariant(QCss::Value_Super);
|
||||
@ -2093,7 +2088,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_ul:
|
||||
case Html_ol:
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("list-style");
|
||||
decl.d->property = "list-style"_L1;
|
||||
decl.d->propertyId = QCss::ListStyle;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
val.variant = (node.id == Html_ul) ? QVariant(QCss::Value_Disc) : QVariant(QCss::Value_Decimal);
|
||||
@ -2107,7 +2102,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_samp:
|
||||
case Html_pre: {
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("font-family");
|
||||
decl.d->property = "font-family"_L1;
|
||||
decl.d->propertyId = QCss::FontFamily;
|
||||
QList<QCss::Value> values;
|
||||
val.type = QCss::Value::String;
|
||||
@ -2123,7 +2118,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
|
||||
case Html_br:
|
||||
case Html_nobr:
|
||||
decl = QCss::Declaration();
|
||||
decl.d->property = QLatin1String("whitespace");
|
||||
decl.d->property = "whitespace"_L1;
|
||||
decl.d->propertyId = QCss::Whitespace;
|
||||
val.type = QCss::Value::KnownIdentifier;
|
||||
switch (node.id) {
|
||||
@ -2161,7 +2156,7 @@ QList<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
|
||||
for (int i = 0; i < inlineStyleSheets.count(); ++i, ++idx)
|
||||
selector.styleSheets[idx] = inlineStyleSheets.at(i);
|
||||
|
||||
selector.medium = resourceProvider ? resourceProvider->metaInformation(QTextDocument::CssMedia) : QLatin1String("screen");
|
||||
selector.medium = resourceProvider ? resourceProvider->metaInformation(QTextDocument::CssMedia) : "screen"_L1;
|
||||
|
||||
QCss::StyleSelector::NodePtr n;
|
||||
n.id = node;
|
||||
|
@ -51,13 +51,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
extern QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
|
||||
qreal *sourceDevicePixelRatio);
|
||||
|
||||
static inline QUrl fromLocalfileOrResources(QString path)
|
||||
{
|
||||
if (path.startsWith(QLatin1String(":/"))) // auto-detect resources and convert them to url
|
||||
path.prepend(QLatin1String("qrc"));
|
||||
if (path.startsWith(":/"_L1)) // auto-detect resources and convert them to url
|
||||
path.prepend("qrc"_L1);
|
||||
return QUrl(path);
|
||||
}
|
||||
|
||||
@ -78,13 +80,13 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con
|
||||
if (pm.isNull()) {
|
||||
QImage img;
|
||||
if (name.isEmpty() || !img.load(name))
|
||||
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
|
||||
return QPixmap(":/qt-project.org/styles/commonstyle/images/file-16.png"_L1);
|
||||
|
||||
pm = QPixmap::fromImage(img);
|
||||
doc->addResource(QTextDocument::ImageResource, url, pm);
|
||||
}
|
||||
|
||||
if (name.contains(QLatin1String("@2x")))
|
||||
if (name.contains("@2x"_L1))
|
||||
pm.setDevicePixelRatio(sourcePixelRatio);
|
||||
|
||||
return pm;
|
||||
@ -147,7 +149,7 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const
|
||||
|
||||
if (image.isNull()) {
|
||||
if (name.isEmpty() || !image.load(name))
|
||||
return QImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
|
||||
return QImage(":/qt-project.org/styles/commonstyle/images/file-16.png"_L1);
|
||||
|
||||
doc->addResource(QTextDocument::ImageResource, url, image);
|
||||
}
|
||||
|
@ -46,6 +46,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
class QTextListPrivate : public QTextBlockGroupPrivate
|
||||
{
|
||||
public:
|
||||
@ -179,7 +181,7 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
|
||||
|
||||
const int style = format().style();
|
||||
QString numberPrefix;
|
||||
QString numberSuffix = QLatin1String(".");
|
||||
QString numberSuffix = "."_L1;
|
||||
|
||||
if (format().hasProperty(QTextFormat::ListNumberPrefix))
|
||||
numberPrefix = format().numberPrefix();
|
||||
@ -248,7 +250,7 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
|
||||
result = QString::fromLatin1(romanNumeral);
|
||||
}
|
||||
else {
|
||||
result = QLatin1String("?");
|
||||
result = "?"_L1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcMD, "qt.text.markdown")
|
||||
|
||||
static const QChar Newline = u'\n';
|
||||
@ -559,12 +561,12 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size)
|
||||
QTextBlockFormat bfmt = m_cursor->blockFormat();
|
||||
QString debugInfo;
|
||||
if (m_cursor->currentList())
|
||||
debugInfo = QLatin1String("in list at depth ") + QString::number(m_cursor->currentList()->format().indent());
|
||||
debugInfo = "in list at depth "_L1 + QString::number(m_cursor->currentList()->format().indent());
|
||||
if (bfmt.hasProperty(QTextFormat::BlockQuoteLevel))
|
||||
debugInfo += QLatin1String("in blockquote at depth ") +
|
||||
debugInfo += "in blockquote at depth "_L1 +
|
||||
QString::number(bfmt.intProperty(QTextFormat::BlockQuoteLevel));
|
||||
if (bfmt.hasProperty(QTextFormat::BlockCodeLanguage))
|
||||
debugInfo += QLatin1String("in a code block");
|
||||
debugInfo += "in a code block"_L1;
|
||||
qCDebug(lcMD) << textType << "in block" << m_blockType << s << qPrintable(debugInfo)
|
||||
<< "bindent" << bfmt.indent() << "tindent" << bfmt.textIndent()
|
||||
<< "margins" << bfmt.leftMargin() << bfmt.topMargin() << bfmt.bottomMargin() << bfmt.rightMargin();
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_LOGGING_CATEGORY(lcMDW, "qt.text.markdown.writer")
|
||||
|
||||
static const QChar Space = u' ';
|
||||
@ -442,7 +444,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
if (!m_fencedCodeBlock) {
|
||||
QString fenceChar = blockFmt.stringProperty(QTextFormat::BlockCodeFence);
|
||||
if (fenceChar.isEmpty())
|
||||
fenceChar = QLatin1String("`");
|
||||
fenceChar = "`"_L1;
|
||||
m_codeBlockFence = QString(3, fenceChar.at(0));
|
||||
if (blockFmt.hasProperty(QTextFormat::BlockIndent))
|
||||
m_codeBlockFence = QString(m_wrappedLineIndent, Space) + m_codeBlockFence;
|
||||
@ -504,8 +506,8 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
QTextImageFormat ifmt = fmt.toImageFormat();
|
||||
QString desc = ifmt.stringProperty(QTextFormat::ImageAltText);
|
||||
if (desc.isEmpty())
|
||||
desc = QLatin1String("image");
|
||||
QString s = QLatin1String(" + ifmt.name();
|
||||
desc = "image"_L1;
|
||||
QString s = ";
|
||||
QString title = ifmt.stringProperty(QTextFormat::ImageTitle);
|
||||
if (!title.isEmpty())
|
||||
s += Space + DoubleQuote + title + DoubleQuote;
|
||||
@ -517,7 +519,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
m_stream << s;
|
||||
col += s.length();
|
||||
} else if (fmt.hasProperty(QTextFormat::AnchorHref)) {
|
||||
QString s = u'[' + fragmentText + QLatin1String("](") +
|
||||
QString s = u'[' + fragmentText + "]("_L1 +
|
||||
fmt.property(QTextFormat::AnchorHref).toString();
|
||||
if (fmt.hasProperty(QTextFormat::TextToolTip)) {
|
||||
s += Space;
|
||||
@ -545,7 +547,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
}
|
||||
if (!blockFmt.headingLevel() && !mono) {
|
||||
if (fontInfo.bold() != bold) {
|
||||
markers += QLatin1String("**");
|
||||
markers += "**"_L1;
|
||||
bold = fontInfo.bold();
|
||||
}
|
||||
if (fontInfo.italic() != italic) {
|
||||
@ -553,7 +555,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
italic = fontInfo.italic();
|
||||
}
|
||||
if (fontInfo.strikeOut() != strikeOut) {
|
||||
markers += QLatin1String("~~");
|
||||
markers += "~~"_L1;
|
||||
strikeOut = fontInfo.strikeOut();
|
||||
}
|
||||
if (fontInfo.underline() != underline) {
|
||||
|
@ -60,11 +60,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/// Convert pixels to postscript point units
|
||||
static QString pixelToPoint(qreal pixels)
|
||||
{
|
||||
// we hardcode 96 DPI, we do the same in the ODF importer to have a perfect roundtrip.
|
||||
return QString::number(pixels * 72 / 96) + QLatin1String("pt");
|
||||
return QString::number(pixels * 72 / 96) + "pt"_L1;
|
||||
}
|
||||
|
||||
// strategies
|
||||
@ -454,8 +456,8 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
|
||||
|
||||
QImage image;
|
||||
QString name = imageFormat.name();
|
||||
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
|
||||
name.prepend(QLatin1String("qrc"));
|
||||
if (name.startsWith(":/"_L1)) // auto-detect resources
|
||||
name.prepend("qrc"_L1);
|
||||
QUrl url = QUrl(name);
|
||||
const QVariant variant = m_document->resource(QTextDocument::ImageResource, url);
|
||||
if (variant.userType() == QMetaType::QPixmap || variant.userType() == QMetaType::QImage) {
|
||||
@ -867,7 +869,7 @@ void QTextOdfWriter::writeTableFormat(QXmlStreamWriter &writer, QTextTableFormat
|
||||
writer.writeAttribute(tableNS, QString::fromLatin1("align"), QString::fromLatin1(align));
|
||||
if (format.width().rawValue()) {
|
||||
writer.writeAttribute(styleNS, QString::fromLatin1("width"),
|
||||
QString::number(format.width().rawValue()) + QLatin1String("pt"));
|
||||
QString::number(format.width().rawValue()) + "pt"_L1);
|
||||
}
|
||||
writer.writeEndElement();
|
||||
// start writing table-column style element
|
||||
@ -883,14 +885,14 @@ void QTextOdfWriter::writeTableFormat(QXmlStreamWriter &writer, QTextTableFormat
|
||||
QString columnWidth;
|
||||
if (format.columnWidthConstraints().at(colit).type() == QTextLength::PercentageLength) {
|
||||
columnWidth = QString::number(format.columnWidthConstraints().at(colit).rawValue())
|
||||
+ QLatin1String("%");
|
||||
+ "%"_L1;
|
||||
} else if (format.columnWidthConstraints().at(colit).type() == QTextLength::FixedLength) {
|
||||
columnWidth = QString::number(format.columnWidthConstraints().at(colit).rawValue())
|
||||
+ QLatin1String("pt");
|
||||
+ "pt"_L1;
|
||||
} else {
|
||||
//!! HARD-CODING variableWidth Constraints to 100% / nr constraints
|
||||
columnWidth = QString::number(100 / format.columnWidthConstraints().size())
|
||||
+ QLatin1String("%");
|
||||
+ "%"_L1;
|
||||
}
|
||||
writer.writeAttribute(styleNS, QString::fromLatin1("column-width"), columnWidth);
|
||||
writer.writeEndElement();
|
||||
@ -932,8 +934,8 @@ void QTextOdfWriter::tableCellStyleElement(QXmlStreamWriter &writer, const int &
|
||||
writer.writeEmptyElement(styleNS, QString::fromLatin1("table-cell-properties"));
|
||||
if (hasBorder) {
|
||||
writer.writeAttribute(foNS, QString::fromLatin1("border"),
|
||||
pixelToPoint(tableFormatTmp.border()) + QLatin1String(" ")
|
||||
+ borderStyleName(tableFormatTmp.borderStyle()) + QLatin1String(" ")
|
||||
pixelToPoint(tableFormatTmp.border()) + " "_L1
|
||||
+ borderStyleName(tableFormatTmp.borderStyle()) + " "_L1
|
||||
+ tableFormatTmp.borderBrush().color().name(QColor::HexRgb));
|
||||
}
|
||||
qreal topPadding = format.topPadding();
|
||||
@ -984,14 +986,14 @@ void QTextOdfWriter::tableCellStyleElement(QXmlStreamWriter &writer, const int &
|
||||
///////////////////////
|
||||
|
||||
QTextOdfWriter::QTextOdfWriter(const QTextDocument &document, QIODevice *device)
|
||||
: officeNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:office:1.0")),
|
||||
textNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:text:1.0")),
|
||||
styleNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:style:1.0")),
|
||||
foNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0")),
|
||||
tableNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:table:1.0")),
|
||||
drawNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0")),
|
||||
xlinkNS (QLatin1String("http://www.w3.org/1999/xlink")),
|
||||
svgNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0")),
|
||||
: officeNS ("urn:oasis:names:tc:opendocument:xmlns:office:1.0"_L1),
|
||||
textNS ("urn:oasis:names:tc:opendocument:xmlns:text:1.0"_L1),
|
||||
styleNS ("urn:oasis:names:tc:opendocument:xmlns:style:1.0"_L1),
|
||||
foNS ("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"_L1),
|
||||
tableNS ("urn:oasis:names:tc:opendocument:xmlns:table:1.0"_L1),
|
||||
drawNS ("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"_L1),
|
||||
xlinkNS ("http://www.w3.org/1999/xlink"_L1),
|
||||
svgNS ("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"_L1),
|
||||
m_document(&document),
|
||||
m_device(device),
|
||||
m_strategy(nullptr),
|
||||
|
@ -50,6 +50,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
\class QTextTableCell
|
||||
\reentrant
|
||||
@ -1110,7 +1112,7 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols)
|
||||
QTextCursorPrivate::fromPosition(p, insertPos++).insertBlock();
|
||||
p->move(pos + 1, insertPos, nextPos - pos);
|
||||
} else if (rowHasText) {
|
||||
QTextCursorPrivate::fromPosition(p, insertPos++).insertText(QLatin1String(" "));
|
||||
QTextCursorPrivate::fromPosition(p, insertPos++).insertText(" "_L1);
|
||||
p->move(pos + 1, insertPos, nextPos - pos);
|
||||
} else {
|
||||
p->move(pos, insertPos, nextPos - pos);
|
||||
|
@ -67,6 +67,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#if QT_CONFIG(directwrite)
|
||||
static inline bool useDirectWrite(QFont::HintingPreference hintingPreference,
|
||||
const QString &familyName = QString(),
|
||||
@ -78,7 +80,7 @@ static inline bool useDirectWrite(QFont::HintingPreference hintingPreference,
|
||||
|
||||
// At some scales, GDI will misrender the MingLiU font, so we force use of
|
||||
// DirectWrite to work around the issue.
|
||||
if (Q_UNLIKELY(familyName.startsWith(QLatin1String("MingLiU"))))
|
||||
if (Q_UNLIKELY(familyName.startsWith("MingLiU"_L1)))
|
||||
return true;
|
||||
|
||||
if (isColorFont)
|
||||
@ -509,7 +511,7 @@ static bool addFontToDatabase(QString familyName,
|
||||
StoreFontPayload *sfp)
|
||||
{
|
||||
// the "@family" fonts are just the same as "family". Ignore them.
|
||||
if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith(QLatin1String("WST_")))
|
||||
if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith("WST_"_L1))
|
||||
return false;
|
||||
|
||||
uchar charSet = logFont.lfCharSet;
|
||||
@ -584,7 +586,7 @@ static bool addFontToDatabase(QString familyName,
|
||||
// display Thai text by default. As a temporary work around, we special case Segoe UI
|
||||
// and remove the Thai script from its list of supported writing systems.
|
||||
if (writingSystems.supported(QFontDatabase::Thai) &&
|
||||
familyName == QLatin1String("Segoe UI"))
|
||||
familyName == "Segoe UI"_L1)
|
||||
writingSystems.setSupported(QFontDatabase::Thai, false);
|
||||
} else {
|
||||
const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
|
||||
|
@ -60,6 +60,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSet)
|
||||
{
|
||||
switch (charSet) {
|
||||
@ -176,7 +178,7 @@ static bool addFontToDatabase(QString familyName,
|
||||
int type)
|
||||
{
|
||||
// the "@family" fonts are just the same as "family". Ignore them.
|
||||
if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith(QLatin1String("WST_")))
|
||||
if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith("WST_"_L1))
|
||||
return false;
|
||||
|
||||
uchar charSet = logFont.lfCharSet;
|
||||
@ -242,8 +244,7 @@ static bool addFontToDatabase(QString familyName,
|
||||
// Since it's the default UI font on this platform, most widgets will be unable to
|
||||
// display Thai text by default. As a temporary work around, we special case Segoe UI
|
||||
// and remove the Thai script from its list of supported writing systems.
|
||||
if (writingSystems.supported(QFontDatabase::Thai) &&
|
||||
faceName == QLatin1String("Segoe UI"))
|
||||
if (writingSystems.supported(QFontDatabase::Thai) && faceName == "Segoe UI"_L1)
|
||||
writingSystems.setSupported(QFontDatabase::Thai, false);
|
||||
} else {
|
||||
const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
|
||||
@ -259,8 +260,8 @@ static bool addFontToDatabase(QString familyName,
|
||||
QLocale systemLocale = QLocale::system();
|
||||
if (systemLocale.language() != QLocale::C
|
||||
&& systemLocale.language() != QLocale::English
|
||||
&& styleName != QLatin1String("Italic")
|
||||
&& styleName != QLatin1String("Bold")) {
|
||||
&& styleName != "Italic"_L1
|
||||
&& styleName != "Bold"_L1) {
|
||||
key = findFontKey(qt_getEnglishName(fullName, true), &index);
|
||||
}
|
||||
if (!key)
|
||||
@ -431,7 +432,7 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF
|
||||
}
|
||||
QString QWindowsFontDatabaseFT::fontDir() const
|
||||
{
|
||||
const QString result = QLatin1String(qgetenv("windir")) + QLatin1String("/Fonts");//QPlatformFontDatabase::fontDir();
|
||||
const QString result = QLatin1String(qgetenv("windir")) + "/Fonts"_L1;//QPlatformFontDatabase::fontDir();
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << result;
|
||||
return result;
|
||||
}
|
||||
|
@ -55,6 +55,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
// Helper classes for creating font engines directly from font data
|
||||
namespace {
|
||||
|
||||
@ -940,7 +942,7 @@ QFontDef QWindowsFontDatabaseBase::sanitizeRequest(QFontDef request) const
|
||||
if (fam.isEmpty())
|
||||
req.families[0] = QStringLiteral("MS Sans Serif");
|
||||
|
||||
if (fam == QLatin1String("MS Sans Serif")) {
|
||||
if (fam == "MS Sans Serif"_L1) {
|
||||
int height = -qRound(request.pixelSize);
|
||||
// MS Sans Serif has bearing problems in italic, and does not scale
|
||||
if (request.style == QFont::StyleItalic || (height > 18 && height != 24))
|
||||
|
@ -60,11 +60,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
static QString lookupVendorIdInSystemDatabase(QByteArrayView id)
|
||||
{
|
||||
QString result;
|
||||
|
||||
const QString fileName = QLatin1String("/usr/share/hwdata/pnp.ids");
|
||||
const QString fileName = "/usr/share/hwdata/pnp.ids"_L1;
|
||||
QFile file(fileName);
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
return result;
|
||||
|
@ -47,6 +47,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
template<typename T>
|
||||
static void insertOrRemoveItems(QList<T> &items, int index, int delta)
|
||||
{
|
||||
@ -1187,7 +1189,7 @@ void QGridLayoutEngine::dump(int indent) const
|
||||
qDebug("%*s Grid (%d x %d)", indent, "", internalGridRowCount(),
|
||||
internalGridColumnCount());
|
||||
for (int row = 0; row < internalGridRowCount(); ++row) {
|
||||
QString message = QLatin1String("[ ");
|
||||
QString message = "[ "_L1;
|
||||
for (int column = 0; column < internalGridColumnCount(); ++column) {
|
||||
message += QString::number(q_items.indexOf(itemAt(row, column))).rightJustified(3);
|
||||
message += u' ';
|
||||
@ -1214,7 +1216,7 @@ void QGridLayoutEngine::dump(int indent) const
|
||||
for (int pass = 0; pass < 2; ++pass) {
|
||||
QString message;
|
||||
for (i = 0; i < cellPos->count(); ++i) {
|
||||
message += QLatin1String((message.isEmpty() ? "[" : ", "));
|
||||
message += (message.isEmpty() ? "["_L1 : ", "_L1);
|
||||
message += QString::number(cellPos->at(i));
|
||||
}
|
||||
message += u']';
|
||||
|
Loading…
x
Reference in New Issue
Block a user