mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 00:45:46 +08:00
When calling arg() on a QString constructed from a literal, use QStringLiteral.
This commit is contained in:
@@ -117,7 +117,7 @@ namespace BlackMisc
|
||||
QString CAtomicFile::randomSuffix()
|
||||
{
|
||||
constexpr auto max = 2176782335;
|
||||
return QString("%1").arg(std::uniform_int_distribution<std::decay_t<decltype(max)>>(0, max)(Private::defaultRandomGenerator()), 6, 36, QChar('0'));
|
||||
return QStringLiteral("%1").arg(std::uniform_int_distribution<std::decay_t<decltype(max)>>(0, max)(Private::defaultRandomGenerator()), 6, 36, QChar('0'));
|
||||
}
|
||||
|
||||
#if defined(Q_OS_POSIX)
|
||||
|
||||
@@ -23,8 +23,7 @@ namespace BlackMisc
|
||||
QString CVoiceSetup::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
static const QString s("Port: %1");
|
||||
return s.arg(getVatsimUdpVoicePort());
|
||||
return QStringLiteral("Port: %1").arg(getVatsimUdpVoicePort());
|
||||
}
|
||||
|
||||
CStatusMessageList CVoiceSetup::validate() const
|
||||
|
||||
@@ -31,8 +31,7 @@ namespace BlackMisc
|
||||
QString CAircraftEngine::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
static const QString s("%1: %2");
|
||||
return s.arg(m_number).arg(BlackMisc::boolToOnOff(m_on));
|
||||
return QStringLiteral("%1: %2").arg(m_number).arg(BlackMisc::boolToOnOff(m_on));
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -82,8 +82,7 @@ namespace BlackMisc
|
||||
QString CAircraftIcaoCode::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
static const QString s("%1 %2 %3");
|
||||
return s.arg(this->getDesignatorDbKey(), this->getCombinedType(), this->getWtc()).trimmed();
|
||||
return QStringLiteral("%1 %2 %3").arg(this->getDesignatorDbKey(), this->getCombinedType(), this->getWtc()).trimmed();
|
||||
}
|
||||
|
||||
void CAircraftIcaoCode::updateMissingParts(const CAircraftIcaoCode &otherIcaoCode)
|
||||
@@ -143,8 +142,7 @@ namespace BlackMisc
|
||||
score += 50; // same designator
|
||||
if (log)
|
||||
{
|
||||
static const QString s("Same designator: %1");
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, s.arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Same designator: %1").arg(score));
|
||||
}
|
||||
|
||||
int scoreOld = score;
|
||||
@@ -153,30 +151,27 @@ namespace BlackMisc
|
||||
else if (this->getRank() < 10) { score += (10 - this->getRank()); }
|
||||
if (score > scoreOld)
|
||||
{
|
||||
static const QString s("Added rank: %1");
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, s.arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Added rank: %1").arg(score));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->hasFamily() && this->getFamily() == otherCode.getFamily())
|
||||
{
|
||||
static const QString s("Added family: %1");
|
||||
score += 30;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, s.arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Added family: %1").arg(score));
|
||||
}
|
||||
else if (this->hasValidCombinedType() && otherCode.getCombinedType() == this->getCombinedType())
|
||||
{
|
||||
static const QString s("Added combined code: %1");
|
||||
score += 20;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, s.arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Added combined code: %1").arg(score));
|
||||
}
|
||||
else if (this->hasValidCombinedType())
|
||||
{
|
||||
if (this->getEnginesCount() == otherCode.getEnginesCount()) { score += 2; }
|
||||
if (this->getEngineType() == otherCode.getEngineType()) { score += 2; }
|
||||
if (this->getAircraftType() == otherCode.getAircraftType()) { score += 2; }
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Added combined code parts: %1").arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Added combined code parts: %1").arg(score));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,14 +180,12 @@ namespace BlackMisc
|
||||
{
|
||||
if (this->matchesManufacturer(otherCode.getManufacturer()))
|
||||
{
|
||||
static const QString s("Matches manufacturer '%1': %2");
|
||||
score += 10;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, s.arg(this->getManufacturer()).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Matches manufacturer '%1': %2").arg(this->getManufacturer()).arg(score));
|
||||
}
|
||||
else if (this->getManufacturer().contains(otherCode.getManufacturer(), Qt::CaseInsensitive))
|
||||
{
|
||||
static const QString s("Contains manufacturer '%1': %2");
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, s.arg(this->getManufacturer()).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Contains manufacturer '%1': %2").arg(this->getManufacturer()).arg(score));
|
||||
score += 5;
|
||||
}
|
||||
}
|
||||
@@ -200,9 +193,8 @@ namespace BlackMisc
|
||||
// 0..75 so far
|
||||
if (this->isMilitary() == otherCode.isMilitary())
|
||||
{
|
||||
static const QString s("Matches military flag '%1': %2");
|
||||
score += 10;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, s.arg(boolToYesNo(this->isMilitary())).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Matches military flag '%1': %2").arg(boolToYesNo(this->isMilitary())).arg(score));
|
||||
}
|
||||
// 0..85
|
||||
return score;
|
||||
|
||||
@@ -1030,8 +1030,7 @@ namespace BlackMisc
|
||||
|
||||
QString CAircraftSituation::getPBHInfo() const
|
||||
{
|
||||
static const QString pbh("P: %1 %2 B: %3 %4 H: %5 %6");
|
||||
return pbh.arg(
|
||||
return QStringLiteral("P: %1 %2 B: %3 %4 H: %5 %6").arg(
|
||||
this->getPitch().valueRoundedWithUnit(CAngleUnit::deg(), 1, true), this->getPitch().valueRoundedWithUnit(CAngleUnit::rad(), 5, true),
|
||||
this->getBank().valueRoundedWithUnit(CAngleUnit::deg(), 1, true), this->getBank().valueRoundedWithUnit(CAngleUnit::rad(), 5, true),
|
||||
this->getHeading().valueRoundedWithUnit(CAngleUnit::deg(), 1, true), this->getHeading().valueRoundedWithUnit(CAngleUnit::rad(), 5, true)
|
||||
|
||||
@@ -379,31 +379,31 @@ namespace BlackMisc
|
||||
if (otherCode.hasValidDesignator() && this->getDesignator() == otherCode.getDesignator())
|
||||
{
|
||||
score += 60;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Same designator: %1").arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Same designator: %1").arg(score));
|
||||
}
|
||||
|
||||
// only for DB values we check VA
|
||||
if (bothFromDb && this->isVirtualAirline() == otherCode.isVirtualAirline())
|
||||
{
|
||||
score += 20;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("VA equality: %1").arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("VA equality: %1").arg(score));
|
||||
}
|
||||
|
||||
// consider the various names
|
||||
if (this->hasName() && this->getName() == otherCode.getName())
|
||||
{
|
||||
score += 20;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Same name '%1': %2").arg(this->getName()).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Same name '%1': %2").arg(this->getName()).arg(score));
|
||||
}
|
||||
else if (this->hasTelephonyDesignator() && this->getTelephonyDesignator() == otherCode.getTelephonyDesignator())
|
||||
{
|
||||
score += 15;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Same telephony '%1': %2").arg(this->getTelephonyDesignator()).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Same telephony '%1': %2").arg(this->getTelephonyDesignator()).arg(score));
|
||||
}
|
||||
else if (this->hasSimplifiedName() && this->getSimplifiedName() == otherCode.getSimplifiedName())
|
||||
{
|
||||
score += 10;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Same simplified name '%1': %2").arg(this->getSimplifiedName()).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Same simplified name '%1': %2").arg(this->getSimplifiedName()).arg(score));
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
@@ -78,9 +78,8 @@ namespace BlackMisc
|
||||
|
||||
if (m_datum == FlightLevel)
|
||||
{
|
||||
static const QString fls("FL%1");
|
||||
const int fl = qRound(this->CLength::value(CLengthUnit::ft()) / 100.0);
|
||||
return fls.arg(fl);
|
||||
return QStringLiteral("FL%1").arg(fl);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -503,7 +503,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (msgs)
|
||||
{
|
||||
msgs->push_back(ex.toStatusMessage(getLogCategories(), QString("Parsing flight plan from '%1' failed.").arg(fileName)));
|
||||
msgs->push_back(ex.toStatusMessage(getLogCategories(), QStringLiteral("Parsing flight plan from '%1' failed.").arg(fileName)));
|
||||
}
|
||||
}
|
||||
return CFlightPlan();
|
||||
|
||||
@@ -20,13 +20,12 @@ namespace BlackMisc
|
||||
{
|
||||
QString CHeading::convertToQString(bool i18n) const
|
||||
{
|
||||
static const QString s("%1 %2");
|
||||
return i18n ?
|
||||
s.arg(CAngle::convertToQString(i18n),
|
||||
QStringLiteral("%1 %2").arg(CAngle::convertToQString(i18n),
|
||||
this->isMagneticHeading() ?
|
||||
QCoreApplication::translate("Aviation", "magnetic") :
|
||||
QCoreApplication::translate("Aviation", "true")) :
|
||||
s.arg(CAngle::convertToQString(i18n),
|
||||
QStringLiteral("%1 %2").arg(CAngle::convertToQString(i18n),
|
||||
this->isMagneticHeading() ? "magnetic" : "true");
|
||||
}
|
||||
|
||||
|
||||
@@ -429,8 +429,7 @@ namespace BlackMisc
|
||||
|
||||
QString CLivery::asHtmlSummary(const QString &separator) const
|
||||
{
|
||||
static const QString html = "%1%2Airline: %3";
|
||||
return html.arg(
|
||||
return QStringLiteral("%1%2Airline: %3").arg(
|
||||
this->getCombinedCodePlusInfoAndId(), separator,
|
||||
this->getAirlineIcaoCode().getDesignator().isEmpty() ? "No airline" : this->getAirlineIcaoCode().getCombinedStringWithKey()
|
||||
).replace(" ", " ");
|
||||
@@ -456,7 +455,7 @@ namespace BlackMisc
|
||||
// 2 color liveries 25..85
|
||||
score = 25;
|
||||
score += 60 * colorMultiplier;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("2 color liveries, color multiplier %1: %2").arg(colorMultiplier).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("2 color liveries, color multiplier %1: %2").arg(colorMultiplier).arg(score));
|
||||
}
|
||||
else if (this->isAirlineLivery() && otherLivery.isAirlineLivery())
|
||||
{
|
||||
@@ -467,10 +466,10 @@ namespace BlackMisc
|
||||
// same ICAO at least means 30, max 50
|
||||
score = qRound(0.5 * this->getAirlineIcaoCode().calculateScore(otherLivery.getAirlineIcaoCode(), log));
|
||||
score += 25 * colorMultiplier;
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("2 airline liveries, color multiplier %1: %2").arg(colorMultiplier).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("2 airline liveries, color multiplier %1: %2").arg(colorMultiplier).arg(score));
|
||||
if (this->isMilitary() == otherLivery.isMilitary())
|
||||
{
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Mil.flag '%1' matches: %2").arg(boolToYesNo(this->isMilitary())).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Mil.flag '%1' matches: %2").arg(boolToYesNo(this->isMilitary())).arg(score));
|
||||
score += 10;
|
||||
}
|
||||
}
|
||||
@@ -481,7 +480,7 @@ namespace BlackMisc
|
||||
// 25 is weaker as same ICAO code / 2 from above
|
||||
score = preferColorLiveries ? 25 : 0;
|
||||
score += 25 * colorMultiplier; // needs to be the same as in 2 airlines
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Color/airline mixed, color multiplier %1: %2").arg(colorMultiplier).arg(score));
|
||||
CMatchingUtils::addLogDetailsToList(log, *this, QStringLiteral("Color/airline mixed, color multiplier %1: %2").arg(colorMultiplier).arg(score));
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
CDataCacheSerializer::CDataCacheSerializer(CDataCache *owner, const QString &revisionFileName) :
|
||||
CContinuousWorker(owner, QString("CDataCacheSerializer '%1'").arg(revisionFileName)),
|
||||
CContinuousWorker(owner, QStringLiteral("CDataCacheSerializer '%1'").arg(revisionFileName)),
|
||||
m_cache(owner),
|
||||
m_revisionFileName(revisionFileName)
|
||||
{}
|
||||
|
||||
@@ -68,8 +68,7 @@ namespace BlackMisc
|
||||
QString CDbInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString s("Table %1 with entries %1");
|
||||
return s.arg(this->m_tableName).arg(this->m_entries);
|
||||
return QStringLiteral("Table %1 with entries %1").arg(this->m_tableName).arg(this->m_entries);
|
||||
}
|
||||
|
||||
CVariant CDbInfo::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
|
||||
@@ -398,7 +398,7 @@ namespace BlackMisc
|
||||
|
||||
// todo: Replace assert with input validation
|
||||
Q_ASSERT_X(CNetworkUtils::isValidIPv4Address(p), "CDBusServer::p2pAddress", "Wrong IP in String");
|
||||
return QString("tcp:host=%1,port=%2").arg(h, p);
|
||||
return QStringLiteral("tcp:host=%1,port=%2").arg(h, p);
|
||||
}
|
||||
|
||||
const QString &CDBusServer::p2pConnectionName()
|
||||
|
||||
@@ -455,8 +455,7 @@ namespace BlackMisc
|
||||
if (!win) { return filePath; }
|
||||
if (!filePath.startsWith('/')) { return filePath; }
|
||||
if (filePath.startsWith("//")) { return filePath; }
|
||||
static const QString f("/%1");
|
||||
return f.arg(filePath);
|
||||
return QStringLiteral("/%1").arg(filePath);
|
||||
}
|
||||
|
||||
QStringList CFileUtils::fixWindowsUncPaths(const QStringList &filePaths)
|
||||
@@ -546,7 +545,7 @@ namespace BlackMisc
|
||||
unit = i.next();
|
||||
currentSize /= 1024.0;
|
||||
}
|
||||
return QString("%1 %2").arg(CMathUtils::roundAsString(currentSize, 2), unit);
|
||||
return QStringLiteral("%1 %2").arg(CMathUtils::roundAsString(currentSize, 2), unit);
|
||||
}
|
||||
|
||||
const QStringList &CFileUtils::executableSuffixes()
|
||||
|
||||
@@ -175,10 +175,9 @@ namespace BlackMisc
|
||||
|
||||
QString ICoordinateGeodetic::convertToQString(bool i18n) const
|
||||
{
|
||||
static const QString s = "Geodetic: {%1/%2, %3/%4, %5}";
|
||||
const CLatitude lat = this->latitude();
|
||||
const CLongitude lng = this->longitude();
|
||||
return s.arg(lat.valueRoundedWithUnit(CAngleUnit::deg(), 6, i18n),
|
||||
return QStringLiteral("Geodetic: {%1/%2, %3/%4, %5}").arg(lat.valueRoundedWithUnit(CAngleUnit::deg(), 6, i18n),
|
||||
lat.valueRoundedWithUnit(CAngleUnit::rad(), 6, i18n),
|
||||
lng.valueRoundedWithUnit(CAngleUnit::deg(), 6, i18n),
|
||||
lng.valueRoundedWithUnit(CAngleUnit::rad(), 6, i18n),
|
||||
|
||||
@@ -21,9 +21,8 @@ namespace BlackMisc
|
||||
{
|
||||
QString CElevationPlane::convertToQString(bool i18n) const
|
||||
{
|
||||
static const QString s = "%1 radius: %2";
|
||||
const QString coordinate = CCoordinateGeodetic::toQString(i18n);
|
||||
return s.arg(coordinate, m_radius.valueRoundedWithUnit(2, i18n));
|
||||
return QStringLiteral("%1 radius: %2").arg(coordinate, m_radius.valueRoundedWithUnit(2, i18n));
|
||||
}
|
||||
|
||||
CElevationPlane::CElevationPlane(const ICoordinateGeodetic &coordinate, const ICoordinateGeodetic &rangeCoordinate) :
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace BlackMisc
|
||||
QString CJoystickButton::buttonIndexToString(qint32 buttonIndex)
|
||||
{
|
||||
QString buttonString("Button");
|
||||
return buttonString.append(QString("%1").arg(buttonIndex));
|
||||
return buttonString.append(QStringLiteral("%1").arg(buttonIndex));
|
||||
}
|
||||
|
||||
int CJoystickButton::buttonIndexFromString(const QString &buttonName)
|
||||
|
||||
@@ -35,10 +35,8 @@ namespace BlackMisc
|
||||
|
||||
QString CJsonException::toString(const QString &prefix) const
|
||||
{
|
||||
static const QString s("%1 in '%2'");
|
||||
static const QString sp("%1: %2 in '%3'");
|
||||
if (prefix.isEmpty()) { return s.arg(what()).arg(getStackTrace()); }
|
||||
return sp.arg(prefix).arg(what()).arg(getStackTrace());
|
||||
if (prefix.isEmpty()) { return QStringLiteral("%1 in '%2'").arg(what()).arg(getStackTrace()); }
|
||||
return QStringLiteral("%1: %2 in '%3'").arg(prefix).arg(what()).arg(getStackTrace());
|
||||
}
|
||||
|
||||
void CJsonException::toLogMessage(const CLogCategoryList &categories, const QString &prefix) const
|
||||
|
||||
@@ -30,8 +30,7 @@ namespace BlackMisc
|
||||
QString CRawFsdMessage::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
static const QString s("%1 %2");
|
||||
return s.arg(this->getFormattedUtcTimestampHmsz(), m_rawMessage);
|
||||
return QStringLiteral("%1 %2").arg(this->getFormattedUtcTimestampHmsz(), m_rawMessage);
|
||||
}
|
||||
|
||||
bool CRawFsdMessage::isPacketType(const QString &type) const
|
||||
|
||||
@@ -31,8 +31,7 @@ namespace BlackMisc
|
||||
QString CRemoteFile::getNameAndSize() const
|
||||
{
|
||||
if (!this->hasName()) { return {}; }
|
||||
static const QString s("%1 (%2)");
|
||||
return s.arg(this->getName(), this->getSizeHumanReadable());
|
||||
return QStringLiteral("%1 (%2)").arg(this->getName(), this->getSizeHumanReadable());
|
||||
}
|
||||
|
||||
bool CRemoteFile::matchesName(const QString &name) const
|
||||
|
||||
@@ -57,8 +57,7 @@ namespace BlackMisc
|
||||
|
||||
QString CServer::convertToQString(bool i18n) const
|
||||
{
|
||||
static const QString str("%1 %2 %3:%4 %5 %6 accepting: %7 FSD: %8 con.since: %9");
|
||||
return str.
|
||||
return QStringLiteral("%1 %2 %3:%4 %5 %6 accepting: %7 FSD: %8 con.since: %9").
|
||||
arg(m_name, m_description, m_address).arg(m_port).
|
||||
arg(m_user.toQString(i18n), m_ecosystem.getSystemString(),
|
||||
boolToYesNo(m_isAcceptingConnections), m_fsdSetup.toQString(i18n), this->isConnected() ? this->getFormattedUtcTimestampHms() : "not con.");
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (!msg.isEmpty())
|
||||
{
|
||||
m_errorMsgs.append(QString("URL: %1 error: %2").arg(url.toQString(), msg));
|
||||
m_errorMsgs.append(QStringLiteral("URL: %1 error: %2").arg(url.toQString(), msg));
|
||||
}
|
||||
return obtainNextWorkingUrl(random, connectTimeoutMs);
|
||||
}
|
||||
|
||||
@@ -148,8 +148,7 @@ namespace BlackMisc
|
||||
QString CUrlLogList::getSummary() const
|
||||
{
|
||||
static const QString s("Entries: %1, pending: %2, errors: %3, min: %4ms avg: %5ms max: %6ms");
|
||||
static const QString e("No data");
|
||||
if (this->isEmpty()) return e;
|
||||
if (this->isEmpty()) return QStringLiteral("No data");
|
||||
return s.arg(this->size()).arg(this->sizePending()).arg(this->sizeErrors()).arg(this->getMinResponseTime()).arg(this->getAverageResponseTime()).arg(this->getMaxResponseTime());
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace BlackMisc
|
||||
break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
return CVariant::fromValue(m);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace BlackMisc
|
||||
break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackMisc
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
return CVariant::fromValue(m);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace BlackMisc
|
||||
break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
}
|
||||
|
||||
|
||||
@@ -128,14 +128,14 @@ namespace BlackMisc
|
||||
QString CTime::formattedHrsMinSec() const
|
||||
{
|
||||
const QList<int> parts = getHrsMinSecParts();
|
||||
const QString h = QString("00%1").arg(QString::number(parts.at(0))).right(2);
|
||||
const QString m = QString("00%1").arg(QString::number(parts.at(1))).right(2);
|
||||
const QString s = QString("00%1").arg(QString::number(parts.at(2))).right(2);
|
||||
const QString h = QStringLiteral("00%1").arg(QString::number(parts.at(0))).right(2);
|
||||
const QString m = QStringLiteral("00%1").arg(QString::number(parts.at(1))).right(2);
|
||||
const QString s = QStringLiteral("00%1").arg(QString::number(parts.at(2))).right(2);
|
||||
|
||||
const QString fs = QStringLiteral("%1:%2:%3").arg(h, m, s);
|
||||
if (this->isNegativeWithEpsilonConsidered())
|
||||
{
|
||||
return QString("-").append(fs);
|
||||
return QStringLiteral("-").append(fs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,9 +158,9 @@ namespace BlackMisc
|
||||
QString CTime::formattedHrsMin() const
|
||||
{
|
||||
const QList<int> parts = getHrsMinSecParts();
|
||||
const QString h = QString("00%1").arg(QString::number(parts.at(0))).right(2);
|
||||
const QString m = QString("00%1").arg(QString::number(parts.at(1))).right(2);
|
||||
const QString fs = QString("%1:%2").arg(h, m);
|
||||
const QString h = QStringLiteral("00%1").arg(QString::number(parts.at(0))).right(2);
|
||||
const QString m = QStringLiteral("00%1").arg(QString::number(parts.at(1))).right(2);
|
||||
const QString fs = QStringLiteral("%1:%2").arg(h, m);
|
||||
if (this->isNegativeWithEpsilonConsidered())
|
||||
{
|
||||
return QString("-").append(fs);
|
||||
|
||||
@@ -27,13 +27,13 @@ namespace BlackMisc
|
||||
|
||||
QString CProcessInfo::convertToQString(bool) const
|
||||
{
|
||||
return QString("{ %1, %2 }").arg(QString::number(m_pid), m_name);
|
||||
return QStringLiteral("{ %1, %2 }").arg(QString::number(m_pid), m_name);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
QString CProcessInfo::processNameFromId(qint64 pid)
|
||||
{
|
||||
QString path = QFileInfo(QString("/proc/%1/exe").arg(pid)).symLinkTarget();
|
||||
QString path = QFileInfo(QStringLiteral("/proc/%1/exe").arg(pid)).symLinkTarget();
|
||||
return QFileInfo(path).fileName();
|
||||
}
|
||||
#elif defined(Q_OS_MACOS)
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace BlackMisc
|
||||
|
||||
QString CPropertyIndexVariantMap::convertToQString(bool i18n) const
|
||||
{
|
||||
if (this->isEmpty()) return QString("{wildcard: %1}").arg(m_wildcard ? "true" : "false");
|
||||
if (this->isEmpty()) return QStringLiteral("{wildcard: %1}").arg(m_wildcard ? "true" : "false");
|
||||
QString s;
|
||||
for (const CPropertyIndex &index : makeKeysRange(m_values))
|
||||
{
|
||||
|
||||
@@ -128,8 +128,7 @@ namespace BlackMisc
|
||||
|
||||
QString CAircraftModel::asHtmlSummary(const QString &separator) const
|
||||
{
|
||||
static const QString html = "Model: %1 changed: %2%3Simulator: %4 Mode: %5 Distributor: %6%7Aircraft ICAO: %8%9Livery: %10";
|
||||
return html
|
||||
return QStringLiteral("Model: %1 changed: %2%3Simulator: %4 Mode: %5 Distributor: %6%7Aircraft ICAO: %8%9Livery: %10")
|
||||
.arg(this->getModelStringAndDbKey(), this->getFormattedUtcTimestampYmdhms(), separator,
|
||||
this->getSimulator().toQString(true), this->getModelModeAsString(), this->getDistributor().getIdAndDescription(), separator,
|
||||
this->getAircraftIcaoCode().asHtmlSummary(), separator)
|
||||
@@ -701,7 +700,7 @@ namespace BlackMisc
|
||||
{
|
||||
const int icaoScore = this->getAircraftIcaoCode().calculateScore(compareModel.getAircraftIcaoCode(), log);
|
||||
const int liveryScore = this->getLivery().calculateScore(compareModel.getLivery(), preferColorLiveries, log);
|
||||
CMatchingUtils::addLogDetailsToList(log, this->getCallsign(), QString("ICAO score: %1 | livery score: %2").arg(icaoScore).arg(liveryScore));
|
||||
CMatchingUtils::addLogDetailsToList(log, this->getCallsign(), QStringLiteral("ICAO score: %1 | livery score: %2").arg(icaoScore).arg(liveryScore));
|
||||
return qRound(0.5 * (icaoScore + liveryScore));
|
||||
}
|
||||
|
||||
|
||||
@@ -973,8 +973,8 @@ namespace BlackMisc
|
||||
ScoredModels scoreMap;
|
||||
|
||||
// normally prefer colors if there is no airline
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), QString("Prefer color liveries: '%1', airline: '%2', ignore zero scores: '%3'").arg(boolToYesNo(preferColorLiveries), remoteModel.getAirlineIcaoCodeDesignator(), boolToYesNo(ignoreZeroScores)));
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), QString("--- Start scoring in list with %1 models").arg(this->size()));
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("Prefer color liveries: '%1', airline: '%2', ignore zero scores: '%3'").arg(boolToYesNo(preferColorLiveries), remoteModel.getAirlineIcaoCodeDesignator(), boolToYesNo(ignoreZeroScores)));
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("--- Start scoring in list with %1 models").arg(this->size()));
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), this->coverageSummaryForModel(remoteModel));
|
||||
|
||||
int c = 1;
|
||||
@@ -984,11 +984,9 @@ namespace BlackMisc
|
||||
const int score = model.calculateScore(remoteModel, preferColorLiveries, log ? &subMsgs : nullptr);
|
||||
if (ignoreZeroScores && score < 1) { continue; }
|
||||
|
||||
static const QString bMsg("--- Calculating #%1 '%2'---");
|
||||
static const QString eMsg("--- End calculating #%1 ---");
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), bMsg.arg(c).arg(model.getModelStringAndDbKey()));
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("--- Calculating #%1 '%2'---").arg(c).arg(model.getModelStringAndDbKey()));
|
||||
if (log) { log->push_back(subMsgs); }
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), eMsg.arg(c));
|
||||
CMatchingUtils::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("--- End calculating #%1 ---").arg(c));
|
||||
c++;
|
||||
scoreMap.insertMulti(score, model);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace BlackMisc
|
||||
QString CDistributor::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString s = QString("Id: '%1'").arg(m_dbKey);
|
||||
QString s = QStringLiteral("Id: '%1'").arg(m_dbKey);
|
||||
if (this->hasAlias1()) { s.append(" ").append(m_alias1); }
|
||||
if (this->hasAlias2()) { s.append(" ").append(m_alias2); }
|
||||
return s;
|
||||
|
||||
@@ -38,9 +38,7 @@ namespace BlackMisc
|
||||
|
||||
QString CAircraftCfgEntries::convertToQString(bool) const
|
||||
{
|
||||
static const QString s = "{%1, %2, %3, %4, %5, %6}";
|
||||
return s.
|
||||
arg(m_fileName).arg(m_index).
|
||||
return QStringLiteral("{%1, %2, %3, %4, %5, %6}").arg(m_fileName).arg(m_index).
|
||||
arg(m_title, m_atcModel, m_atcType, m_atcParkingCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ namespace BlackMisc
|
||||
messages.clear();
|
||||
if (!CDirectoryUtils::existsUnemptyDirectory(CDirectoryUtils::shareTerrainProbeDirectory()))
|
||||
{
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, QString("No terrain probe source files in '%1'").arg(CDirectoryUtils::shareTerrainProbeDirectory())));
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, QStringLiteral("No terrain probe source files in '%1'").arg(CDirectoryUtils::shareTerrainProbeDirectory())));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ namespace BlackMisc
|
||||
QDir td(targetDir);
|
||||
if (!td.exists())
|
||||
{
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, QString("Cannot access target directory '%1'").arg(targetDir)));
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, QStringLiteral("Cannot access target directory '%1'").arg(targetDir)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -389,12 +389,12 @@ namespace BlackMisc
|
||||
const bool hasDir = td.mkpath(targetDir);
|
||||
if (!hasDir)
|
||||
{
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, QString("Cannot create target directory '%1'").arg(targetDir)));
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, QStringLiteral("Cannot create target directory '%1'").arg(targetDir)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
const int copied = CDirectoryUtils::copyDirectoryRecursively(CDirectoryUtils::shareTerrainProbeDirectory(), targetDir, true);
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityInfo, QString("Copied %1 files from '%2' to '%3'").arg(copied).arg(CDirectoryUtils::shareTerrainProbeDirectory(), targetDir)));
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityInfo, QStringLiteral("Copied %1 files from '%2' to '%3'").arg(copied).arg(CDirectoryUtils::shareTerrainProbeDirectory(), targetDir)));
|
||||
return copied;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,18 +99,18 @@ namespace BlackMisc
|
||||
|
||||
QString CSimConnectUtilities::simConnectCfg(const QString &ip, int port)
|
||||
{
|
||||
const QString sc = QString("[SimConnect]\nProtocol=Ipv4\nAddress=%1\nPort=%2\n"
|
||||
"MaxReceiveSize=4096\nDisableNagle=0").arg(ip).arg(port);
|
||||
const QString sc = QStringLiteral("[SimConnect]\nProtocol=Ipv4\nAddress=%1\nPort=%2\n"
|
||||
"MaxReceiveSize=4096\nDisableNagle=0").arg(ip).arg(port);
|
||||
return sc;
|
||||
}
|
||||
|
||||
QString CSimConnectUtilities::resolveEnumToString(const DWORD id, const char *enumName)
|
||||
{
|
||||
const int i = CSimConnectUtilities::staticMetaObject.indexOfEnumerator(enumName);
|
||||
if (i < 0) { return QString("No enumerator for %1").arg(enumName); }
|
||||
if (i < 0) { return QStringLiteral("No enumerator for %1").arg(enumName); }
|
||||
const QMetaEnum m = CSimConnectUtilities::staticMetaObject.enumerator(i);
|
||||
const char *k = m.valueToKey(static_cast<int>(id));
|
||||
return (k) ? QLatin1String(k) : QString("Id '%1' not found for %2").arg(id).arg(enumName);
|
||||
return (k) ? QLatin1String(k) : QStringLiteral("Id '%1' not found for %2").arg(id).arg(enumName);
|
||||
}
|
||||
|
||||
const QString &CSimConnectUtilities::simConnectIniFilename()
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace BlackMisc
|
||||
{
|
||||
QString file = filePatternInterpolationLog();
|
||||
file.remove('*');
|
||||
const QString fn = CFileUtils::appendFilePaths(CDirectoryUtils::logDirectory(), QString("%1 %2").arg(ts, file));
|
||||
const QString fn = CFileUtils::appendFilePaths(CDirectoryUtils::logDirectory(), QStringLiteral("%1 %2").arg(ts, file));
|
||||
const bool s = CFileUtils::writeStringToFile(htmlTemplate.arg(html.arg(interpolation.size()).arg(htmlInterpolation)), fn);
|
||||
msgs.push_back(CInterpolationLogger::logStatusFileWriting(s, fn));
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace BlackMisc
|
||||
{
|
||||
QString file = filePatternPartsLog();
|
||||
file.remove('*');
|
||||
const QString fn = CFileUtils::appendFilePaths(CDirectoryUtils::logDirectory(), QString("%1 %2").arg(ts, file));
|
||||
const QString fn = CFileUtils::appendFilePaths(CDirectoryUtils::logDirectory(), QStringLiteral("%1 %2").arg(ts, file));
|
||||
const bool s = CFileUtils::writeStringToFile(htmlTemplate.arg(html.arg(parts.size()).arg(htmlParts)), fn);
|
||||
msgs.push_back(CInterpolationLogger::logStatusFileWriting(s, fn));
|
||||
}
|
||||
@@ -393,11 +393,9 @@ namespace BlackMisc
|
||||
|
||||
QString CInterpolationLogger::msSinceEpochToTime(qint64 t1, qint64 t2, qint64 t3)
|
||||
{
|
||||
static const QString s2("%1 %2");
|
||||
if (t3 < 0) { return s2.arg(msSinceEpochToTime(t1), msSinceEpochToTime(t2)); }
|
||||
if (t3 < 0) { return QStringLiteral("%1 %2").arg(msSinceEpochToTime(t1), msSinceEpochToTime(t2)); }
|
||||
|
||||
static const QString s3("%1 %2 %3");
|
||||
return s3.arg(msSinceEpochToTime(t1), msSinceEpochToTime(t2), msSinceEpochToTime(t3));
|
||||
return QStringLiteral("%1 %2 %3").arg(msSinceEpochToTime(t1), msSinceEpochToTime(t2), msSinceEpochToTime(t3));
|
||||
}
|
||||
|
||||
QString SituationLog::toQString(
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace BlackMisc
|
||||
default: break;
|
||||
}
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index");
|
||||
return QString("Wrong index for %1").arg(i);
|
||||
return QStringLiteral("Wrong index for %1").arg(i);
|
||||
}
|
||||
|
||||
void CInterpolationAndRenderingSetupBase::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
|
||||
@@ -22,8 +22,7 @@ namespace BlackMisc
|
||||
QString CModelSettings::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
static const QString ms("Allow exclude: %1");
|
||||
return ms.arg(boolToYesNo(this->m_allowExcludeModels));
|
||||
return QStringLiteral("Allow exclude: %1").arg(boolToYesNo(this->m_allowExcludeModels));
|
||||
}
|
||||
|
||||
CVariant CModelSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
|
||||
@@ -466,8 +466,7 @@ namespace BlackMisc
|
||||
if (!icaoNw.hasDesignator()) { return QStringLiteral("[x] no nw."); }
|
||||
if (icao.isDbEqual(icaoNw) || icao == icaoNw) { return u"[==] " % icao.getDesignatorDbKey(); }
|
||||
if (icao.getDesignator() == icaoNw.getDesignator()) { return u"[=] " % icao.getDesignator(); }
|
||||
static const QString diff("%1 -> %2");
|
||||
return diff.arg(icaoNw.getDesignator(), icao.getDesignator());
|
||||
return QStringLiteral("%1 -> %2").arg(icaoNw.getDesignator(), icao.getDesignator());
|
||||
}
|
||||
|
||||
QString CSimulatedAircraft::getNetworkModelAirlineIcaoDifference() const
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackMisc
|
||||
QString CSimulatorPluginInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return QString("%1 (%2)").arg(m_name, m_identifier);
|
||||
return QStringLiteral("%1 (%2)").arg(m_name, m_identifier);
|
||||
}
|
||||
|
||||
const QString &CSimulatorPluginInfo::fsxPluginIdentifier()
|
||||
|
||||
@@ -51,9 +51,9 @@ namespace BlackMisc
|
||||
// from WGS is slow, so static const (only 1 time init)
|
||||
// https://dev.vatsim-germany.org/issues/322#note-2
|
||||
static const CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", CAltitude(index, CLengthUnit::ft()));
|
||||
const QString cs = QString("%1_TWR").arg(index);
|
||||
const QString usr = QString("Joe %1").arg(index);
|
||||
const QString id = QString("00000%1").arg(index).right(6);
|
||||
const QString cs = QStringLiteral("%1_TWR").arg(index);
|
||||
const QString usr = QStringLiteral("Joe %1").arg(index);
|
||||
const QString id = QStringLiteral("00000%1").arg(index).right(6);
|
||||
const double f = 118.0 + (index % 30) * 0.25;
|
||||
|
||||
const QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
@@ -114,7 +114,7 @@ namespace BlackMisc
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
const char cc = 65 + (i % 26);
|
||||
const QString icao = QString("EXX%1").arg(QLatin1Char(cc));
|
||||
const QString icao = QStringLiteral("EXX%1").arg(QLatin1Char(cc));
|
||||
CAirport a(icao);
|
||||
a.setPosition(CCoordinateGeodetic(i, i, i));
|
||||
list.push_back(a);
|
||||
@@ -127,14 +127,14 @@ namespace BlackMisc
|
||||
CClientList list;
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
const CCallsign cs(QString("DXX%1").arg(i));
|
||||
const QString rn = QString("Joe Doe%1").arg(i);
|
||||
const CCallsign cs(QStringLiteral("DXX%1").arg(i));
|
||||
const QString rn = QStringLiteral("Joe Doe%1").arg(i);
|
||||
CUser user(QString::number(i), rn, cs);
|
||||
user.setCallsign(cs);
|
||||
CClient client(user);
|
||||
client.addCapability(CClient::FsdWithInterimPositions);
|
||||
client.addCapability(CClient::FsdWithIcaoCodes);
|
||||
const QString myFooModel = QString("fooModel %1").arg(i);
|
||||
const QString myFooModel = QStringLiteral("fooModel %1").arg(i);
|
||||
client.setQueriedModelString(myFooModel);
|
||||
list.push_back(client);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,7 @@ namespace BlackMisc
|
||||
|
||||
const QString CThreadUtils::threadToString(const void *t)
|
||||
{
|
||||
static const QString s("0x%1");
|
||||
return s.arg(reinterpret_cast<long long>(t), 0, 16);
|
||||
return QStringLiteral("0x%1").arg(reinterpret_cast<long long>(t), 0, 16);
|
||||
}
|
||||
|
||||
const QString CThreadUtils::threadInfo(QThread *thread)
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace BlackMisc
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
return CVariant::fromValue(m);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ namespace BlackMisc
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
}
|
||||
|
||||
@@ -302,8 +302,7 @@ namespace BlackMisc
|
||||
|
||||
QString ITimestampWithOffsetBased::getTimeOffsetWithUnit() const
|
||||
{
|
||||
static const QString os("%1ms");
|
||||
return os.arg(this->getTimeOffsetMs());
|
||||
return QStringLiteral("%1ms").arg(this->getTimeOffsetMs());
|
||||
}
|
||||
|
||||
CVariant ITimestampWithOffsetBased::propertyByIndex(const CPropertyIndex &index) const
|
||||
@@ -320,7 +319,7 @@ namespace BlackMisc
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
return CVariant();
|
||||
}
|
||||
@@ -339,7 +338,7 @@ namespace BlackMisc
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
}
|
||||
|
||||
@@ -357,7 +356,7 @@ namespace BlackMisc
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
const QString m = QString("Cannot handle index %1").arg(index.toQString());
|
||||
const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString());
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
void reset() { min = -1; max = -1; mean = -1;}
|
||||
|
||||
//! As string
|
||||
QString asString() const { static const QString s("Min: %1ms Max: %2ms Mean: %3ms"); return s.arg(min).arg(max).arg(mean, 0, 'f', 2); }
|
||||
QString asString() const { return QStringLiteral("Min: %1ms Max: %2ms Mean: %3ms").arg(min).arg(max).arg(mean, 0, 'f', 2); }
|
||||
};
|
||||
|
||||
//! List of objects with timestamp.
|
||||
|
||||
@@ -548,7 +548,7 @@ namespace BlackMisc
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
QString hr = m_humanReadable.value(key);
|
||||
return hr.isEmpty() ? key : QString("%1 (%2)").arg(hr, key);
|
||||
return hr.isEmpty() ? key : QStringLiteral("%1 (%2)").arg(hr, key);
|
||||
}
|
||||
|
||||
void CValueCache::setHumanReadableName(const QString &key, const QString &name)
|
||||
@@ -613,7 +613,7 @@ namespace BlackMisc
|
||||
{}
|
||||
const QString m_key;
|
||||
const QString m_name;
|
||||
const QString m_nameWithKey = m_name.isEmpty() ? m_key : QString("%1 (%2)").arg(m_name, m_key);
|
||||
const QString m_nameWithKey = m_name.isEmpty() ? m_key : QStringLiteral("%1 (%2)").arg(m_name, m_key);
|
||||
LockFree<CVariant> m_value;
|
||||
std::atomic<qint64> m_timestamp { 0 };
|
||||
const int m_metaType = QMetaType::UnknownType;
|
||||
@@ -838,7 +838,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (! value.isValid())
|
||||
{
|
||||
return CStatusMessage(this, invalidSeverity, QString("Empty cache value %1").arg(element.m_nameWithKey), true);
|
||||
return CStatusMessage(this, invalidSeverity, QStringLiteral("Empty cache value %1").arg(element.m_nameWithKey), true);
|
||||
}
|
||||
else if (value.userType() != element.m_metaType)
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace BlackMisc
|
||||
{ Overcast, "overcast" }
|
||||
};
|
||||
|
||||
return QString("%1 from %2 to %3").arg(hash.value(getCoverage()), m_base.toQString(), m_top.toQString());
|
||||
return QStringLiteral("%1 from %2 to %3").arg(hash.value(getCoverage()), m_base.toQString(), m_top.toQString());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -130,20 +130,20 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
const QString metarDescription =
|
||||
QString("Station: %1 \n").arg(m_airport.getIcaoCode())
|
||||
% QString("Date/Time: %1 %2 UTC\n").arg(m_reportDay).arg(m_reportTime.formattedHrsMin())
|
||||
QStringLiteral("Station: %1 \n").arg(m_airport.getIcaoCode())
|
||||
% QStringLiteral("Date/Time: %1 %2 UTC\n").arg(m_reportDay).arg(m_reportTime.formattedHrsMin())
|
||||
% m_windLayer.toQString()
|
||||
% u'\n'
|
||||
% QString("Visibility: %1\n").arg(m_visibility.toQString())
|
||||
% QStringLiteral("Visibility: %1\n").arg(m_visibility.toQString())
|
||||
% u"Weather: "
|
||||
% presentWeathers.simplified()
|
||||
% u'\n'
|
||||
% u"Clouds:"
|
||||
% clouds
|
||||
% u'\n'
|
||||
% QString("Temperature: %1\n").arg(m_temperature.toQString())
|
||||
% QString("Dewpoint: %1\n").arg(m_dewPoint.toQString())
|
||||
% QString("Altimeter: %1\n").arg(m_altimeter.toQString());
|
||||
% QStringLiteral("Temperature: %1\n").arg(m_temperature.toQString())
|
||||
% QStringLiteral("Dewpoint: %1\n").arg(m_dewPoint.toQString())
|
||||
% QStringLiteral("Altimeter: %1\n").arg(m_altimeter.toQString());
|
||||
|
||||
return metarDescription;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BlackMisc
|
||||
|
||||
QString CTemperatureLayer::convertToQString(bool /** i18n **/) const
|
||||
{
|
||||
return QString("%1 %2 at %3").arg(m_temperature.toQString(), QString::number(m_relativeHumidity), m_level.toQString());
|
||||
return QStringLiteral("%1 %2 at %3").arg(m_temperature.toQString(), QString::number(m_relativeHumidity), m_level.toQString());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
||||
|
||||
QString CVisibilityLayer::convertToQString(bool /** i18n **/) const
|
||||
{
|
||||
QString visibilityAsString = QString("Visibility: %1 from %2 to %3");
|
||||
QString visibilityAsString = QStringLiteral("Visibility: %1 from %2 to %3");
|
||||
visibilityAsString = visibilityAsString.arg(m_visibility.toQString(), m_base.toQString(), m_top.toQString());
|
||||
return visibilityAsString;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackMisc
|
||||
QString CWeatherDataPluginInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return QString("%1 (%2)").arg(m_name, m_identifier);
|
||||
return QStringLiteral("%1 (%2)").arg(m_name, m_identifier);
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -76,15 +76,15 @@ namespace BlackMisc
|
||||
{
|
||||
QString windAsString = QString("Wind: ");
|
||||
if (m_directionVariable) windAsString += "variable ";
|
||||
else windAsString += QString("%1 ").arg(m_directionMain.toQString());
|
||||
else windAsString += QStringLiteral("%1 ").arg(m_directionMain.toQString());
|
||||
|
||||
if (m_directionFrom != CAngle() && m_directionTo != CAngle())
|
||||
{
|
||||
windAsString += QString("variable between %1 and %2 ").arg(m_directionFrom.toQString(), m_directionTo.toQString());
|
||||
windAsString += QStringLiteral("variable between %1 and %2 ").arg(m_directionFrom.toQString(), m_directionTo.toQString());
|
||||
}
|
||||
|
||||
windAsString += QString("at %2").arg(m_speed.toQString());
|
||||
if (m_gustSpeed.value() > 0.5) windAsString += QString(" and gusts at %1").arg(m_gustSpeed.toQString());
|
||||
windAsString += QStringLiteral("at %2").arg(m_speed.toQString());
|
||||
if (m_gustSpeed.value() > 0.5) windAsString += QStringLiteral(" and gusts at %1").arg(m_gustSpeed.toQString());
|
||||
return windAsString;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackMisc
|
||||
{
|
||||
constexpr int fieldWidth = 4;
|
||||
constexpr int base = 16;
|
||||
QString subBlockNameBuffer = QString("\\StringFileInfo\\%1%2\\%3")
|
||||
QString subBlockNameBuffer = QStringLiteral("\\StringFileInfo\\%1%2\\%3")
|
||||
.arg(codePage.wLanguage, fieldWidth, base, QLatin1Char('0'))
|
||||
.arg(codePage.wCodePage, fieldWidth, base, QLatin1Char('0'))
|
||||
.arg(stringName);
|
||||
@@ -62,7 +62,7 @@ namespace BlackMisc
|
||||
const QFile dllQFile(dllFile);
|
||||
if (!dllQFile.exists())
|
||||
{
|
||||
result.errorMsg = QString("No file '%1'").arg(dllFile);
|
||||
result.errorMsg = QStringLiteral("No file '%1'").arg(dllFile);
|
||||
return result;
|
||||
}
|
||||
const QString dll(QDir::toNativeSeparators(dllFile));
|
||||
@@ -79,27 +79,27 @@ namespace BlackMisc
|
||||
dwSize = GetFileVersionInfoSize(pszFilePath, nullptr);
|
||||
if (dwSize == 0)
|
||||
{
|
||||
result.errorMsg = QString("Error in GetFileVersionInfoSize: %1\n").arg(GetLastError());
|
||||
result.errorMsg = QStringLiteral("Error in GetFileVersionInfoSize: %1\n").arg(GetLastError());
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<BYTE> pbVersionInfo(dwSize);
|
||||
if (!GetFileVersionInfo(pszFilePath, 0, dwSize, pbVersionInfo.data()))
|
||||
{
|
||||
result.errorMsg = QString("Error in GetFileVersionInfo: %1\n").arg(GetLastError());
|
||||
result.errorMsg = QStringLiteral("Error in GetFileVersionInfo: %1\n").arg(GetLastError());
|
||||
return result;
|
||||
}
|
||||
|
||||
// Language independent version of VerQueryValue
|
||||
if (!VerQueryValue(pbVersionInfo.data(), TEXT("\\"), reinterpret_cast<LPVOID *>(&pFileInfo), &puLenFileInfo))
|
||||
{
|
||||
result.errorMsg = QString("Error in VerQueryValue: %1\n").arg(GetLastError());
|
||||
result.errorMsg = QStringLiteral("Error in VerQueryValue: %1\n").arg(GetLastError());
|
||||
return result;
|
||||
}
|
||||
|
||||
// pFileInfo->dwFileVersionMS is usually zero.
|
||||
// However, you should check this if your version numbers seem to be wrong
|
||||
result.fileVersion = QString("%1.%2.%3.%4")
|
||||
result.fileVersion = QStringLiteral("%1.%2.%3.%4")
|
||||
.arg((pFileInfo->dwFileVersionMS >> 16) & 0xffff)
|
||||
.arg((pFileInfo->dwFileVersionMS >> 0) & 0xffff)
|
||||
.arg((pFileInfo->dwFileVersionLS >> 16) & 0xffff)
|
||||
@@ -107,7 +107,7 @@ namespace BlackMisc
|
||||
|
||||
// pFileInfo->dwProductVersionMS is usually zero. However, you should check
|
||||
// this if your version numbers seem to be wrong
|
||||
result.productVersion = QString("%1.%2.%3.%4")
|
||||
result.productVersion = QStringLiteral("%1.%2.%3.%4")
|
||||
.arg((pFileInfo->dwProductVersionMS >> 16) & 0xffff)
|
||||
.arg((pFileInfo->dwProductVersionMS >> 0) & 0xffff)
|
||||
.arg((pFileInfo->dwProductVersionLS >> 16) & 0xffff)
|
||||
|
||||
Reference in New Issue
Block a user