feat(color): Use generic YAML parser to save/load Theme yaml files (#3346)

* Change ThemeFile class to use generic YAML parser instead of hard wired code.
Fix handling of empty input lines in YAML parser.
Increase size of YAML parser variables to handle theme 'info' property length.

* Update comment.

* Fix error.

* Proper fix for blank lines in YAML file.

* Fix YAML blank line handling (attempt 3).

* Ensure theme YAML file is backward compatible.

* Store selected theme in radio settings instead of selectedtheme.txt file.
On start, if radio settings theme is empty, try and load from selectedtheme.txt file.
In Companion, save/load the selected theme in the radio settings YAML file; but no UI to select theme.

* Update selected theme name in radio.yml if the theme name was edited.

* Only save 'selectedTheme' in Companion on color LCD radios.
This commit is contained in:
philmoz
2023-04-09 13:32:30 +10:00
committed by GitHub
parent f01b0f2772
commit 92651429a2
17 changed files with 236 additions and 277 deletions
+3 -3
View File
@@ -24,7 +24,7 @@
#include <stdint.h>
#define MAX_STR 100
#define MAX_STR 256
#define MAX_DEPTH 16 // 12 real + 4 virtual
struct YamlParserCalls
@@ -33,7 +33,7 @@ struct YamlParserCalls
bool (*to_child) (void* ctx);
bool (*to_next_elmt) (void* ctx);
bool (*find_node) (void* ctx, char* buf, uint8_t len);
void (*set_attr) (void* ctx, char* buf, uint8_t len);
void (*set_attr) (void* ctx, char* buf, uint16_t len);
};
class YamlParser
@@ -70,7 +70,7 @@ class YamlParser
// scratch buffer w/ 16 bytes
// used for attribute and values
char scratch_buf[MAX_STR];
uint8_t scratch_len;
uint16_t scratch_len;
bool node_found;
bool eof;