Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwineffects/package/contents/ui/main.qml
Show All 10 Lines | |||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.1 | 19 | import QtQuick 2.5 | ||
20 | import QtQuick.Controls 2.5 as QtControls | 20 | import QtQuick.Controls 2.5 as QQC2 | ||
21 | import QtQuick.Layouts 1.1 | 21 | import QtQuick.Layouts 1.1 | ||
22 | | ||||
22 | import org.kde.kcm 1.2 | 23 | import org.kde.kcm 1.2 | ||
23 | import org.kde.kconfig 1.0 | 24 | import org.kde.kconfig 1.0 | ||
24 | import org.kde.kirigami 2.8 as Kirigami | 25 | import org.kde.kirigami 2.8 as Kirigami | ||
25 | import org.kde.private.kcms.kwin.effects 1.0 as Private | 26 | import org.kde.private.kcms.kwin.effects 1.0 as Private | ||
26 | 27 | | |||
27 | ScrollViewKCM { | 28 | ScrollViewKCM { | ||
28 | ConfigModule.quickHelp: i18n("This module lets you configure desktop effects.") | 29 | ConfigModule.quickHelp: i18n("This module lets you configure desktop effects.") | ||
29 | 30 | | |||
30 | header: ColumnLayout { | 31 | header: ColumnLayout { | ||
31 | QtControls.Label { | 32 | QQC2.Label { | ||
32 | Layout.fillWidth: true | 33 | Layout.fillWidth: true | ||
33 | 34 | | |||
34 | elide: Text.ElideRight | 35 | elide: Text.ElideRight | ||
35 | text: i18n("Hint: To find out or configure how to activate an effect, look at the effect's settings.") | 36 | text: i18n("Hint: To find out or configure how to activate an effect, look at the effect's settings.") | ||
36 | } | 37 | } | ||
37 | 38 | | |||
38 | RowLayout { | 39 | RowLayout { | ||
39 | Kirigami.SearchField { | 40 | Kirigami.SearchField { | ||
40 | id: searchField | 41 | id: searchField | ||
41 | 42 | | |||
42 | Layout.fillWidth: true | 43 | Layout.fillWidth: true | ||
43 | } | 44 | } | ||
44 | 45 | | |||
45 | QtControls.Button { | 46 | QQC2.ToolButton { | ||
46 | id: configureButton | 47 | id: filterButton | ||
47 | 48 | | |||
48 | QtControls.ToolTip.visible: hovered | 49 | icon.name: "view-filter" | ||
49 | QtControls.ToolTip.text: i18n("Configure filter") | | |||
50 | 50 | | |||
51 | icon.name: "configure" | 51 | checkable: true | ||
52 | checked: menu.opened | ||||
53 | onClicked: menu.popup(filterButton, filterButton.width - menu.width, filterButton.height) | ||||
52 | 54 | | |||
53 | onClicked: menu.opened ? menu.close() : menu.open() | 55 | QQC2.ToolTip { | ||
56 | text: i18n("Configure Filter") | ||||
57 | } | ||||
54 | } | 58 | } | ||
55 | 59 | | |||
56 | QtControls.Menu { | 60 | QQC2.Menu { | ||
57 | id: menu | 61 | id: menu | ||
58 | 62 | | |||
59 | x: parent.width - width | 63 | modal: true | ||
60 | y: configureButton.height | | |||
61 | 64 | | |||
62 | QtControls.MenuItem { | 65 | QQC2.MenuItem { | ||
63 | checkable: true | 66 | checkable: true | ||
64 | checked: searchModel.excludeUnsupported | 67 | checked: searchModel.excludeUnsupported | ||
65 | text: i18n("Exclude Desktop Effects not supported by the Compositor") | 68 | text: i18n("Exclude unsupported effects") | ||
66 | 69 | | |||
67 | onToggled: searchModel.excludeUnsupported = checked | 70 | onToggled: searchModel.excludeUnsupported = checked | ||
68 | } | 71 | } | ||
69 | 72 | | |||
70 | QtControls.MenuItem { | 73 | QQC2.MenuItem { | ||
71 | checkable: true | 74 | checkable: true | ||
72 | checked: searchModel.excludeInternal | 75 | checked: searchModel.excludeInternal | ||
73 | text: i18n("Exclude internal Desktop Effects") | 76 | text: i18n("Exclude internal effects") | ||
74 | 77 | | |||
75 | onToggled: searchModel.excludeInternal = checked | 78 | onToggled: searchModel.excludeInternal = checked | ||
76 | } | 79 | } | ||
77 | } | 80 | } | ||
78 | } | 81 | } | ||
79 | } | 82 | } | ||
80 | 83 | | |||
81 | view: ListView { | 84 | view: ListView { | ||
82 | id: effectsList | 85 | id: effectsList | ||
83 | 86 | | |||
84 | property var _buttonGroups: [] | 87 | property var _buttonGroups: [] | ||
85 | 88 | | |||
86 | spacing: Kirigami.Units.smallSpacing | | |||
87 | | ||||
88 | model: Private.EffectsFilterProxyModel { | 89 | model: Private.EffectsFilterProxyModel { | ||
89 | id: searchModel | 90 | id: searchModel | ||
90 | 91 | | |||
91 | query: searchField.text | 92 | query: searchField.text | ||
92 | sourceModel: kcm.effectsModel | 93 | sourceModel: kcm.effectsModel | ||
93 | } | 94 | } | ||
94 | 95 | | |||
95 | delegate: Effect { | 96 | delegate: Effect { | ||
96 | width: effectsList.width | 97 | width: effectsList.width | ||
97 | } | 98 | } | ||
98 | 99 | | |||
99 | section.property: "CategoryRole" | 100 | section.property: "CategoryRole" | ||
100 | section.delegate: Item { | 101 | section.delegate:Kirigami.AbstractListItem { | ||
101 | width: effectsList.width | 102 | width: effectsList.width | ||
102 | height: sectionText.implicitHeight + 2 * Kirigami.Units.smallSpacing | | |||
103 | 103 | | |||
104 | QtControls.Label { | 104 | backgroundColor: Kirigami.Theme.backgroundColor | ||
105 | id: sectionText | 105 | Kirigami.Theme.inherit: false | ||
106 | Kirigami.Theme.colorSet: Kirigami.Theme.Window | ||||
106 | 107 | | |||
107 | anchors.fill: parent | 108 | hoverEnabled: false | ||
109 | supportsMouseEvents: false | ||||
108 | 110 | | |||
109 | color: Kirigami.Theme.disabledTextColor | 111 | Kirigami.Heading { | ||
110 | font.weight: Font.Bold | 112 | level: 3 | ||
111 | horizontalAlignment: Text.AlignHCenter | | |||
112 | text: section | 113 | text: section | ||
113 | verticalAlignment: Text.AlignVCenter | | |||
114 | } | 114 | } | ||
115 | } | 115 | } | ||
116 | 116 | | |||
117 | function findButtonGroup(name) { | 117 | function findButtonGroup(name) { | ||
118 | for (let item of effectsList._buttonGroups) { | 118 | for (let item of effectsList._buttonGroups) { | ||
119 | if (item.name == name) { | 119 | if (item.name == name) { | ||
120 | return item.group; | 120 | return item.group; | ||
121 | } | 121 | } | ||
122 | } | 122 | } | ||
123 | 123 | | |||
124 | let group = Qt.createQmlObject( | 124 | let group = Qt.createQmlObject( | ||
125 | 'import QtQuick 2.1;' + | 125 | 'import QtQuick 2.5;' + | ||
126 | 'import QtQuick.Controls 2.5;' + | 126 | 'import QtQuick.Controls 2.5;' + | ||
127 | 'ButtonGroup {}', | 127 | 'ButtonGroup {}', | ||
128 | effectsList, | 128 | effectsList, | ||
129 | "dynamicButtonGroup" + effectsList._buttonGroups.length | 129 | "dynamicButtonGroup" + effectsList._buttonGroups.length | ||
130 | ); | 130 | ); | ||
131 | 131 | | |||
132 | effectsList._buttonGroups.push({ name, group }); | 132 | effectsList._buttonGroups.push({ name, group }); | ||
133 | 133 | | |||
134 | return group; | 134 | return group; | ||
135 | } | 135 | } | ||
136 | } | 136 | } | ||
137 | 137 | | |||
138 | footer: ColumnLayout { | 138 | footer: ColumnLayout { | ||
139 | RowLayout { | 139 | RowLayout { | ||
140 | Layout.alignment: Qt.AlignRight | 140 | Layout.alignment: Qt.AlignRight | ||
141 | 141 | | |||
142 | QtControls.Button { | 142 | QQC2.Button { | ||
143 | icon.name: "get-hot-new-stuff" | 143 | icon.name: "get-hot-new-stuff" | ||
144 | text: i18n("Get New Desktop Effects...") | 144 | text: i18n("Get New Desktop Effects...") | ||
145 | visible: KAuthorized.authorize("ghns") | 145 | visible: KAuthorized.authorize("ghns") | ||
146 | 146 | | |||
147 | onClicked: kcm.openGHNS(this) | 147 | onClicked: kcm.openGHNS(this) | ||
148 | } | 148 | } | ||
149 | } | 149 | } | ||
150 | } | 150 | } | ||
151 | } | 151 | } |