Minor tweaks, style

This commit is contained in:
Klaus Basan
2018-06-21 18:06:48 +02:00
parent e46076afa5
commit 69193f089a
10 changed files with 27 additions and 32 deletions

View File

@@ -183,14 +183,14 @@ namespace BlackCore
return BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign(); return BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign();
} }
//! \copydoc ISimulator::setInterpolationAndRenderingSetup //! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupGlobal
virtual void setInterpolationAndRenderingSetupGlobal(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override virtual void setInterpolationAndRenderingSetupGlobal(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override
{ {
Q_UNUSED(setup); Q_UNUSED(setup);
logEmptyContextWarning(Q_FUNC_INFO); logEmptyContextWarning(Q_FUNC_INFO);
} }
//! \copydoc ISimulator::setInterpolationSetupPerCallsign //! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupsPerCallsign
virtual bool setInterpolationAndRenderingSetupsPerCallsign(const BlackMisc::Simulation::CInterpolationSetupList &setups, bool ignoreSameAsGlobal) override virtual bool setInterpolationAndRenderingSetupsPerCallsign(const BlackMisc::Simulation::CInterpolationSetupList &setups, bool ignoreSameAsGlobal) override
{ {
Q_UNUSED(setups); Q_UNUSED(setups);

View File

@@ -133,13 +133,13 @@ namespace BlackCore
return m_simulatorPlugin.second->getSimulatorStatus(); return m_simulatorPlugin.second->getSimulatorStatus();
} }
BlackMisc::Simulation::CSimulatorPluginInfo CContextSimulator::getSimulatorPluginInfo() const CSimulatorPluginInfo CContextSimulator::getSimulatorPluginInfo() const
{ {
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_simulatorPlugin.first.isUnspecified()) { return BlackMisc::Simulation::CSimulatorPluginInfo(); } if (m_simulatorPlugin.first.isUnspecified()) { return CSimulatorPluginInfo(); }
Q_ASSERT(m_simulatorPlugin.second); Q_ASSERT(m_simulatorPlugin.second);
if (m_simulatorPlugin.first.getSimulator() == "emulated") { return m_simulatorPlugin.second->getSimulatorPluginInfo(); } if (m_simulatorPlugin.first.getSimulator().contains("emulated", Qt::CaseInsensitive)) { return m_simulatorPlugin.second->getSimulatorPluginInfo(); }
return m_simulatorPlugin.first; return m_simulatorPlugin.first;
} }

View File

@@ -322,7 +322,7 @@ namespace BlackCore
bool m_blinkCycle = false; //!< used for highlighting bool m_blinkCycle = false; //!< used for highlighting
qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting
int m_timerCounter = 0; //!< allows to calculate n seconds int m_timerCounter = 0; //!< allows to calculate n seconds
QTimer m_oneSecondTimer; //!< multi purpose timer QTimer m_oneSecondTimer; //!< multi purpose timer with 1 sec. interval
BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots

View File

@@ -36,7 +36,7 @@ namespace BlackMisc
//! Properties by index //! Properties by index
enum ColumnIndex enum ColumnIndex
{ {
IndexScheme = BlackMisc::CPropertyIndex::GlobalIndexCUrl, IndexScheme = CPropertyIndex::GlobalIndexCUrl,
IndexHost, IndexHost,
IndexPort, IndexPort,
IndexPath, IndexPath,

View File

@@ -20,12 +20,11 @@ namespace BlackMisc
{ {
namespace FsCommon namespace FsCommon
{ {
quint32 CBcdConversions::comFrequencyToBcdHz(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) quint32 CBcdConversions::comFrequencyToBcdHz(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency)
{ {
// FSX documentation is wrong, we need to use kHz + 2 digits, not Hz // FSX documentation is wrong, we need to use kHz + 2 digits, not Hz
double f = comFrequency.valueRounded(CFrequencyUnit::kHz(), 0) / 10; const double f = comFrequency.valueRounded(CFrequencyUnit::kHz(), 0) / 10;
quint32 fInt = dec2Bcd(static_cast<quint32>(f)); const quint32 fInt = dec2Bcd(static_cast<quint32>(f));
return fInt; return fInt;
} }
@@ -48,7 +47,6 @@ namespace BlackMisc
} }
return result; return result;
} }
} // namespace } // namespace
} // namespace } // namespace
} // namespacee } // namespacee

View File

@@ -14,18 +14,15 @@
#include "blackmisc/blackmiscexport.h" #include "blackmisc/blackmiscexport.h"
#include "blackmisc/pq/frequency.h" #include "blackmisc/pq/frequency.h"
#include <QtGlobal> #include <QtGlobal>
namespace BlackMisc namespace BlackMisc
{ {
namespace Aviation { class CTransponder; } namespace Aviation { class CTransponder; }
namespace Simulation namespace Simulation
{ {
namespace FsCommon namespace FsCommon
{ {
//! BCD conversions for FS //! BCD conversions for FS
class BLACKMISC_EXPORT CBcdConversions class BLACKMISC_EXPORT CBcdConversions
{ {
@@ -49,7 +46,6 @@ namespace BlackMisc
//! Horner scheme //! Horner scheme
static quint32 hornerScheme(quint32 num, quint32 divider, quint32 factor); static quint32 hornerScheme(quint32 num, quint32 divider, quint32 factor);
}; };
} // ns } // ns
} // ns } // ns
} // ns } // ns

View File

@@ -38,7 +38,7 @@ namespace BlackMisc
//! Specific values //! Specific values
enum ColumnIndex enum ColumnIndex
{ {
IndexData = BlackMisc::CPropertyIndex::GlobalIndexCSimulatorInternals IndexData = CPropertyIndex::GlobalIndexCSimulatorInternals
}; };
//! Default constructor //! Default constructor
@@ -81,10 +81,10 @@ namespace BlackMisc
void setSimulatorInstallationDirectory(const QString &fullFilePath); void setSimulatorInstallationDirectory(const QString &fullFilePath);
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex //! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; CVariant propertyByIndex(const CPropertyIndex &index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
//! Register metadata //! Register metadata
static void registerMetadata(); static void registerMetadata();

View File

@@ -48,7 +48,7 @@ namespace BlackSimPlugin
if (!sGui || !sGui->getISimulator()) { return nullptr; } if (!sGui || !sGui->getISimulator()) { return nullptr; }
ISimulator *sim = sGui->getISimulator(); ISimulator *sim = sGui->getISimulator();
if (!sim->getSimulatorInfo().isFsxP3DFamily()) { return nullptr; } if (!sim->getSimulatorInfo().isFsxP3DFamily()) { return nullptr; }
if (sim->getSimulatorInfo() != m_simulator) { return nullptr; } if (sim->getSimulatorInfo() != m_simulator) { return nullptr; }
CSimulatorFsxCommon *fsx = static_cast<CSimulatorFsxCommon *>(sim); // wonder why qobject_cast does not work here CSimulatorFsxCommon *fsx = static_cast<CSimulatorFsxCommon *>(sim); // wonder why qobject_cast does not work here
return fsx; return fsx;
} }

View File

@@ -96,7 +96,6 @@ namespace BlackSimPlugin
this->initDataDefinitionsWhenConnected(); this->initDataDefinitionsWhenConnected();
m_timerId = this->startTimer(DispatchIntervalMs); m_timerId = this->startTimer(DispatchIntervalMs);
// do not start m_addPendingAircraftTimer here, it will be started when object was added // do not start m_addPendingAircraftTimer here, it will be started when object was added
return true; return true;
} }
@@ -411,7 +410,7 @@ namespace BlackSimPlugin
void CSimulatorFsxCommon::onSimStopped() void CSimulatorFsxCommon::onSimStopped()
{ {
// stopping events in FSX: Load menu, weather and season // stopping events in FSX: Load menu, weather and season
CLogMessage(this).info("Simulator stopped: %1") << this->m_simulatorDetails; CLogMessage(this).info("Simulator stopped: %1") << m_simulatorDetails;
const SimulatorStatus oldStatus = this->getSimulatorStatus(); const SimulatorStatus oldStatus = this->getSimulatorStatus();
m_simSimulating = false; m_simSimulating = false;
m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch(); m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch();
@@ -432,7 +431,7 @@ namespace BlackSimPlugin
void CSimulatorFsxCommon::onSimExit() void CSimulatorFsxCommon::onSimExit()
{ {
CLogMessage(this).info("Simulator exit: %1") << this->m_simulatorDetails; CLogMessage(this).info("Simulator exit: %1") << m_simulatorDetails;
// reset complete state, we are going down // reset complete state, we are going down
m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch(); m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch();
@@ -1725,7 +1724,7 @@ namespace BlackSimPlugin
if (!simObject.hasValidRequestAndObjectId()) { return false; } if (!simObject.hasValidRequestAndObjectId()) { return false; }
if (!m_hSimConnect) { return false; } if (!m_hSimConnect) { return false; }
// always request, not only when something has changed // stop by setting SIMCONNECT_PERIOD_NEVER
HRESULT result = SimConnect_RequestDataOnSimObject( HRESULT result = SimConnect_RequestDataOnSimObject(
m_hSimConnect, simObject.getRequestId() + RequestSimDataOffset, m_hSimConnect, simObject.getRequestId() + RequestSimDataOffset,
CSimConnectDefinitions::DataRemoteAircraftGetPosition, CSimConnectDefinitions::DataRemoteAircraftGetPosition,

View File

@@ -312,6 +312,7 @@ namespace BlackSimPlugin
void updateProbeFromSimulator(const BlackMisc::Aviation::CCallsign &callsign, const DataDefinitionRemoteAircraftSimData &remoteAircraftData); void updateProbeFromSimulator(const BlackMisc::Aviation::CCallsign &callsign, const DataDefinitionRemoteAircraftSimData &remoteAircraftData);
//! Update from SB client area //! Update from SB client area
//! \threadsafe
void updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea); void updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea);
//! An AI aircraft was added in the simulator //! An AI aircraft was added in the simulator
@@ -412,15 +413,15 @@ namespace BlackSimPlugin
static constexpr int DeferSimulatingFlagMs = 1500; //!< simulating can jitter at startup (simulating->stopped->simulating, multiple start events), so we defer detection static constexpr int DeferSimulatingFlagMs = 1500; //!< simulating can jitter at startup (simulating->stopped->simulating, multiple start events), so we defer detection
static constexpr int DeferResendingLights = 2500; //!< Resend light state when aircraft light state was not yet available static constexpr int DeferResendingLights = 2500; //!< Resend light state when aircraft light state was not yet available
QString m_simConnectVersion; //!< SimConnect version QString m_simConnectVersion; //!< SimConnect version
bool m_simConnected = false; //!< Is simulator connected? bool m_simConnected = false; //!< Is simulator connected?
bool m_simSimulating = false; //!< Simulator running? bool m_simSimulating = false; //!< Simulator running?
bool m_useSbOffsets = true; //!< with SB offsets bool m_useSbOffsets = true; //!< with SB offsets
bool m_traceSendId = false; //!< trace the send ids, meant for debugging bool m_traceSendId = false; //!< trace the send ids, meant for debugging
qint64 m_traceAutoTs = -1; //!< allows to automatically trace for some time qint64 m_traceAutoTs = -1; //!< allows to automatically trace for some time
qint64 m_simulatingChangedTs = -1; //!< timestamp, when simulating changed (used to avoid jitter) qint64 m_simulatingChangedTs = -1; //!< timestamp, when simulating changed (used to avoid jitter)
int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time
int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set
// tracing dispatch performance // tracing dispatch performance
int m_dispatchErrors = 0; //!< number of dispatched failed, \sa dispatch int m_dispatchErrors = 0; //!< number of dispatched failed, \sa dispatch
@@ -428,6 +429,7 @@ namespace BlackSimPlugin
qint64 m_dispatchMaxTimeMs = -1; qint64 m_dispatchMaxTimeMs = -1;
qint64 m_dispatchProcTimeMs = -1; qint64 m_dispatchProcTimeMs = -1;
qint64 m_dispatchProcMaxTimeMs = -1; qint64 m_dispatchProcMaxTimeMs = -1;
SIMCONNECT_RECV_ID m_dispatchLastReceiveId = SIMCONNECT_RECV_ID_NULL; //!< last receive id from dispatching SIMCONNECT_RECV_ID m_dispatchLastReceiveId = SIMCONNECT_RECV_ID_NULL; //!< last receive id from dispatching
SIMCONNECT_RECV_ID m_dispatchMaxTimeReceiveId = SIMCONNECT_RECV_ID_NULL; //!< receive id corresponding to max.time SIMCONNECT_RECV_ID m_dispatchMaxTimeReceiveId = SIMCONNECT_RECV_ID_NULL; //!< receive id corresponding to max.time
CSimConnectDefinitions::Request m_dispatchLastRequest = CSimConnectDefinitions::RequestEndMarker; //!< request id if any CSimConnectDefinitions::Request m_dispatchLastRequest = CSimConnectDefinitions::RequestEndMarker; //!< request id if any