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