Commit d425e78c authored by Cyril Rossi's avatar Cyril Rossi
Browse files

KCM KWinEffects highlight effects that are not in default state

add EnabledByDefaultFunctionRole in EffectsModel
parent 93ee2f68
...@@ -97,6 +97,7 @@ QHash<int, QByteArray> EffectsModel::roleNames() const ...@@ -97,6 +97,7 @@ QHash<int, QByteArray> EffectsModel::roleNames() const
roleNames[ConfigurableRole] = "ConfigurableRole"; roleNames[ConfigurableRole] = "ConfigurableRole";
roleNames[ScriptedRole] = QByteArrayLiteral("ScriptedRole"); roleNames[ScriptedRole] = QByteArrayLiteral("ScriptedRole");
roleNames[EnabledByDefaultRole] = "EnabledByDefaultRole"; roleNames[EnabledByDefaultRole] = "EnabledByDefaultRole";
roleNames[EnabledByDefaultFunctionRole] = "EnabledByDefaultFunctionRole";
roleNames[ConfigModuleRole] = "ConfigModuleRole"; roleNames[ConfigModuleRole] = "ConfigModuleRole";
return roleNames; return roleNames;
} }
...@@ -175,6 +176,8 @@ QVariant EffectsModel::data(const QModelIndex &index, int role) const ...@@ -175,6 +176,8 @@ QVariant EffectsModel::data(const QModelIndex &index, int role) const
return effect.kind == Kind::Scripted; return effect.kind == Kind::Scripted;
case EnabledByDefaultRole: case EnabledByDefaultRole:
return effect.enabledByDefault; return effect.enabledByDefault;
case EnabledByDefaultFunctionRole:
return effect.enabledByDefaultFunction;
case ConfigModuleRole: case ConfigModuleRole:
return effect.configModule; return effect.configModule;
default: default:
......
...@@ -108,7 +108,11 @@ public: ...@@ -108,7 +108,11 @@ public:
/** /**
* Id of the effect's config module, empty if the effect has no config. * 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,
}; };
/** /**
......
...@@ -11,6 +11,7 @@ import QtQuick.Controls 2.5 as QQC2 ...@@ -11,6 +11,7 @@ import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami import org.kde.kirigami 2.5 as Kirigami
import org.kde.kcm 1.5 as KCM
Kirigami.SwipeListItem { Kirigami.SwipeListItem {
id: listItem id: listItem
...@@ -39,6 +40,10 @@ Kirigami.SwipeListItem { ...@@ -39,6 +40,10 @@ Kirigami.SwipeListItem {
} }
_toggled = false; _toggled = false;
} }
KCM.SettingHighlighter {
highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole
}
} }
QQC2.CheckBox { QQC2.CheckBox {
...@@ -46,6 +51,10 @@ Kirigami.SwipeListItem { ...@@ -46,6 +51,10 @@ Kirigami.SwipeListItem {
visible: model.ExclusiveRole == "" visible: model.ExclusiveRole == ""
onToggled: model.StatusRole = checkState onToggled: model.StatusRole = checkState
KCM.SettingHighlighter {
highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole
}
} }
ColumnLayout { ColumnLayout {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment