mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Fix clang-tidy and clazy warnings
This commit is contained in:
@@ -303,14 +303,14 @@ namespace BlackMisc
|
||||
return n;
|
||||
}
|
||||
|
||||
const QString CAircraftMatcherSetup::forceToString(ForceMode force)
|
||||
QString CAircraftMatcherSetup::forceToString(ForceMode force)
|
||||
{
|
||||
if (force.testFlag(ForceNothing)) { return QStringLiteral("nothing"); }
|
||||
|
||||
QStringList forces;
|
||||
if (force.testFlag(ForceType)) { forces << forceToString(ForceType); }
|
||||
if (force.testFlag(ForceEnginecount)) { forces << forceToString(ForceEnginecount); }
|
||||
if (force.testFlag(ForceEngine)) { forces << forceToString(ForceEngine); }
|
||||
if (force.testFlag(ForceType)) { forces << forceFlagToString(ForceType); }
|
||||
if (force.testFlag(ForceEnginecount)) { forces << forceFlagToString(ForceEnginecount); }
|
||||
if (force.testFlag(ForceEngine)) { forces << forceFlagToString(ForceEngine); }
|
||||
return forces.join(", ");
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace BlackMisc
|
||||
static const QString &forceFlagToString(ForceModeFlag forceFlag);
|
||||
|
||||
//! Force to string
|
||||
static const QString forceToString(ForceMode force);
|
||||
static QString forceToString(ForceMode force);
|
||||
|
||||
//! Strategy to string
|
||||
static const QString &strategyToString(PickSimilarStrategy strategy);
|
||||
|
||||
@@ -781,7 +781,7 @@ namespace BlackMisc
|
||||
|
||||
QString CAircraftModel::getFileDirectoryPath() const
|
||||
{
|
||||
if (!this->hasFileName()) { return QStringLiteral(""); }
|
||||
if (!this->hasFileName()) { return {}; }
|
||||
return this->getFileDirectory().absolutePath();
|
||||
}
|
||||
|
||||
|
||||
@@ -651,7 +651,7 @@ namespace BlackMisc
|
||||
CAirlineIcaoCode CAircraftModelList::getAirlineWithMaxCount() const
|
||||
{
|
||||
const QMap<CAirlineIcaoCode, int> ac = this->countPerAirlineIcao();
|
||||
if (ac.size() < 1) { return {}; }
|
||||
if (ac.isEmpty()) { return {}; }
|
||||
if (ac.size() == 1) { return ac.firstKey(); }
|
||||
const QList<int> values = ac.values();
|
||||
const int max = *std::max_element(values.begin(), values.end());
|
||||
@@ -1641,7 +1641,7 @@ namespace BlackMisc
|
||||
return msgs;
|
||||
}
|
||||
|
||||
CStatusMessageList CAircraftModelList::validateUncFiles(const QSet<QString> uncFiles) const
|
||||
CStatusMessageList CAircraftModelList::validateUncFiles(const QSet<QString> &uncFiles) const
|
||||
{
|
||||
// check if UNC paths can be reached
|
||||
CStatusMessageList msgs;
|
||||
|
||||
@@ -567,7 +567,7 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
//! Validate UNC paths (Windows)
|
||||
CStatusMessageList validateUncFiles(const QSet<QString> uncFiles) const;
|
||||
CStatusMessageList validateUncFiles(const QSet<QString> &uncFiles) const;
|
||||
};
|
||||
|
||||
//! Model per callsign
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackMisc
|
||||
this->setDbKey(unifyKeyOrAlias(id));
|
||||
}
|
||||
|
||||
const QString CDistributor::getIdAndDescription() const
|
||||
QString CDistributor::getIdAndDescription() const
|
||||
{
|
||||
if (!this->getDbKey().isEmpty() && !this->getDescription().isEmpty())
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace BlackMisc
|
||||
const QString &getDescription() const { return m_description;}
|
||||
|
||||
//! Get id and description
|
||||
const QString getIdAndDescription() const;
|
||||
QString getIdAndDescription() const;
|
||||
|
||||
//! Set description
|
||||
void setDescription(const QString &description) { m_description = description.trimmed(); }
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace BlackMisc
|
||||
if (!correctPath) { continue; }
|
||||
|
||||
// absolute or relative path
|
||||
const QString fp = pathValue.left(3).contains(':') ?
|
||||
const QString fp = pathValue.leftRef(3).contains(':') ?
|
||||
pathValue :
|
||||
CFileUtils::appendFilePaths(addOnPath, pathValue);
|
||||
if (CFsDirectories::logConfigPathReading()) { CLogMessage(static_cast<CFsDirectories *>(nullptr)).info(u"Testing '%1' as addon path: '%2'") << fp << addOnPath; }
|
||||
@@ -562,7 +562,7 @@ namespace BlackMisc
|
||||
if (containsAny(soPath, CFsDirectories::fsxSimObjectsExcludeDirectoryPatterns(), Qt::CaseInsensitive)) { continue; }
|
||||
|
||||
// make absolute
|
||||
if (!soPath.left(3).contains(':')) { soPath = CFileUtils::appendFilePaths(relPath, soPath); }
|
||||
if (!soPath.leftRef(3).contains(':')) { soPath = CFileUtils::appendFilePaths(relPath, soPath); }
|
||||
|
||||
const QDir dir(soPath); // always absolute path now
|
||||
if (checked && !dir.exists())
|
||||
@@ -585,7 +585,7 @@ namespace BlackMisc
|
||||
return paths;
|
||||
}
|
||||
|
||||
const QString CFsDirectories::airFileFilter()
|
||||
const QString &CFsDirectories::airFileFilter()
|
||||
{
|
||||
static const QString a("*.air");
|
||||
return a;
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace BlackMisc
|
||||
static QSet<QString> fsxSimObjectsPaths(const QString &fsxFile, bool checked);
|
||||
|
||||
//! .air file filter
|
||||
static const QString airFileFilter();
|
||||
static const QString &airFileFilter();
|
||||
|
||||
private:
|
||||
//! Utility functions
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BlackMisc
|
||||
m_typeCode(typeCode.trimmed().toUpper()), m_callsignPrefix(callsignPrefix.trimmed().toUpper()), m_updatedMsSinceEpoch(updated)
|
||||
{ }
|
||||
|
||||
const QString CVPilotModelRule::getDistributor() const
|
||||
QString CVPilotModelRule::getDistributor() const
|
||||
{
|
||||
QString f(this->getFolder().toUpper().simplified());
|
||||
f.replace(" ", "");
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace BlackMisc
|
||||
const QString &getFolder() const { return this->m_folder;}
|
||||
|
||||
//! Distributor derived from folder (hardcoded)
|
||||
const QString getDistributor() const;
|
||||
QString getDistributor() const;
|
||||
|
||||
//! Get type code
|
||||
const QString &getTypeCode() const { return this->m_typeCode;}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace BlackMisc
|
||||
QSet<QString> removeSet(knownModels.begin(), knownModels.end());
|
||||
removeSet &= QSet<QString>(remove.begin(), remove.end());
|
||||
int c = 0;
|
||||
for (const QString &model : removeSet)
|
||||
for (const QString &model : std::as_const(removeSet))
|
||||
{
|
||||
c += this->removeIf(&CVPilotModelRule::getModelName, model);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Log flag to string
|
||||
const QString matchingLogToString(MatchingLog log)
|
||||
QString matchingLogToString(MatchingLog log)
|
||||
{
|
||||
if (log == MatchingLogNothing) { return matchingLogFlagToString(MatchingLogNothing); }
|
||||
QStringList l;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
Q_DECLARE_FLAGS(MatchingLog, MatchingLogFlag)
|
||||
|
||||
//! Log flag to string
|
||||
BLACKMISC_EXPORT const QString matchingLogToString(MatchingLog log);
|
||||
BLACKMISC_EXPORT QString matchingLogToString(MatchingLog log);
|
||||
|
||||
//! Log flag to string
|
||||
BLACKMISC_EXPORT const QString &matchingLogFlagToString(MatchingLogFlag logFlag);
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace BlackMisc
|
||||
namespace Simulation
|
||||
{
|
||||
MSInOutValues::MSInOutValues(const CCallsign &cs,
|
||||
const CAircraftIcaoCode aircraftIcao,
|
||||
const CAirlineIcaoCode airlineIcao,
|
||||
const CAircraftIcaoCode &aircraftIcao,
|
||||
const CAirlineIcaoCode &airlineIcao,
|
||||
const QString &livery, int liveryId) :
|
||||
MSInOutValues(cs.asString(), cs.getStringAsSet(), cs.getFlightNumber(),
|
||||
aircraftIcao.getDesignator(), aircraftIcao.getFamily(), aircraftIcao.getCombinedType(), aircraftIcao.getDbKey(),
|
||||
@@ -26,8 +26,8 @@ namespace BlackMisc
|
||||
{ }
|
||||
|
||||
MSInOutValues::MSInOutValues(const CCallsign &cs,
|
||||
const CAircraftIcaoCode aircraftIcao,
|
||||
const CLivery livery) :
|
||||
const CAircraftIcaoCode &aircraftIcao,
|
||||
const CLivery &livery) :
|
||||
MSInOutValues(cs,
|
||||
aircraftIcao,
|
||||
livery.getAirlineIcaoCode(),
|
||||
|
||||
@@ -80,14 +80,14 @@ namespace BlackMisc
|
||||
|
||||
//! Ctor
|
||||
MSInOutValues(const BlackMisc::Aviation::CCallsign &cs,
|
||||
const BlackMisc::Aviation::CAircraftIcaoCode aircraftIcao,
|
||||
const BlackMisc::Aviation::CAirlineIcaoCode airlineIcao,
|
||||
const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcao,
|
||||
const BlackMisc::Aviation::CAirlineIcaoCode &airlineIcao,
|
||||
const QString &livery, int liveryId);
|
||||
|
||||
//! Ctor
|
||||
MSInOutValues(const BlackMisc::Aviation::CCallsign &cs,
|
||||
const BlackMisc::Aviation::CAircraftIcaoCode aircraftIcao,
|
||||
const BlackMisc::Aviation::CLivery livery);
|
||||
const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcao,
|
||||
const BlackMisc::Aviation::CLivery &livery);
|
||||
|
||||
//! Ctor
|
||||
MSInOutValues(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
@@ -1176,7 +1176,7 @@ namespace BlackMisc
|
||||
// but to make sure we do the search
|
||||
const qint64 ts = partsList.latestTimestampMsecsSinceEpoch() - MaxPartsAgePerCallsignSecs * 1000;
|
||||
partsList.removeBefore(ts);
|
||||
Q_ASSERT_X(partsList.size() >= 1, Q_FUNC_INFO, "Need at least 1 value");
|
||||
Q_ASSERT_X(!partsList.isEmpty(), Q_FUNC_INFO, "Need at least 1 value");
|
||||
}
|
||||
|
||||
const CCallsign &IRemoteAircraftProvider::testAltitudeOffsetCallsign()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2016
|
||||
/* Copyright (C) 2016
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
@@ -734,7 +734,7 @@ namespace BlackMisc
|
||||
return empty;
|
||||
}
|
||||
|
||||
const QString CXPlaneSimulatorSettings::getPluginDirOrDefault() const
|
||||
QString CXPlaneSimulatorSettings::getPluginDirOrDefault() const
|
||||
{
|
||||
return CFileUtils::appendFilePathsAndFixUnc(this->getSimulatorDirectoryOrDefault(), CXPlaneUtil::xplanePluginPathName());
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace BlackMisc
|
||||
{}
|
||||
|
||||
//! Plugin directory or default plugin dir
|
||||
const QString getPluginDirOrDefault() const;
|
||||
QString getPluginDirOrDefault() const;
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace BlackMisc
|
||||
return this->getModel().hasAircraftAndAirlineDesignator();
|
||||
}
|
||||
|
||||
const CComSystem CSimulatedAircraft::getComSystem(CComSystem::ComUnit unit) const
|
||||
CComSystem CSimulatedAircraft::getComSystem(CComSystem::ComUnit unit) const
|
||||
{
|
||||
switch (unit)
|
||||
{
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace BlackMisc
|
||||
const Aviation::CComSystem &getCom2System() const { return m_com2system; }
|
||||
|
||||
//! Get COM unit
|
||||
const Aviation::CComSystem getComSystem(Aviation::CComSystem::ComUnit unit) const;
|
||||
Aviation::CComSystem getComSystem(Aviation::CComSystem::ComUnit unit) const;
|
||||
|
||||
//! Set COM unit
|
||||
void setComSystem(const Aviation::CComSystem &com, Aviation::CComSystem::ComUnit unit);
|
||||
|
||||
@@ -59,10 +59,10 @@ namespace BlackMisc
|
||||
CAircraftModelList getModels() const;
|
||||
|
||||
//! Enabled / disabled aircraft
|
||||
CSimulatedAircraftList findByEnabled(bool enabled) const;
|
||||
Q_REQUIRED_RESULT CSimulatedAircraftList findByEnabled(bool enabled) const;
|
||||
|
||||
//! Rendered / not rendered aircraft
|
||||
CSimulatedAircraftList findByRendered(bool rendered) const;
|
||||
Q_REQUIRED_RESULT CSimulatedAircraftList findByRendered(bool rendered) const;
|
||||
|
||||
//! VTOL / non VTOL aircraft
|
||||
CSimulatedAircraftList findByVtol(bool vtol) const;
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
const CSimulatorInfo CSimulatorInfo::getLocallyInstalledSimulators()
|
||||
CSimulatorInfo CSimulatorInfo::getLocallyInstalledSimulators()
|
||||
{
|
||||
CSimulatorInfo sim;
|
||||
bool fs9 = false;
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace BlackMisc
|
||||
static const CSimulatorInfo &allFsFamilySimulators();
|
||||
|
||||
//! Locally installed simulators
|
||||
static const CSimulatorInfo getLocallyInstalledSimulators();
|
||||
static CSimulatorInfo getLocallyInstalledSimulators();
|
||||
|
||||
//! Guess a default simulator based on installation
|
||||
static const CSimulatorInfo &guessDefaultSimulator();
|
||||
|
||||
Reference in New Issue
Block a user