KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
/*
|
2020-08-02 22:10:35 +00:00
|
|
|
* SPDX-FileCopyrightText: 2020 Ismael Asensio <isma.af@gmail.com>
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
*
|
2020-08-02 22:10:35 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
import QtQuick.Controls 2.14 as QQC2
|
|
|
|
import org.kde.kirigami 2.10 as Kirigami
|
|
|
|
|
|
|
|
Kirigami.AbstractListItem {
|
|
|
|
id: ruleDelegate
|
|
|
|
|
|
|
|
property bool ruleEnabled: model.enabled
|
|
|
|
|
|
|
|
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
|
|
|
|
|
|
|
width: ListView.view.width
|
|
|
|
highlighted: false
|
|
|
|
hoverEnabled: false
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
id: itemIcon
|
|
|
|
source: model.icon
|
|
|
|
Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium
|
|
|
|
Layout.rightMargin: Kirigami.Units.smallSpacing
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
QQC2.Label {
|
|
|
|
text: model.name
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
elide: Text.ElideRight
|
|
|
|
Layout.preferredWidth: 10 * Kirigami.Units.gridUnit
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
// This layout keeps the width constant between delegates, independent of items visibility
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredWidth: 20 * Kirigami.Units.gridUnit
|
|
|
|
Layout.minimumWidth: 13 * Kirigami.Units.gridUnit
|
|
|
|
|
|
|
|
OptionsComboBox {
|
|
|
|
id: policyCombo
|
|
|
|
Layout.preferredWidth: 50 // 50%
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
flat: true
|
|
|
|
|
|
|
|
visible: count > 0
|
|
|
|
enabled: ruleEnabled
|
|
|
|
|
|
|
|
model: policyModel
|
|
|
|
onActivated: {
|
|
|
|
policy = currentValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ValueEditor {
|
|
|
|
id: valueEditor
|
|
|
|
Layout.preferredWidth: 50 // 50%
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
|
|
|
|
|
|
enabled: model.enabled
|
|
|
|
|
|
|
|
ruleValue: model.value
|
|
|
|
ruleOptions: model.options
|
|
|
|
controlType: model.type
|
|
|
|
|
|
|
|
onValueEdited: (value) => {
|
|
|
|
model.value = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QQC2.ToolButton {
|
|
|
|
id: itemEnabled
|
|
|
|
icon.name: "edit-delete"
|
|
|
|
visible: model.selectable
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
onClicked: {
|
|
|
|
model.enabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QQC2.ToolTip {
|
|
|
|
text: model.description
|
2020-05-15 09:00:09 +00:00
|
|
|
visible: hovered && (text.length > 0)
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|