diff --git a/kcmkwin/common/CMakeLists.txt b/kcmkwin/common/CMakeLists.txt --- a/kcmkwin/common/CMakeLists.txt +++ b/kcmkwin/common/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories(${KWIN_SOURCE_DIR}/effects) set(kcmkwincommon_SRC - effectmodel.cpp + effectsmodel.cpp ) qt5_add_dbus_interface(kcmkwincommon_SRC diff --git a/kcmkwin/common/effectmodel.h b/kcmkwin/common/effectsmodel.h rename from kcmkwin/common/effectmodel.h rename to kcmkwin/common/effectsmodel.h --- a/kcmkwin/common/effectmodel.h +++ b/kcmkwin/common/effectsmodel.h @@ -34,7 +34,7 @@ namespace KWin { -class KWIN_EXPORT EffectModel : public QAbstractItemModel +class KWIN_EXPORT EffectsModel : public QAbstractItemModel { Q_OBJECT @@ -139,7 +139,7 @@ Enabled = Qt::Checked }; - explicit EffectModel(QObject *parent = nullptr); + explicit EffectsModel(QObject *parent = nullptr); // Reimplemented from QAbstractItemModel. QHash roleNames() const override; @@ -254,7 +254,7 @@ QVector m_effectsList; - Q_DISABLE_COPY(EffectModel) + Q_DISABLE_COPY(EffectsModel) }; } diff --git a/kcmkwin/common/effectmodel.cpp b/kcmkwin/common/effectsmodel.cpp rename from kcmkwin/common/effectmodel.cpp rename to kcmkwin/common/effectsmodel.cpp --- a/kcmkwin/common/effectmodel.cpp +++ b/kcmkwin/common/effectsmodel.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . *********************************************************************/ -#include "effectmodel.h" +#include "effectsmodel.h" #include #include @@ -80,17 +80,17 @@ return translatedCategories[index]; } -static EffectModel::Status effectStatus(bool enabled) +static EffectsModel::Status effectStatus(bool enabled) { - return enabled ? EffectModel::Status::Enabled : EffectModel::Status::Disabled; + return enabled ? EffectsModel::Status::Enabled : EffectsModel::Status::Disabled; } -EffectModel::EffectModel(QObject *parent) +EffectsModel::EffectsModel(QObject *parent) : QAbstractItemModel(parent) { } -QHash EffectModel::roleNames() const +QHash EffectsModel::roleNames() const { QHash roleNames; roleNames[NameRole] = "NameRole"; @@ -113,36 +113,36 @@ return roleNames; } -QModelIndex EffectModel::index(int row, int column, const QModelIndex &parent) const +QModelIndex EffectsModel::index(int row, int column, const QModelIndex &parent) const { if (parent.isValid() || column > 0 || column < 0 || row < 0 || row >= m_effectsList.count()) { return {}; } return createIndex(row, column); } -QModelIndex EffectModel::parent(const QModelIndex &child) const +QModelIndex EffectsModel::parent(const QModelIndex &child) const { Q_UNUSED(child) return {}; } -int EffectModel::columnCount(const QModelIndex &parent) const +int EffectsModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent) return 1; } -int EffectModel::rowCount(const QModelIndex &parent) const +int EffectsModel::rowCount(const QModelIndex &parent) const { if (parent.isValid()) { return 0; } return m_effectsList.count(); } -QVariant EffectModel::data(const QModelIndex &index, int role) const +QVariant EffectsModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { return {}; @@ -192,7 +192,7 @@ } } -bool EffectModel::setData(const QModelIndex &index, const QVariant &value, int role) +bool EffectsModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!index.isValid()) { return QAbstractItemModel::setData(index, value, role); @@ -228,7 +228,7 @@ return QAbstractItemModel::setData(index, value, role); } -void EffectModel::loadBuiltInEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs) +void EffectsModel::loadBuiltInEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs) { const auto builtins = BuiltInEffects::availableEffects(); for (auto builtin : builtins) { @@ -274,7 +274,7 @@ } } -void EffectModel::loadJavascriptEffects(const KConfigGroup &kwinConfig) +void EffectsModel::loadJavascriptEffects(const KConfigGroup &kwinConfig) { const auto plugins = KPackage::PackageLoader::self()->listPackages( QStringLiteral("KWin/Effect"), @@ -319,7 +319,7 @@ } } -void EffectModel::loadPluginEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs) +void EffectsModel::loadPluginEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs) { const auto pluginEffects = KPluginLoader::findPlugins( QStringLiteral("kwin/effects/plugins/"), @@ -387,7 +387,7 @@ } } -void EffectModel::load(LoadOptions options) +void EffectsModel::load(LoadOptions options) { KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Plugins"); @@ -473,12 +473,12 @@ endResetModel(); } -void EffectModel::updateEffectStatus(const QModelIndex &rowIndex, Status effectState) +void EffectsModel::updateEffectStatus(const QModelIndex &rowIndex, Status effectState) { setData(rowIndex, static_cast(effectState), StatusRole); } -void EffectModel::save() +void EffectsModel::save() { KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Plugins"); @@ -529,7 +529,7 @@ } } -void EffectModel::defaults() +void EffectsModel::defaults() { for (int i = 0; i < m_effectsList.count(); ++i) { const auto &effect = m_effectsList.at(i); @@ -541,16 +541,16 @@ } } -bool EffectModel::needsSave() const +bool EffectsModel::needsSave() const { return std::any_of(m_effectsList.constBegin(), m_effectsList.constEnd(), [](const EffectData &data) { return data.changed; } ); } -QModelIndex EffectModel::findByPluginId(const QString &pluginId) const +QModelIndex EffectsModel::findByPluginId(const QString &pluginId) const { auto it = std::find_if(m_effectsList.constBegin(), m_effectsList.constEnd(), [pluginId](const EffectData &data) { @@ -595,7 +595,7 @@ return factory->create(pluginId, parent); } -void EffectModel::requestConfigure(const QModelIndex &index, QWindow *transientParent) +void EffectsModel::requestConfigure(const QModelIndex &index, QWindow *transientParent) { if (!index.isValid()) { return; @@ -635,7 +635,7 @@ delete dialog; } -bool EffectModel::shouldStore(const EffectData &data) const +bool EffectsModel::shouldStore(const EffectData &data) const { Q_UNUSED(data) return true; diff --git a/kcmkwin/kwindesktop/animationsmodel.h b/kcmkwin/kwindesktop/animationsmodel.h --- a/kcmkwin/kwindesktop/animationsmodel.h +++ b/kcmkwin/kwindesktop/animationsmodel.h @@ -20,12 +20,12 @@ #pragma once -#include "effectmodel.h" +#include "effectsmodel.h" namespace KWin { -class AnimationsModel : public EffectModel +class AnimationsModel : public EffectsModel { Q_OBJECT Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) diff --git a/kcmkwin/kwindesktop/animationsmodel.cpp b/kcmkwin/kwindesktop/animationsmodel.cpp --- a/kcmkwin/kwindesktop/animationsmodel.cpp +++ b/kcmkwin/kwindesktop/animationsmodel.cpp @@ -24,7 +24,7 @@ { AnimationsModel::AnimationsModel(QObject *parent) - : EffectModel(parent) + : EffectsModel(parent) { connect(this, &AnimationsModel::currentIndexChanged, this, [this] { @@ -78,7 +78,7 @@ QStringLiteral("Virtual Desktop Switching Animation"), Qt::CaseInsensitive); } -EffectModel::Status AnimationsModel::status(int row) const +EffectsModel::Status AnimationsModel::status(int row) const { return Status(data(index(row, 0), static_cast(StatusRole)).toInt()); } @@ -107,26 +107,26 @@ void AnimationsModel::load() { - EffectModel::load(); + EffectsModel::load(); setEnabled(modelCurrentEnabled()); setCurrentIndex(modelCurrentIndex()); } void AnimationsModel::save() { for (int i = 0; i < rowCount(); ++i) { const auto status = (m_enabled && i == m_currentIndex) - ? EffectModel::Status::Enabled - : EffectModel::Status::Disabled; + ? EffectsModel::Status::Enabled + : EffectsModel::Status::Disabled; updateEffectStatus(index(i, 0), status); } - EffectModel::save(); + EffectsModel::save(); } void AnimationsModel::defaults() { - EffectModel::defaults(); + EffectsModel::defaults(); setEnabled(modelCurrentEnabled()); setCurrentIndex(modelCurrentIndex()); } diff --git a/kcmkwin/kwineffects/effectsfilterproxymodel.cpp b/kcmkwin/kwineffects/effectsfilterproxymodel.cpp --- a/kcmkwin/kwineffects/effectsfilterproxymodel.cpp +++ b/kcmkwin/kwineffects/effectsfilterproxymodel.cpp @@ -17,7 +17,7 @@ #include "effectsfilterproxymodel.h" -#include "effectmodel.h" +#include "effectsmodel.h" namespace KWin { @@ -78,22 +78,22 @@ const QModelIndex idx = sourceModel()->index(sourceRow, 0, sourceParent); if (!m_query.isEmpty()) { - const bool matches = idx.data(EffectModel::NameRole).toString().contains(m_query, Qt::CaseInsensitive) || - idx.data(EffectModel::DescriptionRole).toString().contains(m_query, Qt::CaseInsensitive) || - idx.data(EffectModel::CategoryRole).toString().contains(m_query, Qt::CaseInsensitive); + const bool matches = idx.data(EffectsModel::NameRole).toString().contains(m_query, Qt::CaseInsensitive) || + idx.data(EffectsModel::DescriptionRole).toString().contains(m_query, Qt::CaseInsensitive) || + idx.data(EffectsModel::CategoryRole).toString().contains(m_query, Qt::CaseInsensitive); if (!matches) { return false; } } if (m_excludeInternal) { - if (idx.data(EffectModel::InternalRole).toBool()) { + if (idx.data(EffectsModel::InternalRole).toBool()) { return false; } } if (m_excludeUnsupported) { - if (!idx.data(EffectModel::SupportedRole).toBool()) { + if (!idx.data(EffectsModel::SupportedRole).toBool()) { return false; } } diff --git a/kcmkwin/kwineffects/kcm.h b/kcmkwin/kwineffects/kcm.h --- a/kcmkwin/kwineffects/kcm.h +++ b/kcmkwin/kwineffects/kcm.h @@ -25,7 +25,7 @@ namespace KWin { -class EffectModel; +class EffectsModel; class DesktopEffectsKCM : public KQuickAddons::ConfigModule { @@ -50,7 +50,7 @@ void updateNeedsSave(); private: - EffectModel *m_model; + EffectsModel *m_model; Q_DISABLE_COPY(DesktopEffectsKCM) }; diff --git a/kcmkwin/kwineffects/kcm.cpp b/kcmkwin/kwineffects/kcm.cpp --- a/kcmkwin/kwineffects/kcm.cpp +++ b/kcmkwin/kwineffects/kcm.cpp @@ -16,8 +16,8 @@ */ #include "kcm.h" -#include "effectmodel.h" #include "effectsfilterproxymodel.h" +#include "effectsmodel.h" #include #include @@ -35,7 +35,7 @@ DesktopEffectsKCM::DesktopEffectsKCM(QObject *parent, const QVariantList &args) : KQuickAddons::ConfigModule(parent, args) - , m_model(new EffectModel(this)) + , m_model(new EffectsModel(this)) { qmlRegisterType("org.kde.private.kcms.kwin.effects", 1, 0, "EffectsFilterProxyModel"); @@ -51,7 +51,7 @@ setButtons(Apply | Default); - connect(m_model, &EffectModel::dataChanged, this, &DesktopEffectsKCM::updateNeedsSave); + connect(m_model, &EffectsModel::dataChanged, this, &DesktopEffectsKCM::updateNeedsSave); } DesktopEffectsKCM::~DesktopEffectsKCM() @@ -93,7 +93,7 @@ if (dialog->exec() == QDialog::Accepted) { if (!dialog->changedEntries().isEmpty()) { - m_model->load(EffectModel::LoadOptions::KeepDirty); + m_model->load(EffectsModel::LoadOptions::KeepDirty); } }