From bd67824ce60c6f6c04d16c2df4117cc24cb2abc1 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 25 Jun 2017 19:46:42 +0200 Subject: [PATCH] Ref T27, utility functions for debug messages --- src/blackcore/simulatorcommon.cpp | 19 +++++++++++++++++++ src/blackcore/simulatorcommon.h | 9 +++++++++ 2 files changed, 28 insertions(+) diff --git a/src/blackcore/simulatorcommon.cpp b/src/blackcore/simulatorcommon.cpp index a08f5dee3..9c42b86a9 100644 --- a/src/blackcore/simulatorcommon.cpp +++ b/src/blackcore/simulatorcommon.cpp @@ -198,6 +198,25 @@ namespace BlackCore return false; } + void CSimulatorCommon::debugLogMessage(const QString &msg) const + { + if (!showDebugLogMessage()) { return; } + if (msg.isEmpty()) { return; } + CLogMessage(this).info(msg); + } + + void CSimulatorCommon::debugLogMessage(const QString &funcInfo, const QString &msg) const + { + if (!showDebugLogMessage()) { return; } + if (msg.isEmpty()) { return; } + CLogMessage(this).info("%1 %2") << msg << funcInfo; + } + + bool CSimulatorCommon::showDebugLogMessage() const + { + return m_interpolationRenderingSetup.showSimulatorDebugMessages(); + } + void CSimulatorCommon::reverseLookupAndUpdateOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model) { Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing sApp"); diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index 268f5ae69..130299930 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -192,6 +192,15 @@ namespace BlackCore //! Parse driver specific details for ISimulator::parseCommandLine virtual bool parseDetails(const BlackMisc::CSimpleCommandParser &parser); + //! Display a debug log message based on BlackMisc::Simulation::CInterpolationAndRenderingSetup + void debugLogMessage(const QString &msg) const; + + //! Display a debug log message based on BlackMisc::Simulation::CInterpolationAndRenderingSetup + void debugLogMessage(const QString &funcInfo, const QString &msg) const; + + //! Show log messages? + bool showDebugLogMessage() const; + bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold) BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model int m_statsUpdateAircraftCountMs = 0; //!< statistics update count