diff --git a/kcmkwin/kwincompositing/model.cpp b/kcmkwin/kwincompositing/model.cpp index 5d07375324..f5a0e28d08 100644 --- a/kcmkwin/kwincompositing/model.cpp +++ b/kcmkwin/kwincompositing/model.cpp @@ -133,6 +133,8 @@ QVariant EffectModel::data(const QModelIndex &index, int role) const return m_effectsList.at(index.row()).supported; case ExclusiveRole: return m_effectsList.at(index.row()).exclusiveGroup; + case InternalRole: + return m_effectsList.at(index.row()).internal; default: return QVariant(); } @@ -199,6 +201,7 @@ void EffectModel::loadEffects() effect.video = service->property(QStringLiteral("X-KWin-Video-Url"), QVariant::Url).toUrl(); effect.supported = true; effect.exclusiveGroup = service->property(QStringLiteral("X-KWin-Exclusive-Category"), QVariant::String).toString(); + effect.internal = service->property(QStringLiteral("X-KWin-Internal"), QVariant::Bool).toBool(); m_effectsList << effect; } @@ -329,9 +332,12 @@ void EffectModel::defaults() EffectFilterModel::EffectFilterModel(QObject *parent) : QSortFilterProxyModel(parent) , m_effectModel(new EffectModel(this)) - , m_supported(true) + , m_filterOutUnsupported(true) + , m_filterOutInternal(true) { setSourceModel(m_effectModel); + connect(this, &EffectFilterModel::filterOutUnsupportedChanged, this, &EffectFilterModel::invalidateFilter); + connect(this, &EffectFilterModel::filterOutInternalChanged, this, &EffectFilterModel::invalidateFilter); } const QString &EffectFilterModel::filter() const @@ -350,17 +356,6 @@ void EffectFilterModel::setFilter(const QString &filter) invalidateFilter(); } -void EffectFilterModel::setFilterOnSupported(bool supported) -{ - if (m_supported == supported) { - return; - } - - m_supported = supported; - emit filterOnSupportedChanged(); - invalidateFilter(); -} - bool EffectFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { if (!m_effectModel) { @@ -372,9 +367,14 @@ bool EffectFilterModel::filterAcceptsRow(int source_row, const QModelIndex &sour return false; } - if (m_supported) { - bool supported = index.data(EffectModel::SupportedRole).toBool(); - if (!supported) { + if (m_filterOutUnsupported) { + if (!index.data(EffectModel::SupportedRole).toBool()) { + return false; + } + } + + if (m_filterOutInternal) { + if (index.data(EffectModel::InternalRole).toBool()) { return false; } } diff --git a/kcmkwin/kwincompositing/model.h b/kcmkwin/kwincompositing/model.h index 7bb9812fcb..5c07023395 100644 --- a/kcmkwin/kwincompositing/model.h +++ b/kcmkwin/kwincompositing/model.h @@ -48,6 +48,7 @@ struct EffectData { QUrl video; bool supported; QString exclusiveGroup; + bool internal; }; class EffectModel : public QAbstractItemModel @@ -69,7 +70,8 @@ public: WindowManagementRole, VideoRole, SupportedRole, - ExclusiveRole + ExclusiveRole, + InternalRole }; explicit EffectModel(QObject *parent = 0); @@ -131,7 +133,12 @@ class EffectFilterModel : public QSortFilterProxyModel * If @c true not supported effects are excluded, if @c false no restriction on supported. * Default value is @c true. **/ - Q_PROPERTY(bool filterOnSupported READ isFilterOnSupported WRITE setFilterOnSupported NOTIFY filterOnSupportedChanged) + Q_PROPERTY(bool filterOutUnsupported MEMBER m_filterOutUnsupported NOTIFY filterOutUnsupportedChanged) + /** + * If @c true internal effects are excluded, if @c false no restriction on internal. + * Default value is @c true. + **/ + Q_PROPERTY(bool filterOutInternal MEMBER m_filterOutInternal NOTIFY filterOutInternalChanged) Q_PROPERTY(QColor backgroundActiveColor READ backgroundActiveColor CONSTANT); Q_PROPERTY(QColor backgroundNormalColor READ backgroundNormalColor CONSTANT); Q_PROPERTY(QColor backgroundAlternateColor READ backgroundAlternateColor CONSTANT); @@ -154,11 +161,6 @@ public: return color; } - void setFilterOnSupported(bool supported); - bool isFilterOnSupported() const { - return m_supported; - } - void defaults(); public Q_SLOTS: @@ -170,12 +172,14 @@ protected: Q_SIGNALS: void effectModelChanged(); void filterChanged(); - void filterOnSupportedChanged(); + void filterOutUnsupportedChanged(); + void filterOutInternalChanged(); private: EffectModel *m_effectModel; QString m_filter; - bool m_supported; + bool m_filterOutUnsupported; + bool m_filterOutInternal; }; } } diff --git a/kcmkwin/kwincompositing/qml/EffectView.qml b/kcmkwin/kwincompositing/qml/EffectView.qml index 03a4ef8100..74c3f8ffea 100644 --- a/kcmkwin/kwincompositing/qml/EffectView.qml +++ b/kcmkwin/kwincompositing/qml/EffectView.qml @@ -80,11 +80,19 @@ Item { tooltip: "Configure filter" menu: Menu { MenuItem { - text: i18n("Filter only on Desktop Effects supported by the Compositor") + text: i18n("Exclude Desktop Effects not supported by the Compositor") checkable: true - checked: searchModel.filterOnSupported + checked: searchModel.filterOutUnsupported onTriggered: { - searchModel.filterOnSupported = !searchModel.filterOnSupported; + searchModel.filterOutUnsupported = !searchModel.filterOutUnsupported; + } + } + MenuItem { + text: i18n("Exclude internal Desktop Effects") + checkable: true + checked: searchModel.filterOutInternal + onTriggered: { + searchModel.filterOutInternal = !searchModel.filterOutInternal } } }