diff options
| author | Antoine Cellerier <dionoea@videolan.org> | 2008-12-07 16:20:35 +0000 |
|---|---|---|
| committer | Antoine Cellerier <dionoea@videolan.org> | 2008-12-07 16:20:35 +0000 |
| commit | 8289b966b810eb21732ecb905433debf4e872857 (patch) | |
| tree | 4665d7ca2d8c2f5bfa41686f9e7ddba65fb4e18f /apps/gui/gwps-common.c | |
| parent | 3ad535031a84f0fa9c65a24e140c81b0a60c3026 (diff) | |
| download | rockbox-8289b966b810eb21732ecb905433debf4e872857.zip rockbox-8289b966b810eb21732ecb905433debf4e872857.tar.gz rockbox-8289b966b810eb21732ecb905433debf4e872857.tar.bz2 rockbox-8289b966b810eb21732ecb905433debf4e872857.tar.xz | |
Apply FS#9368 : add generic settings tag to WPS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19357 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps-common.c')
| -rw-r--r-- | apps/gui/gwps-common.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index a0e09b8..bcaebc5 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include "system.h" #include "settings.h" +#include "settings_list.h" #include "rbunicode.h" #include "rtc.h" #include "audio.h" @@ -1402,6 +1403,53 @@ static const char *get_token_value(struct gui_wps *gwps, token->value.i * TIMEOUT_UNIT)) return "v"; return NULL; + + case WPS_TOKEN_SETTING: + { + if (intval) + { + /* Handle contionals */ + const struct settings_list *s = settings+token->value.i; + switch (s->flags&F_T_MASK) + { + case F_T_INT: + case F_T_UINT: + if (s->flags&F_RGB) + /* %?St|name|<#000000|#000001|...|#FFFFFF> */ + /* shouldn't overflow since colors are stored + * on 16 bits ... + * but this is pretty useless anyway */ + *intval = *(int*)s->setting + 1; + else if (s->cfg_vals == NULL) + /* %?St|name|<1st choice|2nd choice|...> */ + *intval = (*(int*)s->setting-s->int_setting->min) + /s->int_setting->step + 1; + else + /* %?St|name|<1st choice|2nd choice|...> */ + /* Not sure about this one. cfg_name/vals are + * indexed from 0 right? */ + *intval = *(int*)s->setting + 1; + break; + case F_T_BOOL: + /* %?St|name|<if true|if false> */ + *intval = *(bool*)s->setting?1:2; + break; + case F_T_CHARPTR: + /* %?St|name|<if non empty string|if empty> + * The string's emptyness discards the setting's + * prefix and suffix */ + *intval = ((char*)s->setting)[0]?1:2; + break; + default: + /* This shouldn't happen ... but you never know */ + *intval = -1; + break; + } + } + cfg_to_string(token->value.i,buf,buf_size); + return buf; + } + default: return NULL; } |