From 9fd7153bd89d4d0f256e585546536a620109e6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 20 Aug 2021 18:06:21 +0200 Subject: [PATCH] Suport ControlFlags with PollingControlProxy() --- src/control/pollingcontrolproxy.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/control/pollingcontrolproxy.h b/src/control/pollingcontrolproxy.h index 132cda9cee9..db59a66ed8f 100644 --- a/src/control/pollingcontrolproxy.h +++ b/src/control/pollingcontrolproxy.h @@ -10,27 +10,21 @@ /// It is basically a PIMPL version of a ControlDoublePrivate Shared pointer class PollingControlProxy { public: - PollingControlProxy() { - initialize(ConfigKey()); + PollingControlProxy(ControlFlags flags = ControlFlag::None) + : PollingControlProxy(ConfigKey(), flags) { } - PollingControlProxy(const QString& g, const QString& i) { - initialize(ConfigKey(g, i)); + PollingControlProxy(const QString& g, const QString& i, ControlFlags flags = ControlFlag::None) + : PollingControlProxy(ConfigKey(g, i), flags) { } - PollingControlProxy(const ConfigKey& key) { - initialize(key); - } - - void initialize(const ConfigKey& key) { - // Don't bother looking up the control if key is NULL. Prevents log spew. - if (key.isValid()) { - m_pControl = ControlDoublePrivate::getControl(key, ControlFlag::None); - } - + PollingControlProxy(const ConfigKey& key, ControlFlags flags = ControlFlag::None) { + m_pControl = ControlDoublePrivate::getControl(key, flags); if (!m_pControl) { + DEBUG_ASSERT(flags & ControlFlag::AllowMissingOrInvalid); m_pControl = ControlDoublePrivate::getDefaultControl(); } + DEBUG_ASSERT(m_pControl); } bool valid() const {