forked from qt-creator/qt-creator
Update mime database from Qt
qtbase/753a08ae0e1204b148cf3935f87349eefe75d338 QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicable Change-Id: I0b636c5b6e5c10f9388e2451e4a55afe04414361 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include <functional>
|
||||
#include <stack>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
static QString directoryMimeType()
|
||||
{
|
||||
return QStringLiteral("inode/directory");
|
||||
@@ -115,7 +117,7 @@ void MimeDatabasePrivate::loadProviders()
|
||||
const QStringList mimeDirs;
|
||||
#endif
|
||||
const auto fdoIterator = std::find_if(mimeDirs.constBegin(), mimeDirs.constEnd(), [](const QString &mimeDir) -> bool {
|
||||
return QFileInfo::exists(mimeDir + QLatin1String("/packages/freedesktop.org.xml")); }
|
||||
return QFileInfo::exists(mimeDir + "/packages/freedesktop.org.xml"_L1); }
|
||||
);
|
||||
const bool needInternalDB = MimeXMLProvider::InternalDatabaseAvailable && fdoIterator == mimeDirs.constEnd();
|
||||
//qDebug() << "mime dirs:" << mimeDirs;
|
||||
@@ -142,7 +144,7 @@ void MimeDatabasePrivate::loadProviders()
|
||||
|
||||
|
||||
for (const QString &mimeDir : mimeDirs) {
|
||||
const QString cacheFile = mimeDir + QLatin1String("/mime.cache");
|
||||
const QString cacheFile = mimeDir + "/mime.cache"_L1;
|
||||
// Check if we already have a provider for this dir
|
||||
const auto predicate = [mimeDir](const std::unique_ptr<MimeProviderBase> &prov)
|
||||
{
|
||||
@@ -239,7 +241,7 @@ MimeType MimeDatabasePrivate::mimeTypeForName(const QString &nameOrAlias)
|
||||
|
||||
QStringList MimeDatabasePrivate::mimeTypeForFileName(const QString &fileName)
|
||||
{
|
||||
if (fileName.endsWith(QLatin1Char('/')))
|
||||
if (fileName.endsWith(u'/'))
|
||||
return { directoryMimeType() };
|
||||
|
||||
const MimeGlobMatchResult result = findByFileName(fileName);
|
||||
@@ -272,7 +274,7 @@ void MimeDatabasePrivate::loadMimeTypePrivate(MimeTypePrivate &mimePrivate)
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
const QString file = mimePrivate.name + QLatin1String(".xml");
|
||||
const QString file = mimePrivate.name + ".xml"_L1;
|
||||
qWarning() << "No file found for" << file << ", even though update-mime-info said it would exist.\n"
|
||||
"Either it was just removed, or the directory doesn't have executable permission..."
|
||||
<< locateMimeDirectories();
|
||||
@@ -309,14 +311,14 @@ void MimeDatabasePrivate::loadIcon(MimeTypePrivate &mimePrivate)
|
||||
|
||||
QString MimeDatabasePrivate::fallbackParent(const QString &mimeTypeName) const
|
||||
{
|
||||
const QStringView myGroup = QStringView{mimeTypeName}.left(mimeTypeName.indexOf(QLatin1Char('/')));
|
||||
const QStringView myGroup = QStringView{mimeTypeName}.left(mimeTypeName.indexOf(u'/'));
|
||||
// All text/* types are subclasses of text/plain.
|
||||
if (myGroup == QLatin1String("text") && mimeTypeName != plainTextMimeType())
|
||||
if (myGroup == "text"_L1 && mimeTypeName != plainTextMimeType())
|
||||
return plainTextMimeType();
|
||||
// All real-file mimetypes implicitly derive from application/octet-stream
|
||||
if (myGroup != QLatin1String("inode") &&
|
||||
if (myGroup != "inode"_L1 &&
|
||||
// ignore non-file extensions
|
||||
myGroup != QLatin1String("all") && myGroup != QLatin1String("fonts") && myGroup != QLatin1String("print") && myGroup != QLatin1String("uri")
|
||||
myGroup != "all"_L1 && myGroup != "fonts"_L1 && myGroup != "print"_L1 && myGroup != "uri"_L1
|
||||
&& mimeTypeName != defaultMimeType()) {
|
||||
return defaultMimeType();
|
||||
}
|
||||
@@ -784,7 +786,7 @@ MimeType MimeDatabase::mimeTypeForUrl(const QUrl &url) const
|
||||
return mimeTypeForFile(url.toLocalFile());
|
||||
|
||||
const QString scheme = url.scheme();
|
||||
if (scheme.startsWith(QLatin1String("http")) || scheme == QLatin1String("mailto"))
|
||||
if (scheme.startsWith("http"_L1) || scheme == "mailto"_L1)
|
||||
return mimeTypeForName(d->defaultMimeType());
|
||||
|
||||
return mimeTypeForFile(url.path(), MatchExtension);
|
||||
@@ -813,7 +815,7 @@ MimeType MimeDatabase::mimeTypeForFileNameAndData(const QString &fileName, QIODe
|
||||
{
|
||||
QMutexLocker locker(&d->mutex);
|
||||
|
||||
if (fileName.endsWith(QLatin1Char('/')))
|
||||
if (fileName.endsWith(u'/'))
|
||||
return d->mimeTypeForName(directoryMimeType());
|
||||
|
||||
const bool openedByUs = !device->isOpen() && device->open(QIODevice::ReadOnly);
|
||||
@@ -843,7 +845,7 @@ MimeType MimeDatabase::mimeTypeForFileNameAndData(const QString &fileName, const
|
||||
{
|
||||
QMutexLocker locker(&d->mutex);
|
||||
|
||||
if (fileName.endsWith(QLatin1Char('/')))
|
||||
if (fileName.endsWith(u'/'))
|
||||
return d->mimeTypeForName(directoryMimeType());
|
||||
|
||||
QBuffer buffer(const_cast<QByteArray *>(&data));
|
||||
|
@@ -9,6 +9,8 @@
|
||||
#include <QStringList>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace Utils {
|
||||
|
||||
/*!
|
||||
@@ -61,17 +63,17 @@ MimeGlobPattern::PatternType MimeGlobPattern::detectPatternType(const QString &p
|
||||
if (!patternLength)
|
||||
return OtherPattern;
|
||||
|
||||
const int starCount = pattern.count(QLatin1Char('*'));
|
||||
const bool hasSquareBracket = pattern.indexOf(QLatin1Char('[')) != -1;
|
||||
const bool hasQuestionMark = pattern.indexOf(QLatin1Char('?')) != -1;
|
||||
const int starCount = pattern.count(u'*');
|
||||
const bool hasSquareBracket = pattern.indexOf(u'[') != -1;
|
||||
const bool hasQuestionMark = pattern.indexOf(u'?') != -1;
|
||||
|
||||
if (!hasSquareBracket && !hasQuestionMark) {
|
||||
if (starCount == 1) {
|
||||
// Patterns like "*~", "*.extension"
|
||||
if (pattern.at(0) == QLatin1Char('*'))
|
||||
if (pattern.at(0) == u'*')
|
||||
return SuffixPattern;
|
||||
// Patterns like "README*" (well this is currently the only one like that...)
|
||||
if (pattern.at(patternLength - 1) == QLatin1Char('*'))
|
||||
if (pattern.at(patternLength - 1) == u'*')
|
||||
return PrefixPattern;
|
||||
} else if (starCount == 0) {
|
||||
// Names without any wildcards like "README"
|
||||
@@ -79,10 +81,10 @@ MimeGlobPattern::PatternType MimeGlobPattern::detectPatternType(const QString &p
|
||||
}
|
||||
}
|
||||
|
||||
if (pattern == QLatin1String("[0-9][0-9][0-9].vdr"))
|
||||
if (pattern == "[0-9][0-9][0-9].vdr"_L1)
|
||||
return VdrPattern;
|
||||
|
||||
if (pattern == QLatin1String("*.anim[1-9j]"))
|
||||
if (pattern == "*.anim[1-9j]"_L1)
|
||||
return AnimPattern;
|
||||
|
||||
return OtherPattern;
|
||||
@@ -139,14 +141,14 @@ bool MimeGlobPattern::matchFileName(const QString &inputFileName) const
|
||||
case VdrPattern: // "[0-9][0-9][0-9].vdr" case
|
||||
return fileNameLength == 7
|
||||
&& fileName.at(0).isDigit() && fileName.at(1).isDigit() && fileName.at(2).isDigit()
|
||||
&& QStringView{fileName}.mid(3, 4) == QLatin1String(".vdr");
|
||||
&& QStringView{fileName}.mid(3, 4) == ".vdr"_L1;
|
||||
case AnimPattern: { // "*.anim[1-9j]" case
|
||||
if (fileNameLength < 6)
|
||||
return false;
|
||||
const QChar lastChar = fileName.at(fileNameLength - 1);
|
||||
const bool lastCharOK = (lastChar.isDigit() && lastChar != QLatin1Char('0'))
|
||||
|| lastChar == QLatin1Char('j');
|
||||
return lastCharOK && QStringView{fileName}.mid(fileNameLength - 6, 5) == QLatin1String(".anim");
|
||||
const bool lastCharOK = (lastChar.isDigit() && lastChar != u'0')
|
||||
|| lastChar == u'j';
|
||||
return lastCharOK && QStringView{fileName}.mid(fileNameLength - 6, 5) == ".anim"_L1;
|
||||
}
|
||||
case OtherPattern:
|
||||
#if QT_CONFIG(regularexpression)
|
||||
@@ -164,23 +166,23 @@ bool MimeGlobPattern::matchFileName(const QString &inputFileName) const
|
||||
static bool isSimplePattern(const QString &pattern)
|
||||
{
|
||||
// starts with "*.", has no other '*'
|
||||
return pattern.lastIndexOf(QLatin1Char('*')) == 0
|
||||
return pattern.lastIndexOf(u'*') == 0
|
||||
&& pattern.length() > 1
|
||||
&& pattern.at(1) == QLatin1Char('.') // (other dots are OK, like *.tar.bz2)
|
||||
&& pattern.at(1) == u'.' // (other dots are OK, like *.tar.bz2)
|
||||
// and contains no other special character
|
||||
&& !pattern.contains(QLatin1Char('?'))
|
||||
&& !pattern.contains(QLatin1Char('['))
|
||||
&& !pattern.contains(u'?')
|
||||
&& !pattern.contains(u'[')
|
||||
;
|
||||
}
|
||||
|
||||
static bool isFastPattern(const QString &pattern)
|
||||
{
|
||||
// starts with "*.", has no other '*' and no other '.'
|
||||
return pattern.lastIndexOf(QLatin1Char('*')) == 0
|
||||
&& pattern.lastIndexOf(QLatin1Char('.')) == 1
|
||||
return pattern.lastIndexOf(u'*') == 0
|
||||
&& pattern.lastIndexOf(u'.') == 1
|
||||
// and contains no other special character
|
||||
&& !pattern.contains(QLatin1Char('?'))
|
||||
&& !pattern.contains(QLatin1Char('['))
|
||||
&& !pattern.contains(u'?')
|
||||
&& !pattern.contains(u'[')
|
||||
;
|
||||
}
|
||||
|
||||
@@ -246,14 +248,14 @@ void MimeAllGlobPatterns::matchingGlobs(const QString &fileName,
|
||||
|
||||
// Now use the "fast patterns" dict, for simple *.foo patterns with weight 50
|
||||
// (which is most of them, so this optimization is definitely worth it)
|
||||
const int lastDot = fileName.lastIndexOf(QLatin1Char('.'));
|
||||
const int lastDot = fileName.lastIndexOf(u'.');
|
||||
if (lastDot != -1) { // if no '.', skip the extension lookup
|
||||
const int ext_len = fileName.length() - lastDot - 1;
|
||||
const QString simpleExtension = fileName.right(ext_len).toLower();
|
||||
// (toLower because fast patterns are always case-insensitive and saved as lowercase)
|
||||
|
||||
const QStringList matchingMimeTypes = m_fastPatterns.value(simpleExtension);
|
||||
const QString simplePattern = QLatin1String("*.") + simpleExtension;
|
||||
const QString simplePattern = "*."_L1 + simpleExtension;
|
||||
for (const QString &mime : matchingMimeTypes) {
|
||||
if (!ignoreMimeTypes.contains(mime))
|
||||
result.addMatch(mime, 50, simplePattern, simpleExtension.size());
|
||||
|
@@ -9,6 +9,8 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <qendian.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace Utils {
|
||||
|
||||
// in the same order as Type!
|
||||
@@ -221,10 +223,10 @@ MimeMagicRule::MimeMagicRule(const QString &type,
|
||||
m_matchFunction(nullptr)
|
||||
{
|
||||
if (Q_UNLIKELY(m_type == Invalid))
|
||||
*errorString = QLatin1String("Type ") + type + QLatin1String(" is not supported");
|
||||
*errorString = "Type "_L1 + type + " is not supported"_L1;
|
||||
|
||||
// Parse for offset as "1" or "1:10"
|
||||
const int colonIndex = offsets.indexOf(QLatin1Char(':'));
|
||||
const int colonIndex = offsets.indexOf(u':');
|
||||
const QStringView startPosStr
|
||||
= QStringView(offsets).mid(0, colonIndex); // \ These decay to returning 'offsets'
|
||||
const QStringView endPosStr = QStringView(offsets)
|
||||
@@ -253,7 +255,7 @@ void MimeMagicRule::init(QString *errorString)
|
||||
if (Q_UNLIKELY(!ok)) {
|
||||
m_type = Invalid;
|
||||
if (errorString)
|
||||
*errorString = QLatin1String("Invalid magic rule value \"") + QLatin1String(m_value) + QLatin1Char('"');
|
||||
*errorString = "Invalid magic rule value \""_L1 + QLatin1String(m_value) + u'"';
|
||||
return;
|
||||
}
|
||||
m_numberMask = !m_mask.isEmpty() ? m_mask.toUInt(&ok, 0) : 0; // autodetect base
|
||||
@@ -267,7 +269,7 @@ void MimeMagicRule::init(QString *errorString)
|
||||
if (Q_UNLIKELY(m_mask.size() < 4 || !m_mask.startsWith("0x"))) {
|
||||
m_type = Invalid;
|
||||
if (errorString)
|
||||
*errorString = QLatin1String("Invalid magic rule mask \"") + QLatin1String(m_mask) + QLatin1Char('"');
|
||||
*errorString = "Invalid magic rule mask \""_L1 + QLatin1String(m_mask) + u'"';
|
||||
return;
|
||||
}
|
||||
const QByteArray &tempMask = QByteArray::fromHex(QByteArray::fromRawData(
|
||||
@@ -275,7 +277,7 @@ void MimeMagicRule::init(QString *errorString)
|
||||
if (Q_UNLIKELY(tempMask.size() != m_pattern.size())) {
|
||||
m_type = Invalid;
|
||||
if (errorString)
|
||||
*errorString = QLatin1String("Invalid magic rule mask size \"") + QLatin1String(m_mask) + QLatin1Char('"');
|
||||
*errorString = "Invalid magic rule mask size \""_L1 + QLatin1String(m_mask) + u'"';
|
||||
return;
|
||||
}
|
||||
m_mask = tempMask;
|
||||
|
@@ -47,6 +47,8 @@ __attribute__((section(".qtmimedatabase"), aligned(4096)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace Utils {
|
||||
|
||||
MimeProviderBase::MimeProviderBase(MimeDatabasePrivate *db, const QString &directory)
|
||||
@@ -165,7 +167,7 @@ bool MimeBinaryProvider::checkCacheChanged()
|
||||
void MimeBinaryProvider::ensureLoaded()
|
||||
{
|
||||
if (!m_cacheFile) {
|
||||
const QString cacheFileName = m_directory + QLatin1String("/mime.cache");
|
||||
const QString cacheFileName = m_directory + "/mime.cache"_L1;
|
||||
m_cacheFile = new CacheFile(cacheFileName);
|
||||
m_mimetypeListLoaded = false;
|
||||
m_mimetypeExtra.clear();
|
||||
@@ -313,7 +315,8 @@ bool MimeBinaryProvider::matchSuffixTree(MimeGlobMatchResult &result,
|
||||
const bool caseSensitive = flagsAndWeight & 0x100;
|
||||
if (caseSensitiveCheck || !caseSensitive) {
|
||||
result.addMatch(QLatin1String(mimeType), weight,
|
||||
QLatin1Char('*') + QStringView{fileName}.mid(charPos + 1), fileName.size() - charPos - 2);
|
||||
u'*' + QStringView{fileName}.mid(charPos + 1),
|
||||
fileName.size() - charPos - 2);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@@ -505,9 +508,9 @@ bool MimeBinaryProvider::loadMimeTypePrivate(MimeTypePrivate &data)
|
||||
// load comment and globPatterns
|
||||
|
||||
// shared-mime-info since 1.3 lowercases the xml files
|
||||
QString mimeFile = m_directory + QLatin1Char('/') + data.name.toLower() + QLatin1String(".xml");
|
||||
QString mimeFile = m_directory + u'/' + data.name.toLower() + ".xml"_L1;
|
||||
if (!QFileInfo::exists(mimeFile))
|
||||
mimeFile = m_directory + QLatin1Char('/') + data.name + QLatin1String(".xml"); // pre-1.3
|
||||
mimeFile = m_directory + u'/' + data.name + ".xml"_L1; // pre-1.3
|
||||
|
||||
QFile qfile(mimeFile);
|
||||
if (!qfile.open(QFile::ReadOnly))
|
||||
@@ -520,10 +523,10 @@ bool MimeBinaryProvider::loadMimeTypePrivate(MimeTypePrivate &data)
|
||||
|
||||
QXmlStreamReader xml(&qfile);
|
||||
if (xml.readNextStartElement()) {
|
||||
if (xml.name() != QLatin1String("mime-type")) {
|
||||
if (xml.name() != "mime-type"_L1) {
|
||||
return false;
|
||||
}
|
||||
const auto name = xml.attributes().value(QLatin1String("type"));
|
||||
const auto name = xml.attributes().value("type"_L1);
|
||||
if (name.isEmpty())
|
||||
return false;
|
||||
if (name.compare(data.name, Qt::CaseInsensitive))
|
||||
@@ -531,20 +534,20 @@ bool MimeBinaryProvider::loadMimeTypePrivate(MimeTypePrivate &data)
|
||||
|
||||
while (xml.readNextStartElement()) {
|
||||
const auto tag = xml.name();
|
||||
if (tag == QLatin1String("comment")) {
|
||||
QString lang = xml.attributes().value(QLatin1String("xml:lang")).toString();
|
||||
if (tag == "comment"_L1) {
|
||||
QString lang = xml.attributes().value("xml:lang"_L1).toString();
|
||||
const QString text = xml.readElementText();
|
||||
if (lang.isEmpty()) {
|
||||
lang = QLatin1String("default"); // no locale attribute provided, treat it as default.
|
||||
lang = "default"_L1; // no locale attribute provided, treat it as default.
|
||||
}
|
||||
extra.localeComments.insert(lang, text);
|
||||
continue; // we called readElementText, so we're at the EndElement already.
|
||||
} else if (tag == QLatin1String("glob-deleteall")) { // as written out by shared-mime-info >= 0.70
|
||||
} else if (tag == "glob-deleteall"_L1) { // as written out by shared-mime-info >= 0.70
|
||||
extra.globPatterns.clear();
|
||||
mainPattern.clear();
|
||||
} else if (tag == QLatin1String("glob")) { // as written out by shared-mime-info >= 0.70
|
||||
const QString pattern = xml.attributes().value(QLatin1String("pattern")).toString();
|
||||
if (mainPattern.isEmpty() && pattern.startsWith(QLatin1Char('*'))) {
|
||||
} else if (tag == "glob"_L1) { // as written out by shared-mime-info >= 0.70
|
||||
const QString pattern = xml.attributes().value("pattern"_L1).toString();
|
||||
if (mainPattern.isEmpty() && pattern.startsWith(u'*')) {
|
||||
mainPattern = pattern;
|
||||
}
|
||||
if (!extra.globPatterns.contains(pattern))
|
||||
@@ -552,7 +555,7 @@ bool MimeBinaryProvider::loadMimeTypePrivate(MimeTypePrivate &data)
|
||||
}
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
Q_ASSERT(xml.name() == QLatin1String("mime-type"));
|
||||
Q_ASSERT(xml.name() == "mime-type"_L1);
|
||||
}
|
||||
|
||||
// Let's assume that shared-mime-info is at least version 0.70
|
||||
@@ -745,7 +748,7 @@ void MimeXMLProvider::ensureLoaded()
|
||||
const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||
allFiles.reserve(files.count());
|
||||
for (const QString &xmlFile : files)
|
||||
allFiles.append(packageDir + QLatin1Char('/') + xmlFile);
|
||||
allFiles.append(packageDir + u'/' + xmlFile);
|
||||
|
||||
if (m_allFiles == allFiles)
|
||||
return;
|
||||
@@ -775,7 +778,7 @@ bool MimeXMLProvider::load(const QString &fileName, QString *errorMessage)
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
if (errorMessage)
|
||||
*errorMessage = QLatin1String("Cannot open ") + fileName + QLatin1String(": ") + file.errorString();
|
||||
*errorMessage = "Cannot open "_L1 + fileName + ": "_L1 + file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -16,14 +16,16 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace Utils {
|
||||
|
||||
static QString suffixFromPattern(const QString &pattern)
|
||||
{
|
||||
// Not a simple suffix if it looks like: README or *. or *.* or *.JP*G or *.JP?
|
||||
if (pattern.startsWith(QLatin1String("*.")) &&
|
||||
if (pattern.startsWith("*."_L1) &&
|
||||
pattern.length() > 2 &&
|
||||
pattern.indexOf(QLatin1Char('*'), 2) < 0 && pattern.indexOf(QLatin1Char('?'), 2) < 0) {
|
||||
pattern.indexOf(u'*', 2) < 0 && pattern.indexOf(u'?', 2) < 0) {
|
||||
return pattern.mid(2);
|
||||
}
|
||||
return {};
|
||||
@@ -233,13 +235,13 @@ QString MimeType::comment() const
|
||||
QStringList languageList;
|
||||
languageList << QLocale().name();
|
||||
languageList << QLocale().uiLanguages();
|
||||
languageList << QLatin1String("default"); // use the default locale if possible.
|
||||
languageList << u"default"_qs; // use the default locale if possible.
|
||||
for (const QString &language : std::as_const(languageList)) {
|
||||
const QString lang = language == QLatin1String("C") ? QLatin1String("en_US") : language;
|
||||
const QString lang = language == "C"_L1 ? u"en_US"_qs : language;
|
||||
const QString comm = d->localeComments.value(lang);
|
||||
if (!comm.isEmpty())
|
||||
return comm;
|
||||
const int pos = lang.indexOf(QLatin1Char('_'));
|
||||
const int pos = lang.indexOf(u'_');
|
||||
if (pos != -1) {
|
||||
// "pt_BR" not found? try just "pt"
|
||||
const QString shortLang = lang.left(pos);
|
||||
@@ -278,19 +280,19 @@ QString MimeType::genericIconName() const
|
||||
// (i.e. "video-x-generic" in the previous example).
|
||||
const QString group = name();
|
||||
QStringView groupRef(group);
|
||||
const int slashindex = groupRef.indexOf(QLatin1Char('/'));
|
||||
const int slashindex = groupRef.indexOf(u'/');
|
||||
if (slashindex != -1)
|
||||
groupRef = groupRef.left(slashindex);
|
||||
return groupRef + QLatin1String("-x-generic");
|
||||
return groupRef + "-x-generic"_L1;
|
||||
}
|
||||
return d->genericIconName;
|
||||
}
|
||||
|
||||
static QString make_default_icon_name_from_mimetype_name(QString iconName)
|
||||
{
|
||||
const int slashindex = iconName.indexOf(QLatin1Char('/'));
|
||||
const int slashindex = iconName.indexOf(u'/');
|
||||
if (slashindex != -1)
|
||||
iconName[slashindex] = QLatin1Char('-');
|
||||
iconName[slashindex] = u'-';
|
||||
return iconName;
|
||||
}
|
||||
|
||||
@@ -459,13 +461,13 @@ QString MimeType::filterString() const
|
||||
QString filter;
|
||||
|
||||
if (!d->globPatterns.empty()) {
|
||||
filter += comment() + QLatin1String(" (");
|
||||
filter += comment() + " ("_L1;
|
||||
for (int i = 0; i < d->globPatterns.size(); ++i) {
|
||||
if (i != 0)
|
||||
filter += QLatin1Char(' ');
|
||||
filter += u' ';
|
||||
filter += d->globPatterns.at(i);
|
||||
}
|
||||
filter += QLatin1Char(')');
|
||||
filter += u')';
|
||||
}
|
||||
|
||||
return filter;
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#include <QtCore/QXmlStreamWriter>
|
||||
#include <QtCore/QStack>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
namespace Utils {
|
||||
|
||||
// XML tags in MIME files
|
||||
@@ -129,7 +131,7 @@ bool MimeTypeParserBase::parseNumber(QStringView n, int *target, QString *errorM
|
||||
*target = n.toInt(&ok);
|
||||
if (Q_UNLIKELY(!ok)) {
|
||||
if (errorMessage)
|
||||
*errorMessage = QLatin1String("Not a number '") + n + QLatin1String("'.");
|
||||
*errorMessage = "Not a number '"_L1 + n + "'."_L1;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -197,7 +199,7 @@ bool MimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
case ParseGlobPattern: {
|
||||
const QString pattern = atts.value(QLatin1String(patternAttributeC)).toString();
|
||||
unsigned weight = atts.value(QLatin1String(weightAttributeC)).toInt();
|
||||
const bool caseSensitive = atts.value(QLatin1String(caseSensitiveAttributeC)) == QLatin1String("true");
|
||||
const bool caseSensitive = atts.value(QLatin1String(caseSensitiveAttributeC)) == "true"_L1;
|
||||
|
||||
if (weight == 0)
|
||||
weight = MimeGlobPattern::DefaultWeight;
|
||||
@@ -261,7 +263,7 @@ bool MimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
break;
|
||||
}
|
||||
case ParseError:
|
||||
reader.raiseError(QLatin1String("Unexpected element <") + reader.name() + QLatin1Char('>'));
|
||||
reader.raiseError("Unexpected element <"_L1 + reader.name() + u'>');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Reference in New Issue
Block a user