KCM KWinEffects highlight effects that are not in default state

add EnabledByDefaultFunctionRole in EffectsModel
This commit is contained in:
Cyril Rossi 2021-01-20 10:44:21 +00:00
parent 93ee2f6815
commit d425e78cab
3 changed files with 17 additions and 1 deletions

View file

@ -97,6 +97,7 @@ QHash<int, QByteArray> EffectsModel::roleNames() const
roleNames[ConfigurableRole] = "ConfigurableRole";
roleNames[ScriptedRole] = QByteArrayLiteral("ScriptedRole");
roleNames[EnabledByDefaultRole] = "EnabledByDefaultRole";
roleNames[EnabledByDefaultFunctionRole] = "EnabledByDefaultFunctionRole";
roleNames[ConfigModuleRole] = "ConfigModuleRole";
return roleNames;
}
@ -175,6 +176,8 @@ QVariant EffectsModel::data(const QModelIndex &index, int role) const
return effect.kind == Kind::Scripted;
case EnabledByDefaultRole:
return effect.enabledByDefault;
case EnabledByDefaultFunctionRole:
return effect.enabledByDefaultFunction;
case ConfigModuleRole:
return effect.configModule;
default:

View file

@ -108,7 +108,11 @@ public:
/**
* Id of the effect's config module, empty if the effect has no config.
*/
ConfigModuleRole
ConfigModuleRole,
/**
* Whether the effect has a function to determine if the effect is enabled by default.
*/
EnabledByDefaultFunctionRole,
};
/**

View file

@ -11,6 +11,7 @@ import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kcm 1.5 as KCM
Kirigami.SwipeListItem {
id: listItem
@ -39,6 +40,10 @@ Kirigami.SwipeListItem {
}
_toggled = false;
}
KCM.SettingHighlighter {
highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole
}
}
QQC2.CheckBox {
@ -46,6 +51,10 @@ Kirigami.SwipeListItem {
visible: model.ExclusiveRole == ""
onToggled: model.StatusRole = checkState
KCM.SettingHighlighter {
highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole
}
}
ColumnLayout {