refactor: Fix readability-static-accessed-through-instance warnings

This commit is contained in:
Lars Toenning
2025-10-25 22:21:29 +02:00
parent 5eafb1282d
commit 469d9b8421
28 changed files with 59 additions and 55 deletions

View File

@@ -206,7 +206,7 @@ namespace swift::misc
CApplicationInfo::Application CApplicationInfo::guessApplication()
{
const QString a(QCoreApplication::instance()->applicationName().toLower());
const QString a(QCoreApplication::applicationName().toLower());
if (a.contains("test")) { return CApplicationInfo::UnitTest; } // names like testcore
if (a.contains("sample")) { return CApplicationInfo::Sample; }
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }

View File

@@ -122,7 +122,7 @@ namespace swift::misc::aviation
{
// actually we would expect all DB data to be valid, however right now
// we only check special cases
if (this->getDesignator() == this->getUnassignedDesignator()) { return msg; } // DB ZZZZ
if (this->getDesignator() == getUnassignedDesignator()) { return msg; } // DB ZZZZ
}
if (!hasKnownDesignator())

View File

@@ -128,13 +128,12 @@ namespace swift::misc::aviation
m_isParsed = true;
if (m_remarks.isEmpty()) { return; }
const QString remarks = m_remarks.toUpper();
const QString callsign =
CCallsign::unifyCallsign(this->getRemark(remarks, "REG/")); // registration is a callsign
const QString callsign = CCallsign::unifyCallsign(getRemark(remarks, "REG/")); // registration is a callsign
if (CCallsign::isValidAircraftCallsign(callsign)) { m_registration = CCallsign(callsign, CCallsign::Aircraft); }
m_voiceCapabilities = m_voiceCapabilities.isUnknown() ? CVoiceCapabilities(m_remarks) : m_voiceCapabilities;
m_flightOperator =
this->getRemark(remarks, "OPR/"); // operator, e.g. British airways, sometimes people use ICAO code here
m_selcalCode = CSelcal(this->getRemark(remarks, "SEL/"));
getRemark(remarks, "OPR/"); // operator, e.g. British airways, sometimes people use ICAO code here
m_selcalCode = CSelcal(getRemark(remarks, "SEL/"));
m_radioTelephony = getRemark(remarks, "CALLSIGN/"); // used similar to radio telephony
if (m_radioTelephony.isEmpty()) { m_radioTelephony = getRemark(remarks, "RT/"); }
if (!m_flightOperator.isEmpty() && CAirlineIcaoCode::isValidAirlineDesignator(m_flightOperator))

View File

@@ -262,7 +262,7 @@ namespace swift::misc
m_revisionFileName(revisionFileName)
{}
const QString &CDataCacheSerializer::persistentStore() const { return m_cache->persistentStore(); }
const QString &CDataCacheSerializer::persistentStore() const { return CDataCache::persistentStore(); }
void CDataCacheSerializer::saveToStore(const swift::misc::CVariantMap &values,
const swift::misc::CValueCachePacket &baseline)

View File

@@ -211,12 +211,12 @@ namespace swift::misc
if (ok)
{
CLogMessage(this).info(u"Adding '%1' to the new connection '%2'")
<< key << this->getDBusInterfaceFromClassInfo(i.value());
<< key << getDBusInterfaceFromClassInfo(i.value());
}
else
{
CLogMessage(this).info(u"Adding '%1' failed, connection '%2', error '%3'")
<< key << this->getDBusInterfaceFromClassInfo(i.value()) << connection.lastError().message();
<< key << getDBusInterfaceFromClassInfo(i.value()) << connection.lastError().message();
success = false;
}
}

View File

@@ -132,6 +132,7 @@ namespace swift::misc::simulation
QJsonObject CAircraftModel::toMemoizedJson(MemoHelper::CMemoizer &helper) const
{
QJsonObject json;
// NOLINTBEGIN(readability-static-accessed-through-instance)
introspect<CAircraftModel>().forEachMember([&, this](auto member) {
if constexpr (!decltype(member)::has(MetaFlags<DisabledForJson>()))
{
@@ -139,11 +140,13 @@ namespace swift::misc::simulation
json << std::make_pair(CExplicitLatin1String(member.latin1Name()), std::cref(maybeMemo));
}
});
// NOLINTEND(readability-static-accessed-through-instance)
return json;
}
void CAircraftModel::convertFromMemoizedJson(const QJsonObject &json, const MemoHelper::CUnmemoizer &helper)
{
// NOLINTBEGIN(readability-static-accessed-through-instance)
introspect<CAircraftModel>().forEachMember([&, this](auto member) {
if constexpr (!decltype(member)::has(MetaFlags<DisabledForJson>()))
{
@@ -151,6 +154,7 @@ namespace swift::misc::simulation
if (it != json.end()) { it.value() >> helper.maybeUnmemoize(member.in(*this)).get(); }
}
});
// NOLINTEND(readability-static-accessed-through-instance)
}
QString CAircraftModel::asHtmlSummary(const QString &separator) const