From 37f5e4dfbf398cf70a83855c7252c03b236b7dc6 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Tue, 27 Apr 2021 16:19:31 -0400 Subject: [PATCH] Settings: Support LIBOPENSHOT_DEBUG envvar - Setting LIBOPENSHOT_DEBUG to any value in the process environment activates debug logging to stderr. --- src/Settings.cpp | 9 ++++++--- src/Settings.h | 14 +------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Settings.cpp b/src/Settings.cpp index cfbe2e2ca..688eaae3b 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -28,14 +28,14 @@ * along with OpenShot Library. If not, see . */ +#include // For std::getenv + #include "Settings.h" -using namespace std; using namespace openshot; - // Global reference to Settings -Settings *Settings::m_pInstance = NULL; +Settings *Settings::m_pInstance = nullptr; // Create or Get an instance of the settings singleton Settings *Settings::Instance() @@ -53,6 +53,9 @@ Settings *Settings::Instance() m_pInstance->HW_EN_DEVICE_SET = 0; m_pInstance->PLAYBACK_AUDIO_DEVICE_NAME = ""; m_pInstance->DEBUG_TO_STDERR = false; + auto env_debug = std::getenv("LIBOPENSHOT_DEBUG"); + if (env_debug != nullptr) + m_pInstance->DEBUG_TO_STDERR = true; } return m_pInstance; diff --git a/src/Settings.h b/src/Settings.h index 36ba29172..e21822a0a 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -31,19 +31,7 @@ #ifndef OPENSHOT_SETTINGS_H #define OPENSHOT_SETTINGS_H - -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include - namespace openshot { @@ -118,7 +106,7 @@ namespace openshot { /// The current install path of OpenShot (needs to be set when using Timeline(path), since certain /// paths depend on the location of OpenShot transitions and files) std::string PATH_OPENSHOT_INSTALL = ""; - + /// Whether to dump ZeroMQ debug messages to stderr bool DEBUG_TO_STDERR = false;