mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
When calling arg() on a QString constructed from a literal, use QStringLiteral.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user