9import QtQuick.Controls as Controls
10import org.kde.kirigami as Kirigami
11import org.kde.kirigamiaddons.formcard as FormCard
12import org.kde.kirigamiaddons.settings
14FormCard.FormCardPage {
17 required property string defaultModule
18 required property list<ConfigurationModule> modules
22 property var pageCache:
Object.create(null)
24 property bool initDone:
false
26 title:
i18ndc(
"kirigami-addons6",
"@title",
"Settings")
29 target:
window.pageStack.layers
31 function onBusyChanged(): void {
32 if (!
window.pageStack.layers.busy && !initDone) {
33 const module = getModuleByName(defaultModule);
35 window.pageStack.layers.push(pageForModule(module));
44 Layout.fillWidth:
true
45 Layout.topMargin:
Kirigami.Units.gridUnit
48 Layout.fillWidth:
true
51 topPadding:
Kirigami.Units.smallSpacing
52 bottomPadding:
Kirigami.Units.smallSpacing
56 Layout.fillWidth:
true
58 onTextChanged: repeater.filterText = text.toLowerCase();
67 property string filterText:
""
70 const isFiltering = filterText.length !== 0;
71 let filteredCategories =
new Array();
73 for (let i in root.modules) {
74 const module = modules[i];
75 const modulePassesFilter =
module.text.toLowerCase().includes(filterText);
76 if (module.visible && (isFiltering ? modulePassesFilter :
true)) {
77 const category = filteredCategories.find((category) =>
category.name === module.category);
81 filteredCategories.push({
82 name:
module.category,
88 return filteredCategories;
94 required
property var modelData
99 title: categoryDelegate.modelData.name ===
"_main_category" ?
i18ndc(
"kirigami-addons6",
"@title:group",
"Settings") : modelData.
name
109 model: categoryDelegate.modelData.modules
110 delegate: ColumnLayout {
113 required property int index
116 Layout.fillWidth: true
119 visible: moduleDelegate.index !== 0
126 root.window.pageStack.layers.push(pageForModule(modelData));
129 contentItem: RowLayout {
131 source: moduleDelegate.modelData.icon.name
132 Layout.rightMargin:
Kirigami.Units.largeSpacing
133 implicitWidth:
Kirigami.Units.iconSizes.medium
134 implicitHeight:
Kirigami.Units.iconSizes.medium
138 Layout.fillWidth:
true
139 text: moduleDelegate.modelData.text
140 elide:
Text.ElideRight
144 Layout.alignment:
Qt.AlignRight
145 source:
"arrow-right"
146 implicitWidth: Math.round(
Kirigami.Units.iconSizes.small * 0.75)
147 implicitHeight: Math.round(
Kirigami.Units.iconSizes.small * 0.75)
159 if (pageCache[module.moduleId]) {
160 return pageCache[module.moduleId];
162 const component =
module.page();
163 if (component.status === Component.Error) {
164 console.error(component.errorString());
166 const page = component.createObject(root, module.initialProperties());
167 if (page.title.length === 0) {
168 page.title =
module.text;
170 pageCache[module.moduleId] = page;
176 return modules.
find(module => module.moduleId == moduleId) ?? null;
This object holds the information of configuration module.
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QString name(StandardAction id)
Category category(StandardShortcut id)