diff options
author | Jonas Häggqvist <rasher@rasher.dk> | 2007-08-21 22:54:57 +0000 |
---|---|---|
committer | Jonas Häggqvist <rasher@rasher.dk> | 2007-08-21 22:54:57 +0000 |
commit | 496206be6e71169bcbb6516c435c604c5ae91948 (patch) | |
tree | 1f7ab9128bc2bb2511e36ed259fd977aad02be26 | |
parent | 167564b1431d61ebd629835796f31471ec3b6b58 (diff) |
Voice the time in the format the user selects in the time format setting. Patch FS#7561 by Daniel Dalton.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14418 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/lang/english.lang | 51 | ||||
-rw-r--r-- | apps/menus/main_menu.c | 49 | ||||
-rw-r--r-- | docs/CREDITS | 1 |
3 files changed, 98 insertions, 3 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 9c656fba69..29e2d1df79 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -11054,3 +11054,54 @@ *: "units per tick" </voice> </phrase> +<phrase> + id: VOICE_OCLOCK + desc: spoken only, for wall clock announce + user: + <source> + *: none + rtc: "" + </source> + <dest> + *: none + rtc: "" + </dest> + <voice> + *: none + rtc: "o'clock" + </voice> +</phrase> +<phrase> + id: VOICE_PM + desc: spoken only, for wall clock announce + user: + <source> + *: none + rtc: "" + </source> + <dest> + *: none + rtc: "" + </dest> + <voice> + *: none + rtc: "P M" + </voice> +</phrase> +<phrase> + id: VOICE_AM + desc: spoken only, for wall clock announce + user: + <source> + *: none + rtc: "" + </source> + <dest> + *: none + rtc: "" + </dest> + <voice> + *: none + rtc: "A M" + </voice> +</phrase> diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 1ae5774d15..6c828ce1be 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -209,9 +209,52 @@ static bool show_info(void) { struct tm* tm = get_time(); talk_id(VOICE_CURRENT_TIME, true); - talk_value(tm->tm_hour, UNIT_HOUR, true); - talk_value(tm->tm_min, UNIT_MIN, true); - talk_value(tm->tm_sec, UNIT_SEC, true); + if (global_settings.timeformat == 1) + { + /* Voice the time in 12 hour format */ + if (tm->tm_hour == 0) + { + /* Make it say 12 am instead of 0 am */ + talk_value(12, UNIT_INT, true); + } + else if (tm->tm_hour <= 12) + { + /* If between 0 and 12, we voice the hour as-is */ + talk_value(tm->tm_hour, UNIT_INT, true); + } + else + { + /* Subtract 12 hours if we're past noon */ + talk_value(tm->tm_hour-12, UNIT_INT, true); + } + + /* Voice the minutes */ + if (tm->tm_min == 0) + { + /*say o'clock if the minute is 0. */ + talk_id(VOICE_OCLOCK, true); + } + else + { + talk_value(tm->tm_min, UNIT_INT, true); + } + + /* Voice the suffix */ + if (tm->tm_hour >= 12) + { + talk_id(VOICE_PM, true); + } + else + { + talk_id(VOICE_AM, true); + } + } + else + { + /*voice the time in 24 hour format*/ + talk_value(tm->tm_hour, UNIT_HOUR, true); + talk_value(tm->tm_min, UNIT_MIN, true); + } talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true); talk_number(tm->tm_mday, true); talk_number(1900 + tm->tm_year, true); diff --git a/docs/CREDITS b/docs/CREDITS index 37b642b4d8..32e18edd22 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -317,6 +317,7 @@ Lenny Koepsell Harry Tu Pawel Wysocki Xinlu Huang +Daniel Dalton The libmad team The wavpack team The ffmpeg team |