[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.
This commit is contained in:
parent
82731f231e
commit
659b760355
3 changed files with 20 additions and 20 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<QByteArray> availableEffectNames() const;
|
||||
QList<BuiltInEffect> availableEffects() const;
|
||||
BuiltInEffect builtInForName(const QByteArray &name) const;
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
QHash<QByteArray, BuiltInEffect> m_effects;
|
||||
QMap<BuiltInEffect, CreateInstanceFunction> m_createHash;
|
||||
QMap<BuiltInEffect, SupportedFunction> m_supportedHash;
|
||||
QMap<BuiltInEffect, SupportedFunction> m_enabledHash;
|
||||
QMap<BuiltInEffect, SupportedFunction> 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()
|
||||
|
|
|
@ -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<QByteArray> availableEffectNames();
|
||||
|
|
Loading…
Reference in a new issue