From 659b76035527950cbb86b04c4f477b42fb0a56bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 21 Mar 2014 11:47:19 +0100 Subject: [PATCH] [kwin] Rename BuiltInEffects::enabledByDefault to checkEnabledByDefault The functionality is to check whether the effect should be enabled by default. It's not about whether the effect is enabled by default. This is also needed as it's currently still taken from the plugin data. --- effects.cpp | 2 +- effects/effect_builtins.cpp | 34 +++++++++++++++++----------------- effects/effect_builtins.h | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/effects.cpp b/effects.cpp index be0bc8101d..c93782e89b 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1580,7 +1580,7 @@ Effect *EffectsHandlerImpl::loadBuiltInEffect(const QByteArray &name, bool check return nullptr; } if (checkDefault) { - if (!BuiltInEffects::enabledByDefault(name)) { + if (!BuiltInEffects::checkEnabledByDefault(name)) { return nullptr; } } diff --git a/effects/effect_builtins.cpp b/effects/effect_builtins.cpp index 34d9de9bbb..0d43f5d368 100644 --- a/effects/effect_builtins.cpp +++ b/effects/effect_builtins.cpp @@ -79,8 +79,8 @@ public: bool hasEffect(const QByteArray &name) const; bool supported(const QByteArray &name) const; bool supported(BuiltInEffect effect) const; - bool enabledByDefault(const QByteArray &name) const; - bool enabledByDefault(BuiltInEffect effect) const; + bool checkEnabledByDefault(const QByteArray &name) const; + bool checkEnabledByDefault(BuiltInEffect effect) const; QList availableEffectNames() const; QList availableEffects() const; BuiltInEffect builtInForName(const QByteArray &name) const; @@ -92,7 +92,7 @@ private: QHash m_effects; QMap m_createHash; QMap m_supportedHash; - QMap m_enabledHash; + QMap m_checkEnabledHash; }; EffectLoader::EffectLoader() @@ -163,12 +163,12 @@ EffectLoader::EffectLoader() #undef SUPPORTED -#define ENABLED(name, method) \ - m_enabledHash.insert(BuiltInEffect::name, &method); - ENABLED(Blur, BlurEffect::enabledByDefault) - ENABLED(Contrast, ContrastEffect::enabledByDefault) +#define CHECKENABLED(name, method) \ + m_checkEnabledHash.insert(BuiltInEffect::name, &method); + CHECKENABLED(Blur, BlurEffect::enabledByDefault) + CHECKENABLED(Contrast, ContrastEffect::enabledByDefault) -#undef ENABLED +#undef CHECKENABLED } Effect *EffectLoader::create(const QByteArray &name) @@ -207,15 +207,15 @@ bool EffectLoader::supported(BuiltInEffect effect) const return true; } -bool EffectLoader::enabledByDefault(const QByteArray &name) const +bool EffectLoader::checkEnabledByDefault(const QByteArray &name) const { - return enabledByDefault(builtInForName(name)); + return checkEnabledByDefault(builtInForName(name)); } -bool EffectLoader::enabledByDefault(BuiltInEffect effect) const +bool EffectLoader::checkEnabledByDefault(BuiltInEffect effect) const { - auto it = m_enabledHash.constFind(effect); - if (it != m_enabledHash.constEnd()) { + auto it = m_checkEnabledHash.constFind(effect); + if (it != m_checkEnabledHash.constEnd()) { return it.value()(); } return true; @@ -275,14 +275,14 @@ bool supported(BuiltInEffect effect) return s_effectLoader->supported(effect); } -bool enabledByDefault(const QByteArray &name) +bool checkEnabledByDefault(const QByteArray &name) { - return s_effectLoader->enabledByDefault(name); + return s_effectLoader->checkEnabledByDefault(name); } -bool enabledByDefault(BuiltInEffect effect) +bool checkEnabledByDefault(BuiltInEffect effect) { - return s_effectLoader->enabledByDefault(effect); + return s_effectLoader->checkEnabledByDefault(effect); } QList< QByteArray > availableEffectNames() diff --git a/effects/effect_builtins.h b/effects/effect_builtins.h index 3e561d9300..454e94a7ab 100644 --- a/effects/effect_builtins.h +++ b/effects/effect_builtins.h @@ -83,8 +83,8 @@ KWINEFFECTS_EXPORT Effect *create(BuiltInEffect effect); KWINEFFECTS_EXPORT bool available(const QByteArray &name); KWINEFFECTS_EXPORT bool supported(const QByteArray &name); KWINEFFECTS_EXPORT bool supported(BuiltInEffect effect); -KWINEFFECTS_EXPORT bool enabledByDefault(const QByteArray &name); -KWINEFFECTS_EXPORT bool enabledByDefault(BuiltInEffect effect); +KWINEFFECTS_EXPORT bool checkEnabledByDefault(const QByteArray &name); +KWINEFFECTS_EXPORT bool checkEnabledByDefault(BuiltInEffect effect); KWINEFFECTS_EXPORT QByteArray nameForEffect(BuiltInEffect effect); KWINEFFECTS_EXPORT BuiltInEffect builtInForName(const QByteArray &name); KWINEFFECTS_EXPORT QList availableEffectNames();