summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarianne Arnold <pixelma@rockbox.org>2009-05-16 11:22:41 +0000
committerMarianne Arnold <pixelma@rockbox.org>2009-05-16 11:22:41 +0000
commite435e4d976757f8436484a5b4d158ab7545fcdb6 (patch)
treeee7b7599dba7994968c9c2812c78c036cb4335f9
parent1af18d52af70a638cda8f12702b6e48fdec2e1da (diff)
downloadrockbox-e435e4d976757f8436484a5b4d158ab7545fcdb6.tar.gz
rockbox-e435e4d976757f8436484a5b4d158ab7545fcdb6.zip
New 'clock present' WPS tag: The tag checks for the presence of the clock hardware and can be used unconditionally (returning a 'c') or in a conditional. You can specify what to display if a target has the clock (the true case) and an alternative for targets without. This can be useful for e.g. the greyscale 160x128 WPSs or the Archos ones which work on players with and without the hardware. - Add the new tag to the WPS tag description in the manual. Change the headline to the less technical 'Time and Date' as per the discussion in IRC.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20961 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c8
-rw-r--r--apps/gui/gwps.h2
-rw-r--r--apps/gui/wps_parser.c1
-rw-r--r--manual/appendix/wps_tags.tex23
4 files changed, 30 insertions, 4 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 1fef9e02cb..9a69c74bf3 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1037,6 +1037,14 @@ static const char *get_token_value(struct gui_wps *gwps,
1037 *intval = global_settings.repeat_mode + 1; 1037 *intval = global_settings.repeat_mode + 1;
1038 snprintf(buf, buf_size, "%d", global_settings.repeat_mode); 1038 snprintf(buf, buf_size, "%d", global_settings.repeat_mode);
1039 return buf; 1039 return buf;
1040
1041 case WPS_TOKEN_RTC_PRESENT:
1042#if CONFIG_RTC
1043 return "c";
1044#else
1045 return NULL;
1046#endif
1047
1040#if CONFIG_RTC 1048#if CONFIG_RTC
1041 case WPS_TOKEN_RTC_12HOUR_CFG: 1049 case WPS_TOKEN_RTC_12HOUR_CFG:
1042 if (intval) 1050 if (intval)
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 935e015c93..f3562214a0 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -173,6 +173,8 @@ enum wps_token_type {
173 173
174 /* Time */ 174 /* Time */
175 175
176 WPS_TOKEN_RTC_PRESENT,
177
176 /* The begin/end values allow us to know if a token is an RTC one. 178 /* The begin/end values allow us to know if a token is an RTC one.
177 New RTC tokens should be added between the markers. */ 179 New RTC tokens should be added between the markers. */
178 180
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 70e13e78a7..7211e6c86a 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -193,6 +193,7 @@ static const struct wps_tag all_tags[] = {
193 { WPS_TOKEN_BATTERY_CHARGER_CONNECTED,"bp", WPS_REFRESH_DYNAMIC, NULL }, 193 { WPS_TOKEN_BATTERY_CHARGER_CONNECTED,"bp", WPS_REFRESH_DYNAMIC, NULL },
194#endif 194#endif
195 195
196 { WPS_TOKEN_RTC_PRESENT , "cc", WPS_REFRESH_STATIC, NULL },
196 { WPS_TOKEN_RTC_DAY_OF_MONTH, "cd", WPS_RTC_REFRESH, NULL }, 197 { WPS_TOKEN_RTC_DAY_OF_MONTH, "cd", WPS_RTC_REFRESH, NULL },
197 { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,"ce", WPS_RTC_REFRESH, NULL }, 198 { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,"ce", WPS_RTC_REFRESH, NULL },
198 { WPS_TOKEN_RTC_12HOUR_CFG, "cf", WPS_RTC_REFRESH, NULL }, 199 { WPS_TOKEN_RTC_12HOUR_CFG, "cf", WPS_RTC_REFRESH, NULL },
diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex
index 3e8846d71c..a7c1822c50 100644
--- a/manual/appendix/wps_tags.tex
+++ b/manual/appendix/wps_tags.tex
@@ -355,10 +355,11 @@ Allows grouping of several items (sublines) onto one line, with the
355display cycling round the defined sublines. See 355display cycling round the defined sublines. See
356\reference{ref:AlternatingSublines} for details. 356\reference{ref:AlternatingSublines} for details.
357 357
358\opt{rtc}{ 358
359 \section{Real Time Clock} 359\section{Time and Date}
360 \begin{table} 360 \begin{table}
361 \begin{tagmap}{}{} 361 \begin{tagmap}{}{}
362 \opt{rtc}{
362 \config{\%cd} & Day of month\\ 363 \config{\%cd} & Day of month\\
363 \config{\%ce} & Zero padded day of month\\ 364 \config{\%ce} & Zero padded day of month\\
364 \config{\%cH} & Zero padded hour from 00 to 23 (24 hour format)\\ 365 \config{\%cH} & Zero padded hour from 00 to 23 (24 hour format)\\
@@ -368,7 +369,7 @@ display cycling round the defined sublines. See
368 \config{\%cm} & Month\\ 369 \config{\%cm} & Month\\
369 \config{\%cM} & Minutes\\ 370 \config{\%cM} & Minutes\\
370 \config{\%cS} & Seconds\\ 371 \config{\%cS} & Seconds\\
371 \config{\%cy} & 2-digit year\\ 372 \config{\%cy} & 2-digit year\\
372 \config{\%cY} & 4-digit year\\ 373 \config{\%cY} & 4-digit year\\
373 \config{\%cP} & Capital AM/PM\\ 374 \config{\%cP} & Capital AM/PM\\
374 \config{\%cp} & Lowercase am/pm\\ 375 \config{\%cp} & Lowercase am/pm\\
@@ -376,9 +377,23 @@ display cycling round the defined sublines. See
376 \config{\%cb} & Month name\\ 377 \config{\%cb} & Month name\\
377 \config{\%cu} & Day of week from 1 to 7, 1 is Monday\\ 378 \config{\%cu} & Day of week from 1 to 7, 1 is Monday\\
378 \config{\%cw} & Day of week from 0 to 6, 0 is Sunday\\ 379 \config{\%cw} & Day of week from 0 to 6, 0 is Sunday\\
380 }
381 \config{\%cc} & Check for presence of the clock hardware\\
379 \end{tagmap} 382 \end{tagmap}
380 \end{table} 383 \end{table}
381} 384The \%cc tag returns ``c'' if the necessary hardware is present and can also be
385used as a conditional. This can be very useful for designing a WPS that works on
386multiple targets, some with and some without a clock. By using this tag as a
387conditional it is possible to display current date and time on those targets that
388support this
389\opt{rtc}{ (like the \playertype)},
390or alternate information on those that do not
391\nopt{rtc}{ (like the \playertype)}%
392.
393
394Example:
395\config{\%?cc{\textless}\%cH:\%cM{\textbar}No clock detected{\textgreater}}
396
382 397
383\section{Other Tags} 398\section{Other Tags}
384\begin{table} 399\begin{table}