ClockFace_menu: add "powerSave" menu option

pull/2046/head
Richard de Boer 2022-06-25 22:00:57 +02:00
parent 3bddcd402d
commit ba58178ab3
No known key found for this signature in database
GPG Key ID: 8721727971871937
2 changed files with 6 additions and 2 deletions

View File

@ -208,7 +208,7 @@ let menu = {
/*LANG*/"< Back": back,
};
require("ClockFace_menu").addSettingsFile(menu, "<appid>.settings.json", [
"showDate", "loadWidgets"
"showDate", "loadWidgets", "powerSave",
]);
E.showMenu(menu);

View File

@ -11,12 +11,16 @@ exports.addItems = function(menu, callback, items) {
const label = {
showDate:/*LANG*/"Show date",
loadWidgets:/*LANG*/"Load widgets",
powerSave:/*LANG*/"Power saving",
}[key];
switch(key) {
// boolean options which default to true
case "showDate":
case "loadWidgets":
// boolean options, which default to true
if (value===undefined) value = true;
// fall through
case "powerSave":
// same for all boolean options:
menu[label] = {
value: !!value,
onchange: v => callback(key, v),