Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to filter settings #1374

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions src/settings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,73 @@ import QtQuick.Dialogs 1.0
spacing: 0
anchors.fill: parent

Row
{
spacing: 5
Text
{
text:"Filter"
color: "white"
verticalAlignment: Text.AlignVCenter
}
TextField
{
function checkChildren(test) {
var text = filterField.text.toUpperCase()
for (var i = 0; i < test.children.length; i++)
{
if(test.children[i] instanceof Label || test.children[i] instanceof SwitchDelegate) {
//console.log(test.children[i].objectName);
if(test.children[i].objectName !== undefined) {
if(test.children[i].objectName.indexOf("rebootLabel") !== -1) {
continue;
}
}

if(test.children[i].text !== undefined) {
//console.log(test.children[i].text);
if(test.children[i] instanceof Label) {
test.visible = (test.children[i].text.toUpperCase().indexOf(text) !== -1);
} else {
test.children[i].visible = (test.children[i].text.toUpperCase().indexOf(text) !== -1);
}
}
if(test.children[i].title !== undefined) {
//console.log(test.children[i].title);
if(test.children[i] instanceof Label) {
test.visible = (test.children[i].title.toUpperCase().indexOf(text) !== -1);
} else {
test.children[i].visible = (test.children[i].title.toUpperCase().indexOf(text) !== -1);
}
}
}
if(test.children[i] instanceof AccordionElement) {
test.children[i].isOpen = true;
}
checkChildren(test.children[i]);
}
}

function updateFilter()
{
checkChildren(column1);
}
id: filterField
onTextChanged: updateFilter()
}
}

Label {
Layout.preferredWidth: parent.width
id: rebootLabel
objectName: "rebootLabel"
text: qsTr("Reboot the app in order to apply the settings")
textFormat: Text.PlainText
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
color: Material.color(Material.Red)
}

AccordionElement {
id: generalOptionsAccordion
title: qsTr("General Options")
Expand Down
Loading