Recursively load themes

Themes (other than the default theme) can specify a `parent-name` in the
json file. This theme will be used as a base for the theme. Events and
profiles of the children override those in the parents.

For this we move the lookup code into it's separate class and also add
tests.

Closes: #38
This commit is contained in:
Guido Günther
2022-12-11 17:34:38 +01:00
parent 34f8733b2b
commit 242519498a
11 changed files with 629 additions and 81 deletions
@@ -0,0 +1,21 @@
{
"name" : "custom",
"parent-name": "default",
"profiles" : [
{
"name" : "full",
"feedbacks" : [
{
"event-name" : "test-dummy-0",
"type" : "Dummy",
"duration" : 0x10
},
{
"event-name" : "test-dummy-2",
"type" : "Dummy",
"duration" : 0x30
}
]
}
]
}
@@ -0,0 +1,4 @@
{
"name" : "$device",
"parent-name": "default"
}
@@ -0,0 +1,31 @@
{
"name" : "default",
"profiles" : [
{
"name" : "full",
"feedbacks" : [
{
"event-name" : "test-dummy-0",
"type" : "Dummy"
},
{
"event-name" : "test-dummy-1",
"type" : "Dummy"
}
]
},
{
"name" : "quiet",
"feedbacks" : [
{
"event-name" : "test-dummy-0",
"type" : "Dummy"
},
{
"event-name" : "test-dummy-1",
"type" : "Dummy"
}
]
}
]
}
@@ -0,0 +1,21 @@
{
"name" : "$device",
"parent-name": "default",
"profiles" : [
{
"name" : "full",
"feedbacks" : [
{
"event-name" : "test-dummy-0",
"type" : "Dummy",
"duration" : 0x10
},
{
"event-name" : "test-dummy-2",
"type" : "Dummy",
"duration" : 0x20
}
]
}
]
}