1
0
Fork 0
forked from len0rd/rockbox

Nicer handling of unset clock in the 'Rockbox Info' screen

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17199 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2008-04-20 21:01:39 +00:00
parent 380e915428
commit ac1b30ef73
2 changed files with 62 additions and 14 deletions

View file

@ -11590,3 +11590,17 @@
*: "Accessory Power Supply"
</voice>
</phrase>
<phrase>
id: LANG_UNKNOWN
desc: generic string for unknown states, such as an unset clock
user:
<source>
*: "Unknown"
</source>
<dest>
*: "Unknown"
</dest>
<voice>
*: "Unknown"
</voice>
</phrase>

View file

@ -183,20 +183,34 @@ static char* info_getname(int selected_item, void *data,
#if CONFIG_RTC
case INFO_TIME:
tm = get_time();
snprintf(buffer, buffer_len, "%02d:%02d:%02d %s",
global_settings.timeformat == 0 ? tm->tm_hour :
((tm->tm_hour + 11) % 12) + 1,
tm->tm_min,
tm->tm_sec,
global_settings.timeformat == 0 ? "" :
tm->tm_hour>11 ? "P" : "A");
if (valid_time(tm))
{
snprintf(buffer, buffer_len, "%02d:%02d:%02d %s",
global_settings.timeformat == 0 ? tm->tm_hour :
((tm->tm_hour + 11) % 12) + 1,
tm->tm_min,
tm->tm_sec,
global_settings.timeformat == 0 ? "" :
tm->tm_hour>11 ? "P" : "A");
}
else
{
snprintf(buffer, buffer_len, "%s", "--:--:--");
}
break;
case INFO_DATE:
tm = get_time();
snprintf(buffer, buffer_len, "%s %d %d",
str(LANG_MONTH_JANUARY + tm->tm_mon),
tm->tm_mday,
tm->tm_year+1900);
if (valid_time(tm))
{
snprintf(buffer, buffer_len, "%s %d %d",
str(LANG_MONTH_JANUARY + tm->tm_mon),
tm->tm_mday,
tm->tm_year+1900);
}
else
{
snprintf(buffer, buffer_len, "%s", str(LANG_UNKNOWN));
}
break;
#endif
case INFO_BUFFER: /* buffer */
@ -270,6 +284,10 @@ static int info_speak_item(int selected_item, void * data)
{
struct info_data *info = (struct info_data*)data;
#if CONFIG_RTC
struct tm *tm;
#endif
switch (selected_item)
{
case INFO_VERSION: /* version */
@ -277,12 +295,28 @@ static int info_speak_item(int selected_item, void * data)
talk_spell(appsversion, true);
break;
#if CONFIG_RTC
case INFO_TIME:
case INFO_TIME:
tm = get_time();
talk_id(VOICE_CURRENT_TIME, false);
talk_time(get_time(), true);
if (valid_time(tm))
{
talk_time(tm, true);
}
else
{
talk_id(LANG_UNKNOWN, true);
}
break;
case INFO_DATE:
talk_date(get_time(), true);
tm = get_time();
if (valid_time(tm))
{
talk_date(get_time(), true);
}
else
{
talk_id(LANG_UNKNOWN, true);
}
break;
#endif
case INFO_BUFFER: /* buffer */