diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-08-16 10:00:30 +0200 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2020-08-16 10:00:30 +0200 |
commit | 72ff597f875b8d3d653c963b2afe1012a3f177be (patch) | |
tree | d605197054754be34fbf17cca8298f3429c5cac4 /src/control | |
parent | 208f97d389d604709bcc082018e5703418c90013 (diff) | |
parent | 64fd2d6cd4010d42e23fe286c3f23fe5940cb603 (diff) |
Merge branch '2.3' of git@github.com:mixxxdj/mixxx.git
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/control.cpp | 6 | ||||
-rw-r--r-- | src/control/control.h | 7 | ||||
-rw-r--r-- | src/control/controlobject.cpp | 4 | ||||
-rw-r--r-- | src/control/controlproxy.cpp | 6 |
4 files changed, 14 insertions, 9 deletions
diff --git a/src/control/control.cpp b/src/control/control.cpp index 99f72ce37f..9b0ae2f9f9 100644 --- a/src/control/control.cpp +++ b/src/control/control.cpp @@ -101,9 +101,9 @@ QSharedPointer<ControlDoublePrivate> ControlDoublePrivate::getControl( bool bTrack, bool bPersist, double defaultValue) { - VERIFY_OR_DEBUG_ASSERT(!key.isEmpty()) { - qWarning() << "ControlDoublePrivate::getControl returning NULL" - << "for empty ConfigKey."; + VERIFY_OR_DEBUG_ASSERT(key.isValid()) { + qWarning() << "ControlDoublePrivate::getControl returning nullptr" + << "for invalid ConfigKey" << key; return nullptr; } diff --git a/src/control/control.h b/src/control/control.h index 5ff49bcd4b..fb7c5abfc3 100644 --- a/src/control/control.h +++ b/src/control/control.h @@ -15,8 +15,13 @@ class ControlObject; enum class ControlFlag { None = 0, - AllowEmptyKey = 1, + /// Do not throw an assertion if the key is invalid. Needed for controller + /// mappings and skins. + AllowInvalidKey = 1, + /// Don't throw an assertion when trying to access a non-existing CO. + /// Needed for controller mappings and skins. NoAssertIfMissing = 1 << 1, + /// Don't log a warning when trying to access a non-existing CO. NoWarnIfMissing = (1 << 2) | NoAssertIfMissing, }; diff --git a/src/control/controlobject.cpp b/src/control/controlobject.cpp index 988681cc50..543046e576 100644 --- a/src/control/controlobject.cpp +++ b/src/control/controlobject.cpp @@ -31,8 +31,8 @@ ControlObject::ControlObject() { ControlObject::ControlObject(ConfigKey key, bool bIgnoreNops, bool bTrack, bool bPersist, double defaultValue) : m_key(key) { - // Don't bother looking up the control if key is NULL. Prevents log spew. - if (!m_key.isNull()) { + // Don't bother looking up the control if key is invalid. Prevents log spew. + if (m_key.isValid()) { m_pControl = ControlDoublePrivate::getControl(m_key, ControlFlag::None, this, diff --git a/src/control/controlproxy.cpp b/src/control/controlproxy.cpp index f0b93961a5..5ca1f04630 100644 --- a/src/control/controlproxy.cpp +++ b/src/control/controlproxy.cpp @@ -14,10 +14,10 @@ ControlProxy::ControlProxy(const char* g, const char* i, QObject* pParent, Contr ControlProxy::ControlProxy(const ConfigKey& key, QObject* pParent, ControlFlags flags) : QObject(pParent), m_pControl(nullptr) { - DEBUG_ASSERT(!key.isNull() || flags.testFlag(ControlFlag::AllowEmptyKey)); + DEBUG_ASSERT(key.isValid() || flags.testFlag(ControlFlag::AllowInvalidKey)); m_key = key; - if (!m_key.isNull()) { + if (m_key.isValid()) { initialize(flags); } } @@ -27,7 +27,7 @@ void ControlProxy::initialize(ControlFlags flags) { DEBUG_ASSERT(!m_pControl); // Prevent empty keys - VERIFY_OR_DEBUG_ASSERT(!m_key.isNull() || flags.testFlag(ControlFlag::AllowEmptyKey)) { + VERIFY_OR_DEBUG_ASSERT(m_key.isValid() || flags.testFlag(ControlFlag::AllowInvalidKey)) { return; } |