1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Evan Kenny 2024-07-01 15:19:17 +01:00 committed by Solomon Peachy
parent 3891bcf3b9
commit 96f42a5646
4 changed files with 74 additions and 0 deletions

View file

@ -66,6 +66,7 @@
#include "fixedpoint.h"
#endif
#include "list.h"
#include "option_select.h"
#include "wps.h"
#define NOINLINE __attribute__ ((noinline))
@ -658,6 +659,23 @@ static const char* NOINLINE get_lif_token_value(struct gui_wps *gwps,
return NULL;
}
#ifdef HAVE_QUICKSCREEN
static const char* get_qs_token_value(enum quickscreen_item item, bool data_token,
char *buf, int buf_size)
{
const struct settings_list *qs_setting = global_settings.qs_items[item];
if (qs_setting == NULL)
return "ERR";
if (data_token)
return option_get_valuestring(qs_setting, buf, buf_size,
option_value_as_int(qs_setting));
return P2STR(ID2P(qs_setting->lang_id));
}
#endif
/* Return the tags value as text. buf should be used as temp storage if needed.
intval is used with conditionals/enums: when this function is called,
@ -1374,6 +1392,25 @@ const char *get_token_value(struct gui_wps *gwps,
return NULL;
#endif
#ifdef HAVE_QUICKSCREEN
case SKIN_TOKEN_TOP_QUICKSETTING_NAME:
return get_qs_token_value(QUICKSCREEN_TOP, false, buf, buf_size);
case SKIN_TOKEN_TOP_QUICKSETTING_VALUE:
return get_qs_token_value(QUICKSCREEN_TOP, true, buf, buf_size);
case SKIN_TOKEN_RIGHT_QUICKSETTING_NAME:
return get_qs_token_value(QUICKSCREEN_RIGHT, false, buf, buf_size);
case SKIN_TOKEN_RIGHT_QUICKSETTING_VALUE:
return get_qs_token_value(QUICKSCREEN_RIGHT, true, buf, buf_size);
case SKIN_TOKEN_BOTTOM_QUICKSETTING_NAME:
return get_qs_token_value(QUICKSCREEN_BOTTOM, false, buf, buf_size);
case SKIN_TOKEN_BOTTOM_QUICKSETTING_VALUE:
return get_qs_token_value(QUICKSCREEN_BOTTOM, true, buf, buf_size);
case SKIN_TOKEN_LEFT_QUICKSETTING_NAME:
return get_qs_token_value(QUICKSCREEN_LEFT, false, buf, buf_size);
case SKIN_TOKEN_LEFT_QUICKSETTING_VALUE:
return get_qs_token_value(QUICKSCREEN_LEFT, true, buf, buf_size);
#endif
case SKIN_TOKEN_SETTING:
{
const struct settings_list *s = token->value.xdata;

View file

@ -211,6 +211,15 @@ static const struct tag_info legal_tags[] =
{ SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "s[IP][IP][ip][ip]i", 0 },
{ SKIN_TOKEN_VIEWPORT_LOAD, "V" , "[IP][IP][ip][ip]i", 0 },
{ SKIN_TOKEN_TOP_QUICKSETTING_NAME, "QT" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_TOP_QUICKSETTING_VALUE, "Qt" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_RIGHT_QUICKSETTING_NAME, "QR" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_RIGHT_QUICKSETTING_VALUE, "Qr" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_BOTTOM_QUICKSETTING_NAME, "QB" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_BOTTOM_QUICKSETTING_VALUE, "Qb" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_LEFT_QUICKSETTING_NAME, "QL" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_LEFT_QUICKSETTING_VALUE, "Ql" , "", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f", SKIN_REFRESH_STATIC|NOBREAK },
/* This uses the bar tag params also but the first item can be a string
* and we don't allow no params. */

View file

@ -245,6 +245,16 @@ enum skin_token_type {
SKIN_TOKEN_MAIN_HOLD,
SKIN_TOKEN_REMOTE_HOLD,
/* Quickscreen */
SKIN_TOKEN_TOP_QUICKSETTING_NAME,
SKIN_TOKEN_TOP_QUICKSETTING_VALUE,
SKIN_TOKEN_RIGHT_QUICKSETTING_NAME,
SKIN_TOKEN_RIGHT_QUICKSETTING_VALUE,
SKIN_TOKEN_BOTTOM_QUICKSETTING_NAME,
SKIN_TOKEN_BOTTOM_QUICKSETTING_VALUE,
SKIN_TOKEN_LEFT_QUICKSETTING_NAME,
SKIN_TOKEN_LEFT_QUICKSETTING_VALUE,
/* Setting option */
SKIN_TOKEN_SETTING,
SKIN_TOKEN_SETTINGBAR,

View file

@ -354,6 +354,24 @@ Examples:
\item As a conditional: \config{\%?St(eq enabled)<Eq is enabled|Eq is disabled>}
\end{enumerate}
\opt{quickscreen}{
\subsection{Displaying Quickscreen settings}
If your player has a quickscreen, the preset settings can be displayed using the following.
\begin{tagmap}
\config{\%QT} & Display the name of the top quickscreen setting.\\
\config{\%Qt} & Display the value of the top quickscreen setting.\\
\config{\%QR} & Display the name of the right quickscreen setting.\\
\config{\%Qr} & Display the value of the right quickscreen setting.\\
\config{\%QB} & Display the name of the bottom quickscreen setting.\\
\config{\%Qb} & Display the value of the bottom quickscreen setting.\\
\config{\%QL} & Display the name of the left quickscreen setting.\\
\config{\%Ql} & Display the value of the left quickscreen setting.\\
\end{tagmap}
\note{If a preset does not match a legal setting, or has no setting applied, all tags will display "ERR".}
}
\section{\label{ref:wps_images}Images}
\begin{tagmap}