Warning, /plasma/kwin/src/kcms/effects/ui/Effect.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2013 Antonis Tsiapaliokas <kok3rs@gmail.com>
0003     SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0004     SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 import QtQuick
0010 import QtQuick.Controls as QQC2
0011 import QtQuick.Layouts
0012 
0013 import org.kde.kirigami 2 as Kirigami
0014 import org.kde.kcmutils as KCM
0015 
0016 QQC2.ItemDelegate {
0017     id: listItem
0018 
0019     hoverEnabled: true
0020 
0021     onClicked: {
0022         if (ListView.isCurrentItem) {
0023             // Collapse list item
0024             ListView.view.currentIndex = -1;
0025         } else {
0026             // Expand list item
0027             ListView.view.currentIndex = index;
0028         }
0029     }
0030 
0031     contentItem: RowLayout {
0032         spacing: Kirigami.Units.smallSpacing
0033 
0034         QQC2.RadioButton {
0035             readonly property bool _exclusive: model.ExclusiveRole != ""
0036             property bool _toggled: false
0037 
0038             checked: model.StatusRole
0039             visible: _exclusive
0040             QQC2.ButtonGroup.group: _exclusive ? effectsList.findButtonGroup(model.ExclusiveRole) : null
0041 
0042             onToggled: {
0043                 model.StatusRole = checked ? Qt.Checked : Qt.Unchecked;
0044                 _toggled = true;
0045             }
0046 
0047             onClicked: {
0048                 // Uncheck the radio button if it's clicked.
0049                 if (checked && !_toggled) {
0050                     model.StatusRole = Qt.Unchecked;
0051                 }
0052                 _toggled = false;
0053             }
0054 
0055             KCM.SettingHighlighter {
0056                 highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole
0057             }
0058         }
0059 
0060         QQC2.CheckBox {
0061             checkState: model.StatusRole
0062             visible: model.ExclusiveRole == ""
0063 
0064             onToggled: model.StatusRole = checkState
0065 
0066             KCM.SettingHighlighter {
0067                 highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole
0068             }
0069         }
0070 
0071         ColumnLayout {
0072             Layout.topMargin: Kirigami.Units.smallSpacing
0073             Layout.bottomMargin: Kirigami.Units.smallSpacing
0074             spacing: 0
0075 
0076             Kirigami.Heading {
0077                 Layout.fillWidth: true
0078 
0079                 level: 5
0080                 text: model.NameRole
0081                 wrapMode: Text.Wrap
0082             }
0083 
0084             QQC2.Label {
0085                 Layout.fillWidth: true
0086 
0087                 text: model.DescriptionRole
0088                 opacity: listItem.hovered ? 0.8 : 0.6
0089                 wrapMode: Text.Wrap
0090             }
0091 
0092             QQC2.Label {
0093                 id: aboutItem
0094 
0095                 Layout.fillWidth: true
0096 
0097                 text: i18n("Author: %1\nLicense: %2", model.AuthorNameRole, model.LicenseRole)
0098                 opacity: listItem.hovered ? 0.8 : 0.6
0099                 visible: listItem.ListView.isCurrentItem
0100                 wrapMode: Text.Wrap
0101             }
0102 
0103             Loader {
0104                 id: videoItem
0105 
0106                 active: false
0107                 source: "Video.qml"
0108                 visible: false
0109 
0110                 function showHide() {
0111                     if (!videoItem.active) {
0112                         videoItem.active = true;
0113                         videoItem.visible = true;
0114                     } else {
0115                         videoItem.active = false;
0116                         videoItem.visible = false;
0117                     }
0118                 }
0119             }
0120         }
0121 
0122         QQC2.ToolButton {
0123             visible: model.VideoRole.toString() !== ""
0124             icon.name: "videoclip-amarok"
0125             text: i18nc("@info:tooltip", "Show/Hide Video")
0126             display: QQC2.AbstractButton.IconOnly
0127             QQC2.ToolTip.text: text
0128             QQC2.ToolTip.visible: hovered
0129             onClicked: videoItem.showHide()
0130         }
0131 
0132         QQC2.ToolButton  {
0133             visible: model.ConfigurableRole
0134             enabled: model.StatusRole != Qt.Unchecked
0135             icon.name: "configure"
0136             text: i18nc("@info:tooltip", "Configureā€¦")
0137             display: QQC2.AbstractButton.IconOnly
0138             QQC2.ToolTip.text: text
0139             QQC2.ToolTip.visible: hovered
0140             onClicked: kcm.configure(model.ServiceNameRole, listItem)
0141         }
0142     }
0143 }