summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Kenny <led00k.net@gmail.com>2024-07-01 15:19:17 +0100
committerSolomon Peachy <pizza@shaftnet.org>2024-07-13 19:07:06 -0400
commit96f42a56467dd72ab42f7e01949ec3cb4b7955df (patch)
treeac53413ab01aca2e6977ebef3c15bcd0bdffd273
parent3891bcf3b9df0b320b2ecbd700de9cedceedb342 (diff)
downloadrockbox-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
-rw-r--r--apps/gui/skin_engine/skin_tokens.c37
-rw-r--r--lib/skin_parser/tag_table.c9
-rw-r--r--lib/skin_parser/tag_table.h10
-rw-r--r--manual/appendix/wps_tags.tex18
4 files changed, 74 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
663static 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;
diff --git a/lib/skin_parser/tag_table.c b/lib/skin_parser/tag_table.c
index d2aded1b12..d9d3cebaca 100644
--- a/lib/skin_parser/tag_table.c
+++ b/lib/skin_parser/tag_table.c
@@ -210,6 +210,15 @@ static const struct tag_info legal_tags[] =
210 { SKIN_TOKEN_VIEWPORT_CONDITIONAL, "Vl" , "S[IP][IP][ip][ip]i", 0 }, 210 { SKIN_TOKEN_VIEWPORT_CONDITIONAL, "Vl" , "S[IP][IP][ip][ip]i", 0 },
211 { SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "s[IP][IP][ip][ip]i", 0 }, 211 { SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "s[IP][IP][ip][ip]i", 0 },
212 { SKIN_TOKEN_VIEWPORT_LOAD, "V" , "[IP][IP][ip][ip]i", 0 }, 212 { SKIN_TOKEN_VIEWPORT_LOAD, "V" , "[IP][IP][ip][ip]i", 0 },
213
214 { SKIN_TOKEN_TOP_QUICKSETTING_NAME, "QT" , "", SKIN_REFRESH_DYNAMIC },
215 { SKIN_TOKEN_TOP_QUICKSETTING_VALUE, "Qt" , "", SKIN_REFRESH_DYNAMIC },
216 { SKIN_TOKEN_RIGHT_QUICKSETTING_NAME, "QR" , "", SKIN_REFRESH_DYNAMIC },
217 { SKIN_TOKEN_RIGHT_QUICKSETTING_VALUE, "Qr" , "", SKIN_REFRESH_DYNAMIC },
218 { SKIN_TOKEN_BOTTOM_QUICKSETTING_NAME, "QB" , "", SKIN_REFRESH_DYNAMIC },
219 { SKIN_TOKEN_BOTTOM_QUICKSETTING_VALUE, "Qb" , "", SKIN_REFRESH_DYNAMIC },
220 { SKIN_TOKEN_LEFT_QUICKSETTING_NAME, "QL" , "", SKIN_REFRESH_DYNAMIC },
221 { SKIN_TOKEN_LEFT_QUICKSETTING_VALUE, "Ql" , "", SKIN_REFRESH_DYNAMIC },
213 222
214 { SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f", SKIN_REFRESH_STATIC|NOBREAK }, 223 { SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f", SKIN_REFRESH_STATIC|NOBREAK },
215 /* This uses the bar tag params also but the first item can be a string 224 /* This uses the bar tag params also but the first item can be a string
diff --git a/lib/skin_parser/tag_table.h b/lib/skin_parser/tag_table.h
index 54ba23ce6e..6807be3f0e 100644
--- a/lib/skin_parser/tag_table.h
+++ b/lib/skin_parser/tag_table.h
@@ -245,6 +245,16 @@ enum skin_token_type {
245 SKIN_TOKEN_MAIN_HOLD, 245 SKIN_TOKEN_MAIN_HOLD,
246 SKIN_TOKEN_REMOTE_HOLD, 246 SKIN_TOKEN_REMOTE_HOLD,
247 247
248 /* Quickscreen */
249 SKIN_TOKEN_TOP_QUICKSETTING_NAME,
250 SKIN_TOKEN_TOP_QUICKSETTING_VALUE,
251 SKIN_TOKEN_RIGHT_QUICKSETTING_NAME,
252 SKIN_TOKEN_RIGHT_QUICKSETTING_VALUE,
253 SKIN_TOKEN_BOTTOM_QUICKSETTING_NAME,
254 SKIN_TOKEN_BOTTOM_QUICKSETTING_VALUE,
255 SKIN_TOKEN_LEFT_QUICKSETTING_NAME,
256 SKIN_TOKEN_LEFT_QUICKSETTING_VALUE,
257
248 /* Setting option */ 258 /* Setting option */
249 SKIN_TOKEN_SETTING, 259 SKIN_TOKEN_SETTING,
250 SKIN_TOKEN_SETTINGBAR, 260 SKIN_TOKEN_SETTINGBAR,
diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex
index ecdae6c0b9..567edd3c11 100644
--- a/manual/appendix/wps_tags.tex
+++ b/manual/appendix/wps_tags.tex
@@ -354,6 +354,24 @@ Examples:
354\item As a conditional: \config{\%?St(eq enabled)<Eq is enabled|Eq is disabled>} 354\item As a conditional: \config{\%?St(eq enabled)<Eq is enabled|Eq is disabled>}
355\end{enumerate} 355\end{enumerate}
356 356
357\opt{quickscreen}{
358\subsection{Displaying Quickscreen settings}
359
360If your player has a quickscreen, the preset settings can be displayed using the following.
361
362\begin{tagmap}
363 \config{\%QT} & Display the name of the top quickscreen setting.\\
364 \config{\%Qt} & Display the value of the top quickscreen setting.\\
365 \config{\%QR} & Display the name of the right quickscreen setting.\\
366 \config{\%Qr} & Display the value of the right quickscreen setting.\\
367 \config{\%QB} & Display the name of the bottom quickscreen setting.\\
368 \config{\%Qb} & Display the value of the bottom quickscreen setting.\\
369 \config{\%QL} & Display the name of the left quickscreen setting.\\
370 \config{\%Ql} & Display the value of the left quickscreen setting.\\
371 \end{tagmap}
372
373 \note{If a preset does not match a legal setting, or has no setting applied, all tags will display "ERR".}
374}
357 375
358\section{\label{ref:wps_images}Images} 376\section{\label{ref:wps_images}Images}
359 \begin{tagmap} 377 \begin{tagmap}