mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
Fix cppcheck and compiler warnings
This commit is contained in:
@@ -14,8 +14,35 @@ useStlAlgorithm
|
||||
// Internal errors
|
||||
cppcheckError
|
||||
|
||||
// Ignore style issues in g2clib
|
||||
// g2clib
|
||||
variableScope:src/plugins/weatherdata/gfs/g2clib/*.c
|
||||
knownConditionTrueFalse:src/plugins/weatherdata/gfs/g2clib/*.c
|
||||
redundantAssignment:src/plugins/weatherdata/gfs/g2clib/*.c
|
||||
unreadVariable:src/plugins/weatherdata/gfs/g2clib/*.c
|
||||
invalidFunctionArg:src/plugins/weatherdata/gfs/g2clib/*.c
|
||||
|
||||
// Ignore unusedFunction as it has too many false positives (especially in tests)
|
||||
unusedFunction
|
||||
|
||||
// Conflicts with CppCoreGuidelines ES.20 Always initialize an object
|
||||
redundantInitialization
|
||||
|
||||
// Perf samples
|
||||
redundantAssignment:samples/blackmisc/samplesperformance.*
|
||||
unreadVariable:samples/blackmisc/samplesperformance.*
|
||||
|
||||
// Benign
|
||||
duplicateCondition:src/xswiftbus/libxplanemp/src/XPMPPlaneRenderer.cpp
|
||||
|
||||
// Unused file
|
||||
unknownMacro:src/xswiftbus/libxplanemp/src/BitmapUtils.cpp
|
||||
|
||||
// False positives
|
||||
returnDanglingLifetime:src/blackmisc/iterator.h
|
||||
unreadVariable:tests/blackcore/testreaders/testreaders.cpp
|
||||
unknownMacro:src/blackmisc/aviation/altitude.h
|
||||
unknownMacro:src/blackmisc/geo/elevationplane.h
|
||||
ctuArrayIndex:src/xswiftbus/libxplanemp/src/XPMPPlaneRenderer.cpp
|
||||
|
||||
// False positive memory leaks due to Qt parent/child relationship
|
||||
unsafeClassCanLeak
|
||||
|
||||
@@ -797,17 +797,6 @@ namespace BlackSample
|
||||
return set;
|
||||
}
|
||||
|
||||
const CAircraftSituationList CSamplesPerformance::situations(const CCallsignSet &callsigns)
|
||||
{
|
||||
CAircraftSituationList situations;
|
||||
for (const CCallsign &cs : callsigns)
|
||||
{
|
||||
const CAircraftSituation s(cs);
|
||||
situations.push_back(s);
|
||||
}
|
||||
return situations;
|
||||
}
|
||||
|
||||
const QMap<CCallsign, CAircraftSituation> CSamplesPerformance::situationsMap(const CCallsignSet &callsigns)
|
||||
{
|
||||
QMap<CCallsign, CAircraftSituation> situations;
|
||||
|
||||
@@ -94,9 +94,6 @@ namespace BlackSample
|
||||
//! Get n callsigns
|
||||
static BlackMisc::Aviation::CCallsignSet callsigns(int number);
|
||||
|
||||
//! Situations
|
||||
static const BlackMisc::Aviation::CAircraftSituationList situations(const BlackMisc::Aviation::CCallsignSet &callsigns);
|
||||
|
||||
//! Situations map
|
||||
static const QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituation> situationsMap(const BlackMisc::Aviation::CCallsignSet &callsigns);
|
||||
|
||||
|
||||
@@ -52,9 +52,8 @@ namespace BlackSample
|
||||
}
|
||||
|
||||
#else
|
||||
void CSamplesFsuipc::samplesFsuipc(QTextStream &streamOut)
|
||||
void CSamplesFsuipc::samplesFsuipc(QTextStream &)
|
||||
{
|
||||
Q_UNUSED(streamOut);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackSample
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
void CSamplesVPilotRules::samples(QTextStream &streamOut, QTextStream &streamIn)
|
||||
void CSamplesVPilotRules::samples(QTextStream &streamOut, const QTextStream &streamIn)
|
||||
{
|
||||
BlackMisc::registerMetadata();
|
||||
QScopedPointer<CVPilotRulesReader> vPilotReader(new CVPilotRulesReader());
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BlackSample
|
||||
{
|
||||
public:
|
||||
//! Run the samples
|
||||
static void samples(QTextStream &streamOut, QTextStream &streamIn);
|
||||
static void samples(QTextStream &streamOut, const QTextStream &streamIn);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace BlackCore
|
||||
// restart timer, normally it should be started already, paranoia
|
||||
// as I run in "my thread" starting timer should be OK
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
QMutexLocker lock2(&m_mutex);
|
||||
if (m_voiceServerTimer) { m_voiceServerTimer->start(PositionUpdatesMs); }
|
||||
}
|
||||
m_retryConnectAttempt = 0;
|
||||
@@ -498,21 +498,21 @@ namespace BlackCore
|
||||
quint32 roundedFrequencyHz = static_cast<quint32>(qRound(frequencyHz / 1000.0)) * 1000;
|
||||
roundedFrequencyHz = this->getAliasFrequencyHz(roundedFrequencyHz);
|
||||
|
||||
bool updateTransceivers = false;
|
||||
bool update = false;
|
||||
{
|
||||
QMutexLocker lockTransceivers(&m_mutexTransceivers);
|
||||
if (m_transceivers.size() >= id + 1)
|
||||
{
|
||||
if (m_transceivers[id].frequencyHz != roundedFrequencyHz)
|
||||
{
|
||||
updateTransceivers = true;
|
||||
update = true;
|
||||
m_transceivers[id].frequencyHz = roundedFrequencyHz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// outside lock to avoid deadlock
|
||||
if (updateTransceivers)
|
||||
if (update)
|
||||
{
|
||||
this->updateTransceivers(false); // no frequency update
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BlackCore
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
// posted in QAM thread, reply is nullptr if called from another thread
|
||||
QNetworkReply *reply = sApp->postToNetwork(request, CApplication::NoLogRequestId, QJsonDocument(obj).toJson(),
|
||||
sApp->postToNetwork(request, CApplication::NoLogRequestId, QJsonDocument(obj).toJson(),
|
||||
{
|
||||
this, [ = ](QNetworkReply * nwReply)
|
||||
{
|
||||
@@ -125,7 +125,6 @@ namespace BlackCore
|
||||
callback(m_isAuthenticated);
|
||||
}
|
||||
});
|
||||
Q_UNUSED(reply)
|
||||
}
|
||||
|
||||
PostCallsignResponseDto CApiServerConnection::addCallsign(const QString &callsign)
|
||||
@@ -176,7 +175,7 @@ namespace BlackCore
|
||||
QByteArray receivedData;
|
||||
|
||||
// posted in QAM thread, reply is nullptr if called from another thread
|
||||
QNetworkReply *reply = sApp->getFromNetwork(request,
|
||||
sApp->getFromNetwork(request,
|
||||
{
|
||||
this, [ =, &receivedData ](QNetworkReply * nwReply)
|
||||
{
|
||||
@@ -198,7 +197,6 @@ namespace BlackCore
|
||||
if (loop) { loop->exit(); }
|
||||
}
|
||||
});
|
||||
Q_UNUSED(reply)
|
||||
|
||||
if (loop) { loop->exec(); }
|
||||
return receivedData;
|
||||
@@ -212,7 +210,7 @@ namespace BlackCore
|
||||
QByteArray receivedData;
|
||||
|
||||
// posted in QAM thread, reply is nullptr if called from another thread
|
||||
QNetworkReply *reply = sApp->postToNetwork(request, CApplication::NoLogRequestId, data,
|
||||
sApp->postToNetwork(request, CApplication::NoLogRequestId, data,
|
||||
{
|
||||
this, [ =, &receivedData ](QNetworkReply * nwReply)
|
||||
{
|
||||
@@ -234,7 +232,6 @@ namespace BlackCore
|
||||
if (loop) { loop->exit(); }
|
||||
}
|
||||
});
|
||||
Q_UNUSED(reply)
|
||||
|
||||
if (loop) { loop->exec(); }
|
||||
return receivedData;
|
||||
|
||||
@@ -61,15 +61,15 @@ namespace BlackCore
|
||||
|
||||
if (authenticated)
|
||||
{
|
||||
const QString callsign = m_connection.getCallsign();
|
||||
m_connection.setTokens(m_apiServerConnection->addCallsign(callsign));
|
||||
const QString cs = m_connection.getCallsign();
|
||||
m_connection.setTokens(m_apiServerConnection->addCallsign(cs));
|
||||
m_connection.setTsAuthenticatedToNow();
|
||||
m_connection.createCryptoChannels();
|
||||
m_connection.setTsHeartbeatToNow();
|
||||
this->connectToVoiceServer();
|
||||
// taskServerConnectionCheck.Start();
|
||||
|
||||
CLogMessage(this).info(u"Connected: '%1' to voice server, socket open: %2") << callsign << boolToYesNo(m_udpSocket->isOpen());
|
||||
CLogMessage(this).info(u"Connected: '%1' to voice server, socket open: %2") << cs << boolToYesNo(m_udpSocket->isOpen());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace BlackCore
|
||||
headerBuffer.close();
|
||||
const quint16 headerLength = static_cast<quint16>(headerBuffer.buffer().size());
|
||||
|
||||
const QByteArray dtoNameBuffer = T::getDtoName();
|
||||
const QByteArray dtoShortName = T::getShortDtoName();
|
||||
const quint16 dtoNameLength = static_cast<quint16>(dtoShortName.size());
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ namespace BlackCore
|
||||
return rv;
|
||||
}
|
||||
|
||||
MatchingScriptReturnValues CAircraftMatcher::matchingScript(const QString &js, const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, MatchingScript ms, CStatusMessageList *log)
|
||||
MatchingScriptReturnValues CAircraftMatcher::matchingScript(const QString &js, const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, MatchingScript script, CStatusMessageList *log)
|
||||
{
|
||||
MatchingScriptReturnValues rv(inModel);
|
||||
QString logMessage;
|
||||
@@ -536,14 +536,14 @@ namespace BlackCore
|
||||
rv.runScript = true;
|
||||
|
||||
// matching script
|
||||
const bool msReverse = (ms == ReverseLookup);
|
||||
const bool msReverse = (script == ReverseLookup);
|
||||
const QString lf = msReverse ? setup.getMsReverseLookupFile() : setup.getMsMatchingStageFile();
|
||||
static const QString logFileR = CFileUtils::appendFilePaths(CDirectoryUtils::logDirectory(), "logMatchingScriptReverseLookup.log");
|
||||
static const QString logFileM = CFileUtils::appendFilePaths(CDirectoryUtils::logDirectory(), "logMatchingScriptMatchingStage.log");
|
||||
|
||||
if (log)
|
||||
{
|
||||
CLogUtilities::addLogDetailsToList(log, callsign, QStringLiteral("Matching script (%1): '%2'").arg(msToString(ms), lf));
|
||||
CLogUtilities::addLogDetailsToList(log, callsign, QStringLiteral("Matching script (%1): '%2'").arg(msToString(script), lf));
|
||||
CLogUtilities::addLogDetailsToList(log, callsign, QStringLiteral("Matching script input model (%1): '%2'").arg(inModel.toQString(true)));
|
||||
CLogUtilities::addLogDetailsToList(log, callsign, QStringLiteral("Matching script models: %1").arg(modelSet.coverageSummary()));
|
||||
}
|
||||
|
||||
@@ -1436,18 +1436,16 @@ namespace BlackCore
|
||||
bool canLikelySkipNearGround = correctedSituation.canLikelySkipNearGroundInterpolation();
|
||||
do
|
||||
{
|
||||
if (canLikelySkipNearGround || correctedSituation.hasGroundElevation()) { break; }
|
||||
|
||||
// set a defined state
|
||||
correctedSituation.resetGroundElevation();
|
||||
|
||||
// Check if we can bail out and ignore all elevation handling
|
||||
//
|
||||
// rational:
|
||||
// a) elevation handling is expensive, and might even requests elevation from sim.
|
||||
// b) elevations not needed pollute the cache with "useless" values
|
||||
//
|
||||
if (canLikelySkipNearGround) { break; }
|
||||
if (canLikelySkipNearGround || correctedSituation.hasGroundElevation()) { break; }
|
||||
|
||||
// set a defined state
|
||||
correctedSituation.resetGroundElevation();
|
||||
|
||||
// Guessing gives better values, also for smaller planes
|
||||
// and avoids unnecessary elevation fetching for low flying smaller GA aircraft
|
||||
|
||||
@@ -862,7 +862,6 @@ namespace BlackCore
|
||||
const CAircraftMatcherSetup setup = m_aircraftMatcher.getSetup();
|
||||
if (setup.doModelAddFailover())
|
||||
{
|
||||
const CCallsign cs = remoteAircraft.getCallsign();
|
||||
const int trial = m_failoverAddingCounts.value(cs, 0);
|
||||
if (trial < MaxModelAddedFailoverTrials)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BlackCore
|
||||
{
|
||||
namespace Fsd
|
||||
{
|
||||
ClientResponse::ClientResponse() : MessageBase()
|
||||
ClientResponse::ClientResponse()
|
||||
{ }
|
||||
|
||||
ClientResponse::ClientResponse(const QString &sender, const QString &receiver, ClientQueryType queryType, const QStringList &responseData)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace BlackCore
|
||||
static QString pdu() { return "$CR"; }
|
||||
|
||||
//! Properties @{
|
||||
ClientQueryType m_queryType;
|
||||
ClientQueryType m_queryType {};
|
||||
QStringList m_responseData;
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BlackCore
|
||||
{
|
||||
namespace Fsd
|
||||
{
|
||||
FlightPlan::FlightPlan() : MessageBase() { }
|
||||
FlightPlan::FlightPlan() { }
|
||||
|
||||
FlightPlan::FlightPlan(const QString &sender, const QString &receiver, FlightType flightType, const QString &aircraftIcaoType,
|
||||
int trueCruisingSpeed, const QString &depAirport, int estimatedDepTime, int actualDepTime, const QString &cruiseAlt,
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace BlackCore
|
||||
static QString pdu() { return "$FP"; }
|
||||
|
||||
//! Properties @{
|
||||
FlightType m_flightType;
|
||||
FlightType m_flightType {};
|
||||
QString m_aircraftIcaoType;
|
||||
int m_trueCruisingSpeed = 0;
|
||||
QString m_depAirport;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace BlackCore
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
RevBClientParts(const QString &sender, const QString &partsval1, const QString &partsval3, const QString &partsval2);
|
||||
RevBClientParts(const QString &sender, const QString &partsval1, const QString &partsval2, const QString &partsval3);
|
||||
|
||||
|
||||
//! Message converted to tokens
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BlackCore
|
||||
{
|
||||
namespace Fsd
|
||||
{
|
||||
ServerError::ServerError() : MessageBase()
|
||||
ServerError::ServerError()
|
||||
{ }
|
||||
|
||||
ServerError::ServerError(const QString &sender, const QString &receiver, ServerErrorCode errorCode, const QString &causingParameter, const QString &description)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackCore
|
||||
//! @}
|
||||
|
||||
//! Properties @{
|
||||
ServerErrorCode m_errorNumber;
|
||||
ServerErrorCode m_errorNumber {};
|
||||
QString m_causingParameter;
|
||||
QString m_description;
|
||||
//! @}
|
||||
|
||||
@@ -431,8 +431,8 @@ namespace BlackCore
|
||||
{
|
||||
// no issue with cache
|
||||
m_updateInfoUrls = loadedSetup.getSwiftUpdateInfoFileUrls();
|
||||
const CStatusMessage m = CLogMessage(this).info(u"Loaded setup from '%1'") << urlString;
|
||||
emit this->setupLoadingMessages(m);
|
||||
const CStatusMessage m2 = CLogMessage(this).info(u"Loaded setup from '%1'") << urlString;
|
||||
emit this->setupLoadingMessages(m2);
|
||||
CLogMessage(this).info(u"Setup: Updated data cache in '%1'") << m_setup.getFilename();
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
|
||||
@@ -49,8 +49,7 @@ namespace BlackGui
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
|
||||
ui->setupUi(this);
|
||||
this->setModeLogin(true);
|
||||
const CUrl url(sGui->getGlobalSetup().getDbHomePageUrl());
|
||||
const QString urlString = asHyperlink(url.getFullUrl());
|
||||
const QString urlString = asHyperlink(sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl());
|
||||
QString html = ui->tbr_InfoAndHints->toHtml();
|
||||
html = html.replace("##swiftDB##", urlString, Qt::CaseInsensitive);
|
||||
html = html.replace("##swiftEnableSSO##", urlString, Qt::CaseInsensitive);
|
||||
|
||||
@@ -1015,7 +1015,6 @@ namespace BlackGui
|
||||
void CFlightPlanComponent::setRemarksUIValues(const QString &remarks)
|
||||
{
|
||||
if (remarks.isEmpty()) { return; }
|
||||
const QString r = remarks.toUpper();
|
||||
|
||||
if (remarks.contains("/V"))
|
||||
{
|
||||
|
||||
@@ -310,11 +310,7 @@ namespace BlackGui
|
||||
|
||||
void CLoginAdvComponent::setGuiLoginAsValues(const CSimulatedAircraft &ownAircraft)
|
||||
{
|
||||
const QString ac(
|
||||
ownAircraft.getAircraftIcaoCodeDesignator() %
|
||||
(ownAircraft.hasAirlineDesignator() ? (u' ' % ownAircraft.getAirlineIcaoCodeDesignator()) : QString()) %
|
||||
(ownAircraft.hasModelString() ? (u' ' % ownAircraft.getModelString()) : QString())
|
||||
);
|
||||
Q_UNUSED(ownAircraft)
|
||||
}
|
||||
|
||||
CServer CLoginAdvComponent::getCurrentVatsimServer() const
|
||||
@@ -382,7 +378,6 @@ namespace BlackGui
|
||||
|
||||
// in any case override if connected
|
||||
ui->comp_OwnAircraft->setOwnModelAndIcaoValues();
|
||||
const CServer server = nwc->getConnectedServer();
|
||||
ui->comp_NetworkDetails->setLoginMode(nwc->getLoginMode());
|
||||
const CSimulatedAircraft ownAircraft = sGui->getIContextOwnAircraft()->getOwnAircraft();
|
||||
this->setGuiLoginAsValues(ownAircraft);
|
||||
|
||||
@@ -133,8 +133,8 @@ namespace BlackGui
|
||||
ui->tvp_ResultMessages->insert(m);
|
||||
return;
|
||||
}
|
||||
CSimulatorInfo simulator = models.simulatorsWithMaxEntries();
|
||||
m_matcher.setModelSet(models, simulator, true);
|
||||
CSimulatorInfo si = models.simulatorsWithMaxEntries();
|
||||
m_matcher.setModelSet(models, si, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -150,7 +150,7 @@ namespace BlackGui
|
||||
this->onSimulatorChanged(ui->comp_SimulatorSelector->getValue());
|
||||
}
|
||||
|
||||
void CModelMatcherComponent::onCacheChanged(CSimulatorInfo &simulator)
|
||||
void CModelMatcherComponent::onCacheChanged(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_UNUSED(simulator);
|
||||
this->redisplay();
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackGui
|
||||
void onWorkbenchToggled(bool checked);
|
||||
|
||||
//! Cache changed
|
||||
void onCacheChanged(BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
void onCacheChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Web data have been read
|
||||
void onWebDataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number, const QUrl &url);
|
||||
|
||||
@@ -179,8 +179,6 @@ namespace BlackGui
|
||||
void CNetworkDetailsComponent::onSelectedServerChanged(const CServer &server)
|
||||
{
|
||||
if (!m_updatePilotOnServerChanges) { return; }
|
||||
const bool vatsim = this->isVatsimServerSelected();
|
||||
const CUser user = vatsim ? this->getCurrentVatsimServer().getUser() : server.getUser();
|
||||
emit this->overridePilot(server.getUser());
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace BlackGui
|
||||
// in which North=(1,0) and East=(-1,0)
|
||||
// but we want North=(0,-1) and East=(0,1)
|
||||
// (QGraphicsView y axis increases downwards)
|
||||
qSwap(p.rx(), p.ry());
|
||||
std::swap(p.rx(), p.ry());
|
||||
p.setX(-p.x());
|
||||
p.setY(-p.y());
|
||||
return p;
|
||||
|
||||
@@ -98,7 +98,6 @@ namespace BlackGui
|
||||
const QString fontFamily = ui->cb_SettingsGuiFont->currentFont().family();
|
||||
const QString fontStyleCombined = ui->cb_SettingsGuiFontStyle->currentText();
|
||||
|
||||
const QStringList familySizeStyle = this->getFamilySizeStyle();
|
||||
QString fontColor = m_selectedColor.name();
|
||||
if (!m_selectedColor.isValid() || m_selectedColor.name().isEmpty())
|
||||
{
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace BlackGui
|
||||
else
|
||||
{
|
||||
qFatal("Wrong sender");
|
||||
// cppcheck-suppress duplicateBreak
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,6 @@ namespace BlackGui
|
||||
|
||||
CAircraftCategory CAircraftCategoryTreeView::selectedObject() const
|
||||
{
|
||||
const QModelIndex index = this->currentIndex();
|
||||
const QVariant data = this->model()->data(index.siblingAtColumn(0));
|
||||
const CAircraftCategoryTreeModel *model = this->categoryModel();
|
||||
if (!model) { return CAircraftCategory(); }
|
||||
return model->container().frontOrDefault();
|
||||
|
||||
@@ -706,10 +706,10 @@ namespace BlackGui
|
||||
int removeIf(K0 k0, V0 v0, KeysValues... keysValues)
|
||||
{
|
||||
if (this->rowCount() < 1) { return 0; }
|
||||
ContainerType copy(container());
|
||||
int r = copy.removeIf(k0, v0, keysValues...);
|
||||
ContainerType cp(container());
|
||||
int r = cp.removeIf(k0, v0, keysValues...);
|
||||
if (r < 1) { return 0; }
|
||||
this->updateContainerMaybeAsync(copy);
|
||||
this->updateContainerMaybeAsync(cp);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -717,9 +717,9 @@ namespace BlackGui
|
||||
template <class K1, class V1>
|
||||
void replaceOrAdd(K1 key1, V1 value1, const ObjectType &replacement)
|
||||
{
|
||||
ContainerType copy(container());
|
||||
copy.replaceOrAdd(key1, value1, replacement);
|
||||
this->updateContainerMaybeAsync(copy);
|
||||
ContainerType cp(container());
|
||||
cp.replaceOrAdd(key1, value1, replacement);
|
||||
this->updateContainerMaybeAsync(cp);
|
||||
}
|
||||
|
||||
//! \name Slot overrides from base class
|
||||
|
||||
@@ -112,6 +112,7 @@ namespace BlackInput
|
||||
|
||||
bool CKeyboardWindows::init()
|
||||
{
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (useWindowsHook)
|
||||
{
|
||||
Q_ASSERT_X(g_keyboardWindows == nullptr, "CKeyboardWindows::init", "Windows supports only one keyboard instance. Cannot initialize a second one!");
|
||||
|
||||
@@ -175,6 +175,7 @@ namespace BlackMisc
|
||||
static_cast<void>(std::initializer_list<int>
|
||||
{
|
||||
//! \fixme C-style cast is needed due to a clang bug: https://bugs.llvm.org/show_bug.cgi?id=39375
|
||||
// cppcheck-suppress accessForwarded
|
||||
((void)(std::forward<F>(visitor)(std::get<Is * 2>(std::forward<T>(tuple)), std::get<Is * 2 + 1>(std::forward<T>(tuple)))), 0)...
|
||||
});
|
||||
}
|
||||
|
||||
@@ -495,11 +495,10 @@ namespace BlackMisc
|
||||
QSet<int> ids;
|
||||
dir.setFilter(QDir::Files | QDir::NoSymLinks);
|
||||
dir.setSorting(QDir::Name);
|
||||
bool ok = false;
|
||||
for (const QFileInfo &fileInfo : dir.entryInfoList())
|
||||
{
|
||||
const QString fn(fileInfo.fileName());
|
||||
ok = fn.size() > 5;
|
||||
bool ok = fn.size() > 5;
|
||||
if (!ok) { continue; }
|
||||
BLACK_VERIFY_X(ok, Q_FUNC_INFO, "wrong file name");
|
||||
const int id = fn.leftRef(5).toInt(&ok);
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace BlackMisc
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
decltype(m_queue) queue;
|
||||
qSwap(m_queue, queue);
|
||||
std::swap(m_queue, queue);
|
||||
lock.unlock();
|
||||
|
||||
for (const auto &pair : BlackMisc::as_const(queue))
|
||||
@@ -391,13 +391,13 @@ namespace BlackMisc
|
||||
{
|
||||
m_originalTimestamps = fromJson(json.value("timestamps").toObject());
|
||||
|
||||
QUuid uuid(json.value("uuid").toString());
|
||||
if (uuid == m_uuid && m_admittedQueue.isEmpty())
|
||||
QUuid id(json.value("uuid").toString());
|
||||
if (id == m_uuid && m_admittedQueue.isEmpty())
|
||||
{
|
||||
if (m_pendingWrite) { return guard; }
|
||||
return {};
|
||||
}
|
||||
if (updateUuid) { m_uuid = uuid; }
|
||||
if (updateUuid) { m_uuid = id; }
|
||||
|
||||
auto timesToLive = fromJson(json.value("ttl").toObject());
|
||||
for (auto it = m_originalTimestamps.cbegin(); it != m_originalTimestamps.cend(); ++it)
|
||||
@@ -807,19 +807,19 @@ namespace BlackMisc
|
||||
return;
|
||||
}
|
||||
auto json = QJsonDocument::fromJson(file.readAll()).object();
|
||||
QUuid uuid(json.value("uuid").toString());
|
||||
QUuid id(json.value("uuid").toString());
|
||||
CSequence<CProcessInfo> apps;
|
||||
auto status = apps.convertFromJsonNoThrow(json.value("apps").toObject(), this, QStringLiteral("Error in %1 apps object").arg(m_filename));
|
||||
apps.removeIf([](const CProcessInfo & pi) { return ! pi.exists(); });
|
||||
|
||||
if (apps.isEmpty()) { uuid = CIdentifier().toUuid(); }
|
||||
m_uuid = uuid;
|
||||
if (apps.isEmpty()) { id = CIdentifier().toUuid(); }
|
||||
m_uuid = id;
|
||||
|
||||
CProcessInfo currentProcess = CProcessInfo::currentProcess();
|
||||
Q_ASSERT(currentProcess.exists());
|
||||
apps.replaceOrAdd(currentProcess);
|
||||
json.insert("apps", apps.toJson());
|
||||
json.insert("uuid", uuid.toString());
|
||||
json.insert("uuid", m_uuid.toString());
|
||||
if (file.seek(0) && file.resize(0) && file.write(QJsonDocument(json).toJson()))
|
||||
{
|
||||
if (!file.checkedClose())
|
||||
|
||||
@@ -474,6 +474,7 @@ namespace BlackMisc
|
||||
default:
|
||||
const QString m = QString("no property, index ").append(index.toQString());
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, m.toLocal8Bit().constData());
|
||||
Q_UNUSED(m)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,7 +544,6 @@ namespace BlackMisc
|
||||
QJsonObject unwrapCache(const QJsonObject &object)
|
||||
{
|
||||
if (object.size() != 1) { return object; } // no cache format
|
||||
const QString key = object.constBegin().key();
|
||||
const QJsonObject cacheObject = object.constBegin()->toObject();
|
||||
if (cacheObject.contains("type") && cacheObject.contains("value"))
|
||||
{
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace BlackMisc
|
||||
|
||||
void CTextMessage::toggleSenderRecipient()
|
||||
{
|
||||
qSwap(m_senderCallsign, m_recipientCallsign);
|
||||
std::swap(m_senderCallsign, m_recipientCallsign);
|
||||
}
|
||||
|
||||
bool CTextMessage::isSelcalMessage() const
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackMisc
|
||||
this->push_back(message);
|
||||
}
|
||||
|
||||
CTextMessageList::CTextMessageList(const QString &message, const QList<CFrequency> &frequencies, const BlackMisc::Aviation::CCallsign &fromCallsign)
|
||||
CTextMessageList::CTextMessageList(const QString &message, const QList<CFrequency> &frequencies, const CCallsign &fromCallsign)
|
||||
{
|
||||
if (frequencies.isEmpty()) return;
|
||||
for (const CFrequency &frequency : frequencies)
|
||||
|
||||
@@ -50,13 +50,13 @@ namespace BlackMisc
|
||||
CTextMessageList(const QString &message, const Aviation::CCallsign &senderCallsign, const Aviation::CCallsign &recipientCallsign);
|
||||
|
||||
//! Constructor, single radio message
|
||||
CTextMessageList(const QString &message, const PhysicalQuantities::CFrequency &frequency, const Aviation::CCallsign &senderCallsign = Aviation::CCallsign());
|
||||
CTextMessageList(const QString &message, const PhysicalQuantities::CFrequency &frequency, const Aviation::CCallsign &senderCallsign = {});
|
||||
|
||||
//! Constructor, single message
|
||||
CTextMessageList(const CTextMessage &message);
|
||||
|
||||
//! Constructor, multi-frequency radio messages
|
||||
CTextMessageList(const QString &message, const QList<PhysicalQuantities::CFrequency> &frequencies, const Aviation::CCallsign &sender = Aviation::CCallsign());
|
||||
CTextMessageList(const QString &message, const QList<PhysicalQuantities::CFrequency> &frequencies, const Aviation::CCallsign &fromCallsign = {});
|
||||
|
||||
//! Construct from a base class object.
|
||||
CTextMessageList(const CSequence<CTextMessage> &other);
|
||||
|
||||
@@ -633,15 +633,15 @@ namespace BlackMisc
|
||||
// make absolute
|
||||
if (!soPath.left(3).contains(':')) { soPath = CFileUtils::appendFilePaths(relPath, soPath); }
|
||||
|
||||
const QDir p(soPath); // always absolute path now
|
||||
if (checked && !p.exists())
|
||||
const QDir dir(soPath); // always absolute path now
|
||||
if (checked && !dir.exists())
|
||||
{
|
||||
// skip, not existing
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path skipped, not existing: '%1' in '%2'") << p.absolutePath() << fsxFile; }
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path skipped, not existing: '%1' in '%2'") << dir.absolutePath() << fsxFile; }
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString afp = p.absolutePath().toLower();
|
||||
const QString afp = dir.absolutePath().toLower();
|
||||
if (!CDirectoryUtils::containsFileInDir(afp, airFileFilter(), true))
|
||||
{
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path: Skipping '%1' from '%2', no '%3' file") << afp << fsxFile << airFileFilter(); }
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace BlackMisc
|
||||
}
|
||||
else
|
||||
{
|
||||
const qint64 diff = noSituation ? -1 : m_currentTimeMsSinceEpoch - currentSituation.getAdjustedMSecsSinceEpoch();
|
||||
const qint64 diff = m_currentTimeMsSinceEpoch - currentSituation.getAdjustedMSecsSinceEpoch();
|
||||
m = CStatusMessage(this).warning(u"Invalid situation, diff. %1ms #%2 for interpolation reported for '%3' (Interpolant: %4 interpolation: %5)") <<
|
||||
diff << m_invalidSituations << m_callsign.asString() << boolToTrueFalse(isValidInterpolant) << boolToTrueFalse(isValidInterpolation);
|
||||
}
|
||||
@@ -609,10 +609,10 @@ namespace BlackMisc
|
||||
}
|
||||
else
|
||||
{
|
||||
CAircraftModel model = this->getAircraftInRangeForCallsign(m_callsign).getModel();
|
||||
if (model.hasModelString())
|
||||
CAircraftModel foundModel = this->getAircraftInRangeForCallsign(m_callsign).getModel();
|
||||
if (foundModel.hasModelString())
|
||||
{
|
||||
m_model = model;
|
||||
m_model = foundModel;
|
||||
}
|
||||
}
|
||||
this->getAndFetchModelCG(model.getCG());
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace BlackMisc
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSimulatorSettings::setRecordedGndRadius(CLength &radius)
|
||||
bool CSimulatorSettings::setRecordedGndRadius(const CLength &radius)
|
||||
{
|
||||
if (radius == m_recordedGndRadius) { return false; }
|
||||
m_recordedGndRadius = radius;
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace BlackMisc
|
||||
BlackMisc::PhysicalQuantities::CLength getRecordedGndRadius() const { return m_recordedGndRadius; }
|
||||
|
||||
//! Record GND values with radius
|
||||
bool setRecordedGndRadius(BlackMisc::PhysicalQuantities::CLength &radius);
|
||||
bool setRecordedGndRadius(const BlackMisc::PhysicalQuantities::CLength &radius);
|
||||
|
||||
//! Reset the paths
|
||||
void resetPaths();
|
||||
|
||||
@@ -575,15 +575,15 @@ namespace BlackMisc
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(absoluteTexPath);
|
||||
if (!fileInfo.exists())
|
||||
QFileInfo texFileInfo(absoluteTexPath);
|
||||
if (!texFileInfo.exists())
|
||||
{
|
||||
const CStatusMessage m = CStatusMessage(this).error(u"%1/xsb_aircraft.txt Line %2 : Texture '%3' does not exist.") << path << lineNum << absoluteTexPath;
|
||||
m_loadingMessages.push_back(m);
|
||||
return false;
|
||||
}
|
||||
|
||||
package.planes.back().textureName = fileInfo.completeBaseName();
|
||||
package.planes.back().textureName = texFileInfo.completeBaseName();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ using namespace BlackMisc::Audio;
|
||||
|
||||
namespace BlackSound
|
||||
{
|
||||
QVector<float> convertBytesTo32BitFloatPCM(const QByteArray input)
|
||||
QVector<float> convertBytesTo32BitFloatPCM(const QByteArray &input)
|
||||
{
|
||||
int inputSamples = input.size() / 2; // 16 bit input, so 2 bytes per sample
|
||||
QVector<float> output;
|
||||
@@ -33,7 +33,7 @@ namespace BlackSound
|
||||
return output;
|
||||
}
|
||||
|
||||
QVector<qint16> convertBytesTo16BitPCM(const QByteArray input)
|
||||
QVector<qint16> convertBytesTo16BitPCM(const QByteArray &input)
|
||||
{
|
||||
const int inputSamples = input.size() / 2; // 16 bit input, so 2 bytes per sample
|
||||
QVector<qint16> output;
|
||||
@@ -45,7 +45,7 @@ namespace BlackSound
|
||||
return output;
|
||||
}
|
||||
|
||||
QVector<qint16> convertFloatBytesTo16BitPCM(const QByteArray input)
|
||||
QVector<qint16> convertFloatBytesTo16BitPCM(const QByteArray &input)
|
||||
{
|
||||
Q_UNUSED(input)
|
||||
// qFatal("Not implemented");
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
namespace BlackSound
|
||||
{
|
||||
//! Conversion functions @{
|
||||
BLACKSOUND_EXPORT QVector<float> convertBytesTo32BitFloatPCM(const QByteArray input);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertBytesTo16BitPCM(const QByteArray input);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertFloatBytesTo16BitPCM(const QByteArray input);
|
||||
BLACKSOUND_EXPORT QVector<float> convertBytesTo32BitFloatPCM(const QByteArray &input);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertBytesTo16BitPCM(const QByteArray &input);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertFloatBytesTo16BitPCM(const QByteArray &input);
|
||||
BLACKSOUND_EXPORT QVector<float> convertFromMonoToStereo(const QVector<float> &mono);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertFromStereoToMono(const QVector<qint16> &stereo);
|
||||
BLACKSOUND_EXPORT QVector<float> convertFromShortToFloat(const QVector<qint16> &input);
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace BlackSound
|
||||
return bufferSize / bytesPerSample;
|
||||
}
|
||||
|
||||
QVector<qint16> COpusDecoder::decode(const QByteArray opusData, int dataLength, int *decodedLength)
|
||||
QVector<qint16> COpusDecoder::decode(const QByteArray &opusData, int dataLength, int *decodedLength)
|
||||
{
|
||||
QVector<qint16> decoded(MaxDataBytes, 0);
|
||||
int count = frameCount(MaxDataBytes);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BlackSound
|
||||
int frameCount(int bufferSize);
|
||||
|
||||
//! Decode
|
||||
QVector<qint16> decode(const QByteArray opusData, int dataLength, int *decodedLength);
|
||||
QVector<qint16> decode(const QByteArray &opusData, int dataLength, int *decodedLength);
|
||||
|
||||
//! Reset
|
||||
void resetState();
|
||||
|
||||
@@ -12,9 +12,7 @@ namespace BlackSound
|
||||
{
|
||||
namespace Codecs
|
||||
{
|
||||
COpusEncoder::COpusEncoder(int sampleRate, int channels, int application) :
|
||||
m_sampleRate(sampleRate),
|
||||
m_channels(channels)
|
||||
COpusEncoder::COpusEncoder(int sampleRate, int channels, int application)
|
||||
{
|
||||
int error;
|
||||
opusEncoder = opus_encoder_create(sampleRate, channels, application, &error);
|
||||
@@ -30,7 +28,7 @@ namespace BlackSound
|
||||
opus_encoder_ctl(opusEncoder, OPUS_SET_BITRATE(bitRate));
|
||||
}
|
||||
|
||||
QByteArray COpusEncoder::encode(const QVector<qint16> pcmSamples, int samplesLength, int *encodedLength)
|
||||
QByteArray COpusEncoder::encode(const QVector<qint16> &pcmSamples, int samplesLength, int *encodedLength)
|
||||
{
|
||||
QByteArray encoded(maxDataBytes, 0);
|
||||
int length = opus_encode(opusEncoder, reinterpret_cast<const opus_int16 *>(pcmSamples.data()), samplesLength, reinterpret_cast<unsigned char *>(encoded.data()), maxDataBytes);
|
||||
|
||||
@@ -40,20 +40,11 @@ namespace BlackSound
|
||||
//! Bit rate
|
||||
void setBitRate(int bitRate);
|
||||
|
||||
//! \param frameCount Number of audio samples per frame
|
||||
//! \returns the size of an audio frame in bytes
|
||||
int frameByteCount(int frameCount);
|
||||
|
||||
//! Frame count
|
||||
int frameCount(const QVector<qint16> pcmSamples);
|
||||
|
||||
//! Encode
|
||||
QByteArray encode(const QVector<qint16> pcmSamples, int samplesLength, int *encodedLength);
|
||||
QByteArray encode(const QVector<qint16> &pcmSamples, int samplesLength, int *encodedLength);
|
||||
|
||||
private:
|
||||
OpusEncoder *opusEncoder = nullptr;
|
||||
int m_sampleRate;
|
||||
int m_channels;
|
||||
|
||||
static constexpr int maxDataBytes = 4000;
|
||||
};
|
||||
|
||||
@@ -581,7 +581,6 @@ namespace BlackSimPlugin
|
||||
{
|
||||
if (!m_isWeatherActivated) { return false; }
|
||||
|
||||
const CWeatherScenario s = m_weatherScenarioSettings.get();
|
||||
this->getOwnAircraftPosition();
|
||||
const CCoordinateGeodetic currentPosition = this->getOwnAircraftPosition();
|
||||
this->requestWeatherGrid(currentPosition, this->identifier());
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackSimPlugin
|
||||
struct Serializer<MsgTuple, 0>
|
||||
{
|
||||
static const QByteArray &read(const QByteArray &data, MsgTuple &) { return data; }
|
||||
static QByteArray write(QByteArray &data, const MsgTuple &) { return data; }
|
||||
static QByteArray write(const QByteArray &data, const MsgTuple &) { return data; }
|
||||
};
|
||||
|
||||
template< typename MessageTuple, quint32 Size >
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace BlackSimPlugin
|
||||
return QStringLiteral("N/A");
|
||||
}
|
||||
|
||||
// cppcheck-suppress constParameter
|
||||
bool CFsuipc::read(CSimulatedAircraft &aircraft, bool cockpit, bool situation, bool aircraftParts)
|
||||
{
|
||||
Q_UNUSED(aircraft);
|
||||
|
||||
@@ -453,9 +453,6 @@ namespace BlackSimPlugin
|
||||
{
|
||||
read = true;
|
||||
|
||||
// time, basically as a heartbeat
|
||||
QString fsTime = QString::asprintf("%02d:%02d:%02d", localFsTimeRaw[0], localFsTimeRaw[1], localFsTimeRaw[2]);
|
||||
|
||||
if (cockpit)
|
||||
{
|
||||
// COMs
|
||||
@@ -491,6 +488,7 @@ namespace BlackSimPlugin
|
||||
// position
|
||||
const double latCorrectionFactor = 90.0 / (10001750.0 * 65536.0 * 65536.0);
|
||||
const double lonCorrectionFactor = 360.0 / (65536.0 * 65536.0 * 65536.0 * 65536.0);
|
||||
// cppcheck-suppress shadowArgument
|
||||
CAircraftSituation situation = aircraft.getSituation();
|
||||
CCoordinateGeodetic position = situation.getPosition();
|
||||
CLatitude lat(latitudeRaw * latCorrectionFactor, CAngleUnit::deg());
|
||||
|
||||
@@ -1106,7 +1106,6 @@ namespace BlackSimPlugin
|
||||
CAircraftModel model = simObject.getAircraftModel();
|
||||
|
||||
const CSpecializedSimulatorSettings settings = this->getSimulatorSettings();
|
||||
const QStringList modelDirectories = settings.getModelDirectoriesFromSimulatorDirectoryOrDefault();
|
||||
const bool fileExists = CFsCommonUtil::adjustFileDirectory(model, settings.getModelDirectoriesOrDefault());
|
||||
bool canBeUsed = true;
|
||||
|
||||
@@ -1586,7 +1585,6 @@ namespace BlackSimPlugin
|
||||
if (situations.isEmpty())
|
||||
{
|
||||
CLogMessage(this).warning(u"No valid situations for '%1', will be added as pending") << callsign.asString();
|
||||
canAdd = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1596,11 +1594,10 @@ namespace BlackSimPlugin
|
||||
}
|
||||
|
||||
// still invalid?
|
||||
const bool invalidSituation = situation.isPositionOrAltitudeNull();
|
||||
canAdd = invalidSituation;
|
||||
canAdd = situation.isPositionOrAltitudeNull();
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
BLACK_VERIFY_X(invalidSituation, Q_FUNC_INFO, "Expect valid situation");
|
||||
BLACK_VERIFY_X(canAdd, Q_FUNC_INFO, "Expect valid situation");
|
||||
CLogMessage(this).warning(u"Invalid situation for '%1'") << callsign;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,9 +156,9 @@ void SwiftGuiStd::initMenus()
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild() && ui->menu_File && ui->menu_File->actions().size() > 5)
|
||||
{
|
||||
QAction *a = new QAction(CIcons::swift16(), "Copy XSwiftBus dialog");
|
||||
ui->menu_File->insertAction(ui->menu_File->actions().at(5), a);
|
||||
c = connect(a, &QAction::triggered, this, [ = ]
|
||||
QAction *act = new QAction(CIcons::swift16(), "Copy XSwiftBus dialog");
|
||||
ui->menu_File->insertAction(ui->menu_File->actions().at(5), act);
|
||||
c = connect(act, &QAction::triggered, this, [ = ]
|
||||
{
|
||||
this->copyXSwiftBusDialog(false);
|
||||
}, Qt::QueuedConnection);
|
||||
|
||||
@@ -980,6 +980,7 @@ namespace XSwiftBus
|
||||
// fixme: In a future update, change the orbit only while right mouse button is pressed.
|
||||
XPLMGetScreenSize(&w, &h);
|
||||
XPLMGetMouseLocation(&x, &y);
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (DEBUG) { DEBUG_LOG("Follow aircraft coordinates w,h,x,y: " + std::to_string(w) + " " + std::to_string(h) + " " + std::to_string(x) + " " + std::to_string(y)); }
|
||||
if (traffic->m_lastMouseX == x && traffic->m_lastMouseY == y && traffic->m_lastMouseX >= 0 && traffic->m_lastMouseY >= 0)
|
||||
{
|
||||
@@ -1104,12 +1105,13 @@ namespace XSwiftBus
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Return 1 to indicate we want to keep controlling the camera.
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (DEBUG)
|
||||
{
|
||||
DEBUG_LOG("Camera: " + pos2String(cameraPosition));
|
||||
DEBUG_LOG("Follow aircraft " + traffic->m_followPlaneViewCallsign + " " + modelName);
|
||||
}
|
||||
// Return 1 to indicate we want to keep controlling the camera.
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,12 +192,11 @@ namespace BlackMiscTest
|
||||
const int steps = 10;
|
||||
const double tfStep = 1.0 / steps;
|
||||
|
||||
double timeFraction = 0;
|
||||
double lastDeg = 0;
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
timeFraction = tfStep * i;
|
||||
double timeFraction = tfStep * i;
|
||||
pbh.setTimeFraction(timeFraction);
|
||||
const CHeading heading = pbh.getHeading();
|
||||
const double h = heading.value(CAngleUnit::deg());
|
||||
@@ -215,7 +214,7 @@ namespace BlackMiscTest
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
timeFraction = tfStep * i;
|
||||
double timeFraction = tfStep * i;
|
||||
pbh.setTimeFraction(timeFraction);
|
||||
const CHeading heading = pbh.getHeading();
|
||||
const double h = heading.value(CAngleUnit::deg());
|
||||
@@ -233,7 +232,7 @@ namespace BlackMiscTest
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
timeFraction = tfStep * i;
|
||||
double timeFraction = tfStep * i;
|
||||
pbh.setTimeFraction(timeFraction);
|
||||
const CHeading heading = pbh.getHeading();
|
||||
const double h = CAngle::normalizeDegrees360(heading.value(CAngleUnit::deg()));
|
||||
@@ -253,7 +252,7 @@ namespace BlackMiscTest
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
timeFraction = tfStep * i;
|
||||
double timeFraction = tfStep * i;
|
||||
pbh.setTimeFraction(timeFraction);
|
||||
const CAngle bank = pbh.getBank();
|
||||
const double b = bank.value(CAngleUnit::deg());
|
||||
@@ -271,7 +270,7 @@ namespace BlackMiscTest
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
timeFraction = tfStep * i;
|
||||
double timeFraction = tfStep * i;
|
||||
pbh.setTimeFraction(timeFraction);
|
||||
const CAngle bank = pbh.getBank();
|
||||
const double b = CAngle::normalizeDegrees360(bank.value(CAngleUnit::deg()));
|
||||
@@ -291,7 +290,7 @@ namespace BlackMiscTest
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
timeFraction = tfStep * i;
|
||||
double timeFraction = tfStep * i;
|
||||
pbh.setTimeFraction(timeFraction);
|
||||
const CAngle pitch = pbh.getPitch();
|
||||
const double p = pitch.value(CAngleUnit::deg());
|
||||
@@ -311,7 +310,7 @@ namespace BlackMiscTest
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
timeFraction = tfStep * i;
|
||||
double timeFraction = tfStep * i;
|
||||
pbh.setTimeFraction(timeFraction);
|
||||
const CAngle pitch = pbh.getPitch();
|
||||
const double p = pitch.value(CAngleUnit::deg());
|
||||
|
||||
@@ -375,7 +375,6 @@ namespace BlackMiscTest
|
||||
qint64 ts = 1000000;
|
||||
int no = 10;
|
||||
const int max = 6;
|
||||
int dt = 0;
|
||||
|
||||
for (int i = 0; i < no; ++i)
|
||||
{
|
||||
@@ -386,16 +385,15 @@ namespace BlackMiscTest
|
||||
|
||||
if (CMathUtils::randomBool())
|
||||
{
|
||||
dt = CMathUtils::randomInteger(4500, 5500);
|
||||
ts += CMathUtils::randomInteger(4500, 5500);
|
||||
s.setTimeOffsetMs(6000);
|
||||
}
|
||||
else
|
||||
{
|
||||
dt = CMathUtils::randomInteger(900, 1100);
|
||||
ts += CMathUtils::randomInteger(900, 1100);
|
||||
s.setTimeOffsetMs(2000);
|
||||
}
|
||||
|
||||
ts += dt;
|
||||
situations.push_frontKeepLatestFirstAdjustOffset(s, true, max);
|
||||
|
||||
QVERIFY2(situations.size() <= max, "Wrong size");
|
||||
|
||||
Reference in New Issue
Block a user