Add PCN theme system

Coexist with the old theme system for now. QML components have to be
updated to use the new system.
This commit is contained in:
miruka
2020-11-17 08:24:55 -04:00
parent 1af1d30c48
commit 42f04b013e
15 changed files with 159 additions and 16 deletions

View File

@@ -519,4 +519,27 @@ QtObject {
return {word, start, end: seen}
}
function getClassPathRegex(obj) {
const regexParts = []
let parent = obj
while (parent) {
if (! parent.ntheme || ! parent.ntheme.classes.length) {
parent = parent.parent
continue
}
const names = []
const end = regexParts.length ? "\\.)?" : ")"
for (let i = 0; i < parent.ntheme.classes.length; i++)
names.push(parent.ntheme.classes[i].name)
regexParts.push("(" + names.join("|") + end)
parent = parent.parent
}
return new RegExp("^" + regexParts.reverse().join("") + "$")
}
}