diff options
author | Evan Kenny <led00k.net@gmail.com> | 2024-07-01 15:19:17 +0100 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-07-13 19:07:06 -0400 |
commit | 96f42a56467dd72ab42f7e01949ec3cb4b7955df (patch) | |
tree | ac53413ab01aca2e6977ebef3c15bcd0bdffd273 /apps | |
parent | 3891bcf3b9df0b320b2ecbd700de9cedceedb342 (diff) | |
download | rockbox-96f42a56467dd72ab42f7e01949ec3cb4b7955df.tar.gz rockbox-96f42a56467dd72ab42f7e01949ec3cb4b7955df.zip |
skin engine: Add tags to display Quickscreen Items
A set of new tags for themes that allow them to display a quickscreen item's name or value like what is displayed on the default quickscreen.
There are 8 tags in total, 2 for each direction or "item".
One type of tag displays the setting name, while the other displays the setting's value.
All tags output an "ERR" string if no valid setting is found for that item.
Quickscreen Item name tags: %QT, %QR, %QB and %QL.
Quickscreen Item value tags: %Qt, %Qr, %Qb and %Ql.
Change-Id: Ia08ba5940e38065e051a0aefa2cff142c9e58684
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 42c56f7203..ba9396ae74 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include "fixedpoint.h" | 66 | #include "fixedpoint.h" |
67 | #endif | 67 | #endif |
68 | #include "list.h" | 68 | #include "list.h" |
69 | #include "option_select.h" | ||
69 | #include "wps.h" | 70 | #include "wps.h" |
70 | 71 | ||
71 | #define NOINLINE __attribute__ ((noinline)) | 72 | #define NOINLINE __attribute__ ((noinline)) |
@@ -658,6 +659,23 @@ static const char* NOINLINE get_lif_token_value(struct gui_wps *gwps, | |||
658 | return NULL; | 659 | return NULL; |
659 | } | 660 | } |
660 | 661 | ||
662 | #ifdef HAVE_QUICKSCREEN | ||
663 | static const char* get_qs_token_value(enum quickscreen_item item, bool data_token, | ||
664 | char *buf, int buf_size) | ||
665 | { | ||
666 | const struct settings_list *qs_setting = global_settings.qs_items[item]; | ||
667 | |||
668 | if (qs_setting == NULL) | ||
669 | return "ERR"; | ||
670 | |||
671 | if (data_token) | ||
672 | return option_get_valuestring(qs_setting, buf, buf_size, | ||
673 | option_value_as_int(qs_setting)); | ||
674 | |||
675 | return P2STR(ID2P(qs_setting->lang_id)); | ||
676 | } | ||
677 | #endif | ||
678 | |||
661 | /* Return the tags value as text. buf should be used as temp storage if needed. | 679 | /* Return the tags value as text. buf should be used as temp storage if needed. |
662 | 680 | ||
663 | intval is used with conditionals/enums: when this function is called, | 681 | intval is used with conditionals/enums: when this function is called, |
@@ -1374,6 +1392,25 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1374 | return NULL; | 1392 | return NULL; |
1375 | #endif | 1393 | #endif |
1376 | 1394 | ||
1395 | #ifdef HAVE_QUICKSCREEN | ||
1396 | case SKIN_TOKEN_TOP_QUICKSETTING_NAME: | ||
1397 | return get_qs_token_value(QUICKSCREEN_TOP, false, buf, buf_size); | ||
1398 | case SKIN_TOKEN_TOP_QUICKSETTING_VALUE: | ||
1399 | return get_qs_token_value(QUICKSCREEN_TOP, true, buf, buf_size); | ||
1400 | case SKIN_TOKEN_RIGHT_QUICKSETTING_NAME: | ||
1401 | return get_qs_token_value(QUICKSCREEN_RIGHT, false, buf, buf_size); | ||
1402 | case SKIN_TOKEN_RIGHT_QUICKSETTING_VALUE: | ||
1403 | return get_qs_token_value(QUICKSCREEN_RIGHT, true, buf, buf_size); | ||
1404 | case SKIN_TOKEN_BOTTOM_QUICKSETTING_NAME: | ||
1405 | return get_qs_token_value(QUICKSCREEN_BOTTOM, false, buf, buf_size); | ||
1406 | case SKIN_TOKEN_BOTTOM_QUICKSETTING_VALUE: | ||
1407 | return get_qs_token_value(QUICKSCREEN_BOTTOM, true, buf, buf_size); | ||
1408 | case SKIN_TOKEN_LEFT_QUICKSETTING_NAME: | ||
1409 | return get_qs_token_value(QUICKSCREEN_LEFT, false, buf, buf_size); | ||
1410 | case SKIN_TOKEN_LEFT_QUICKSETTING_VALUE: | ||
1411 | return get_qs_token_value(QUICKSCREEN_LEFT, true, buf, buf_size); | ||
1412 | #endif | ||
1413 | |||
1377 | case SKIN_TOKEN_SETTING: | 1414 | case SKIN_TOKEN_SETTING: |
1378 | { | 1415 | { |
1379 | const struct settings_list *s = token->value.xdata; | 1416 | const struct settings_list *s = token->value.xdata; |