Ref T480 No need for QStringLiteral when concatenating with %, use UTF-16 string literals.

This commit is contained in:
Mat Sutcliffe
2018-12-20 19:26:39 +00:00
parent 5443701e09
commit ace7650ebe
67 changed files with 394 additions and 398 deletions

View File

@@ -105,16 +105,16 @@ namespace BlackMisc
QString CArtifact::convertToQString(const QString &separator, bool i18n) const
{
Q_UNUSED(i18n);
return QLatin1String("name: ") %
return u"name: " %
this->getName() %
separator %
QLatin1String("size: ") %
u"size: " %
this->getFileSizeHumanReadable() %
separator %
QLatin1String("OS: ") %
u"OS: " %
this->getPlatform().toQString(i18n) %
separator %
QLatin1String("timestamp: ") %
u"timestamp: " %
this->getFormattedUtcTimestampYmdhms();
}

View File

@@ -29,7 +29,7 @@ namespace BlackMisc
QString IDatastoreObjectWithIntegerKey::getDbKeyAsStringInParentheses(const QString &prefix) const
{
if (m_dbKey < 0) { return {}; }
return prefix % QStringLiteral("(") % QString::number(m_dbKey) % QStringLiteral(")");
return prefix % u'(' % QString::number(m_dbKey) % u')';
}
void IDatastoreObjectWithIntegerKey::setDbKey(const QString &key)
@@ -76,19 +76,19 @@ namespace BlackMisc
void IDatastoreObjectWithIntegerKey::setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix)
{
// this function is performance sensitive, as it is called for all DB data
const int dbKey = json.value(prefix % QStringLiteral("id")).toInt(-1);
const int dbKey = json.value(prefix % u"id").toInt(-1);
this->setDbKey(dbKey);
// we check 2 formats, the DB format and the backend object format
QString timestampString(json.value(prefix % QStringLiteral("lastupdated")).toString());
if (timestampString.isEmpty()) { timestampString = json.value(prefix % QStringLiteral("tsLastUpdated")).toString(); }
QString timestampString(json.value(prefix % u"lastupdated").toString());
if (timestampString.isEmpty()) { timestampString = json.value(prefix % u"tsLastUpdated").toString(); }
const QDateTime ts(CDatastoreUtility::parseTimestamp(timestampString));
this->setUtcTimestamp(ts);
}
bool IDatastoreObjectWithIntegerKey::existsKey(const QJsonObject &json, const QString &prefix)
{
const QJsonValue jv(json.value(prefix % QStringLiteral("id")));
const QJsonValue jv(json.value(prefix % u"id"));
return !(jv.isNull() || jv.isUndefined());
}
@@ -151,7 +151,7 @@ namespace BlackMisc
QString IDatastoreObjectWithStringKey::getDbKeyAsStringInParentheses(const QString &prefix) const
{
if (m_dbKey.isEmpty()) { return ""; }
return prefix % QStringLiteral("(") % m_dbKey % QStringLiteral(")");
return prefix % '(' % m_dbKey % ')';
}
bool IDatastoreObjectWithStringKey::matchesDbKeyState(Db::DbKeyStateFilter filter) const
@@ -169,15 +169,15 @@ namespace BlackMisc
void IDatastoreObjectWithStringKey::setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix)
{
QString dbKey = json.value(prefix % QStringLiteral("id")).toString();
QDateTime ts(CDatastoreUtility::parseTimestamp(json.value(prefix + "lastupdated").toString()));
QString dbKey = json.value(prefix % u"id").toString();
QDateTime ts(CDatastoreUtility::parseTimestamp(json.value(prefix % u"lastupdated").toString()));
this->setDbKey(dbKey);
this->setUtcTimestamp(ts);
}
bool IDatastoreObjectWithStringKey::existsKey(const QJsonObject &json, const QString &prefix)
{
const QJsonValue jv(json.value(prefix % QStringLiteral("id")));
const QJsonValue jv(json.value(prefix % u"id"));
return !(jv.isNull() || jv.isUndefined());
}

View File

@@ -64,13 +64,13 @@ namespace BlackMisc
QString CDistribution::convertToQString(const QString &separator, bool i18n) const
{
return QLatin1String("channel: ") %
return u"channel: " %
this->getChannel() %
separator %
QLatin1String("download URLs: ") %
u"download URLs: " %
getDownloadUrls().toQString(i18n) %
separator %
QLatin1String("timestamp: ") %
u"timestamp: " %
this->getFormattedUtcTimestampYmdhms();
}

View File

@@ -96,13 +96,13 @@ namespace BlackMisc
QString CUpdateInfo::convertToQString(const QString &separator, bool i18n) const
{
Q_UNUSED(i18n);
return QLatin1String("artifacts (PC): ") %
return u"artifacts (PC): " %
this->getArtifactsPilotClient().toQString(i18n) %
separator %
QLatin1String("artifacts (XSB): ") %
u"artifacts (XSB): " %
this->getArtifactsXSwiftBus().toQString(i18n) %
separator %
QLatin1String("distributions: ") %
u"distributions: " %
this->getDistributions().toQString(i18n);
}