Warning, /plasma/kwin/src/kcms/effects/ui/main.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.kcmutils 0014 import org.kde.config 0015 import org.kde.kirigami 2 as Kirigami 0016 import org.kde.newstuff as NewStuff 0017 0018 import org.kde.private.kcms.kwin.effects as Private 0019 0020 ScrollViewKCM { 0021 implicitHeight: Kirigami.Units.gridUnit * 30 0022 implicitWidth: Kirigami.Units.gridUnit * 40 0023 0024 actions: NewStuff.Action { 0025 text: i18nc("@action:button get new KWin effects", "Get New…") 0026 visible: KAuthorized.authorize(KAuthorized.GHNS) 0027 configFile: "kwineffect.knsrc" 0028 onEntryEvent: (entry, event) => { 0029 if (event === NewStuff.Engine.StatusChangedEvent) { 0030 kcm.onGHNSEntriesChanged() 0031 } 0032 } 0033 } 0034 0035 header: ColumnLayout { 0036 spacing: Kirigami.Units.smallSpacing 0037 0038 QQC2.Label { 0039 Layout.fillWidth: true 0040 Layout.leftMargin: Kirigami.Units.smallSpacing 0041 Layout.rightMargin: Kirigami.Units.smallSpacing 0042 0043 wrapMode: Text.WordWrap 0044 text: i18n("Hint: To find out or configure how to activate an effect, look at the effect's settings.") 0045 } 0046 0047 RowLayout { 0048 spacing: Kirigami.Units.smallSpacing 0049 0050 Kirigami.SearchField { 0051 id: searchField 0052 0053 Layout.fillWidth: true 0054 } 0055 0056 QQC2.ToolButton { 0057 id: filterButton 0058 0059 icon.name: "view-filter" 0060 0061 checkable: true 0062 checked: menu.opened 0063 onClicked: menu.popup(filterButton, filterButton.width - menu.width, filterButton.height) 0064 0065 QQC2.ToolTip { 0066 text: i18n("Configure Filter") 0067 } 0068 } 0069 0070 QQC2.Menu { 0071 id: menu 0072 0073 modal: true 0074 0075 QQC2.MenuItem { 0076 checkable: true 0077 checked: searchModel.excludeUnsupported 0078 text: i18n("Exclude unsupported effects") 0079 0080 onToggled: searchModel.excludeUnsupported = checked 0081 } 0082 0083 QQC2.MenuItem { 0084 checkable: true 0085 checked: searchModel.excludeInternal 0086 text: i18n("Exclude internal effects") 0087 0088 onToggled: searchModel.excludeInternal = checked 0089 } 0090 } 0091 } 0092 } 0093 0094 view: ListView { 0095 id: effectsList 0096 0097 // { string name: QQC2.ButtonGroup group } 0098 property var _buttonGroups: new Map() 0099 0100 clip: true 0101 0102 model: Private.EffectsFilterProxyModel { 0103 id: searchModel 0104 0105 query: searchField.text 0106 sourceModel: kcm.effectsModel 0107 } 0108 0109 delegate: Effect { 0110 width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin 0111 } 0112 0113 section.property: "CategoryRole" 0114 section.delegate: Kirigami.ListSectionHeader { 0115 width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin 0116 text: section 0117 } 0118 0119 Component { 0120 id: buttonGroupComponent 0121 0122 QQC2.ButtonGroup {} 0123 } 0124 0125 function findButtonGroup(name: string): QQC2.ButtonGroup { 0126 let group = _buttonGroups.get(name); 0127 if (group === undefined) { 0128 group = buttonGroupComponent.createObject(this); 0129 _buttonGroups.set(name, group); 0130 } 0131 return group; 0132 } 0133 } 0134 }