Complete info screen voicing; now consistent with displayed screen

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15284 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2007-10-24 12:32:12 +00:00
parent 537b27d58f
commit 072a3c5017
6 changed files with 188 additions and 108 deletions

View file

@ -1283,9 +1283,8 @@ bool simplelist_show_list(struct simplelist_info *info)
while(1)
{
gui_syncstatusbar_draw(&statusbars, true);
if (list_do_action(CONTEXT_STD, info->timeout,
&lists, &action, LIST_WRAP_UNLESS_HELD))
continue;
list_do_action(CONTEXT_STD, info->timeout,
&lists, &action, LIST_WRAP_UNLESS_HELD);
if (info->action_callback)
{
action = info->action_callback(action, &lists);

View file

@ -6880,7 +6880,7 @@
player: "Buf: %d.%03dMB"
</dest>
<voice>
*: ""
*: "Buffer size"
</voice>
</phrase>
<phrase>
@ -6912,7 +6912,7 @@
*: "Disk:"
</dest>
<voice>
*: ""
*: "Disk size"
</voice>
</phrase>
<phrase>

View file

@ -49,7 +49,6 @@
#include "time.h"
static struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG};
/***********************************/
@ -129,9 +128,52 @@ struct info_data {
unsigned long free2;
#endif
};
enum InfoScreenOrder {
Order_SVN_revision = 0,
Order_GAP1,
#if CONFIG_RTC
Order_Time,
Order_Date,
Order_GAP2,
#endif
Order_Buffer,
Order_Batt,
Order_Disk1, /* capacity or internal capacity/free on hotswap */
Order_Disk2,/* free space or external capacity/free on hotswap */
Order_Count
};
#if CONFIG_RTC
const int dayname[] = {
LANG_WEEKDAY_SUNDAY,
LANG_WEEKDAY_MONDAY,
LANG_WEEKDAY_TUESDAY,
LANG_WEEKDAY_WEDNESDAY,
LANG_WEEKDAY_THURSDAY,
LANG_WEEKDAY_FRIDAY,
LANG_WEEKDAY_SATURDAY
};
const int monthname[] = {
LANG_MONTH_JANUARY,
LANG_MONTH_FEBRUARY,
LANG_MONTH_MARCH,
LANG_MONTH_APRIL,
LANG_MONTH_MAY,
LANG_MONTH_JUNE,
LANG_MONTH_JULY,
LANG_MONTH_AUGUST,
LANG_MONTH_SEPTEMBER,
LANG_MONTH_OCTOBER,
LANG_MONTH_NOVEMBER,
LANG_MONTH_DECEMBER
};
#endif
static char* info_getname(int selected_item, void * data, char *buffer)
{
struct info_data *info = (struct info_data*)data;
struct info_data *info = (struct info_data*)data;
#if CONFIG_RTC
struct tm *tm;
#endif
const unsigned char *kbyte_units[] = {
ID2P(LANG_KILOBYTE),
ID2P(LANG_MEGABYTE),
@ -154,13 +196,34 @@ static char* info_getname(int selected_item, void * data, char *buffer)
}
switch (selected_item)
{
case 0:
case Order_SVN_revision:
snprintf(buffer, MAX_PATH, "%s: %s",
str(LANG_VERSION), appsversion);
break;
case 1:
case Order_GAP1:
#if CONFIG_RTC
case Order_GAP2:
#endif
return "";
case 2: /* buffer */
#if CONFIG_RTC
case Order_Time:
tm = get_time();
snprintf(buffer, MAX_PATH, "%02d:%02d:%02d %s",
global_settings.timeformat == 0
?tm->tm_hour:tm->tm_hour-12,
tm->tm_min, tm->tm_sec,
global_settings.timeformat == 0
?"":tm->tm_hour>11?"P":"A");
break;
case Order_Date:
tm = get_time();
snprintf(buffer, MAX_PATH, "%s %d %s %d", str(dayname[tm->tm_wday]),
tm->tm_year+1900,
str(monthname[tm->tm_mon]),
tm->tm_mday);
break;
#endif
case Order_Buffer: /* buffer */
{
long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
int integer = buflen / 1000;
@ -170,7 +233,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
integer, decimal);
}
break;
case 3: /* battery */
case Order_Batt: /* battery */
#if CONFIG_CHARGING == CHARGING_CONTROL
if (charge_state == CHARGING)
snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE));
@ -186,7 +249,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
else
strcpy(buffer, "(n/a)");
break;
case 4: /* disc usage 1 */
case Order_Disk1: /* disc usage 1 */
#ifdef HAVE_MULTIVOLUME
output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true);
output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true);
@ -197,7 +260,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
#endif
break;
case 5: /* disc usage 2 */
case Order_Disk2: /* disc usage 2 */
#ifdef HAVE_MULTIVOLUME
if (info->size2)
{
@ -223,23 +286,38 @@ static int info_speak_item(int selected_item, void * data)
ID2P(LANG_KILOBYTE),
ID2P(LANG_MEGABYTE),
ID2P(LANG_GIGABYTE)
};
};
switch (selected_item)
{
case 0:/* version, not voiced, so say the time instead */
case Order_SVN_revision: /* version */
talk_id(LANG_VERSION, false);
talk_spell(appsversion, true);
break;
#if CONFIG_RTC
talk_date_time(get_time(), false);
case Order_Time:
talk_id(LANG_CURRENT_TIME, false);
talk_time(get_time(), true);
break;
case Order_Date:
talk_date(get_time(), true);
break;
#endif
break;
case 1: /* nothing */
break;
case 2: /* buffer, not spoken */
break;
case 3: /* battery */
case Order_Buffer: /* buffer, not spoken */
{
talk_id(LANG_BUFFER_STAT, false);
long buflen = (audiobufend - audiobuf) / 1024L;
output_dyn_value(NULL, 0, buflen, kbyte_units, true);
break;
}
case Order_Batt: /* battery */
if (battery_level() >= 0)
{
talk_id(LANG_BATTERY_TIME, false);
talk_value(battery_level(), UNIT_PERCENT, true);
if(battery_time () / 60 > 0)
talk_value(battery_time () / 60, UNIT_INT, true);
if(battery_time () % 60 > 0)
talk_value(battery_time () % 60, UNIT_INT, true);
#if CONFIG_CHARGING >= CHARGING_MONITOR
if (charge_state == CHARGING)
talk_id(LANG_BATTERY_CHARGE, true);
@ -252,20 +330,27 @@ static int info_speak_item(int selected_item, void * data)
#endif
}
break;
case 4: /* disk 1 */
talk_id(LANG_DISK_FREE_INFO, false);
case Order_Disk1: /* disk 1 */
#ifdef HAVE_MULTIVOLUME
talk_id(LANG_DISK_FREE_INFO, false);
talk_id(LANG_DISK_NAME_INTERNAL, true);
#endif
output_dyn_value(NULL, 0, info->free, kbyte_units, true);
#else
talk_id(LANG_DISK_SIZE_INFO, false);
output_dyn_value(NULL, 0, info->size, kbyte_units, true);
#endif
break;
case 5: /* disk 2 */
case Order_Disk2: /* disk 2 */
#ifdef HAVE_MULTIVOLUME
if (info->size2)
{
talk_id(LANG_DISK_FREE_INFO, false);
talk_id(LANG_DISK_NAME_MMC, false);
output_dyn_value(NULL, 0, info->free2, kbyte_units, true);
}
#else
talk_id(LANG_DISK_FREE_INFO, false);
output_dyn_value(NULL, 0, info->free, kbyte_units, true);
#endif
break;
}
@ -274,7 +359,8 @@ static int info_speak_item(int selected_item, void * data)
static int info_action_callback(int action, struct gui_synclist *lists)
{
(void)lists;
if (action == ACTION_STD_CANCEL)
return action;
if ((action == ACTION_STD_OK)
#ifdef HAVE_MULTIVOLUME
|| action == SYS_HOTSWAP_INSERTED
@ -294,13 +380,33 @@ static int info_action_callback(int action, struct gui_synclist *lists)
#endif
return ACTION_REDRAW;
}
else if (lists->gui_list[SCREEN_MAIN].show_selection_marker == true)
{
if (lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP1
#if CONFIG_RTC
|| lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP2
#endif
)
{
if (action == ACTION_STD_PREV)
{
gui_synclist_select_item(lists, lists->gui_list[SCREEN_MAIN].selected_item-1);
return ACTION_REDRAW;
}
else if (action == ACTION_STD_NEXT)
{
gui_synclist_select_item(lists, lists->gui_list[SCREEN_MAIN].selected_item+1);
return ACTION_REDRAW;
}
}
}
return action;
}
static bool show_info(void)
{
struct info_data data = {.new_data = true};
struct info_data data = {.new_data = true };
struct simplelist_info info;
simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), 6, (void*)&data);
simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), Order_Count, (void*)&data);
info.hide_selection = !global_settings.talk_menu;
info.get_name = info_getname;
if(global_settings.talk_menu)

View file

@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 Björn Stenberg
* Copyright (C) 2002 Bj<EFBFBD>rn Stenberg
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
@ -791,30 +791,8 @@ void charging_splash(void)
#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
const int dayname[] = {
LANG_WEEKDAY_SUNDAY,
LANG_WEEKDAY_MONDAY,
LANG_WEEKDAY_TUESDAY,
LANG_WEEKDAY_WEDNESDAY,
LANG_WEEKDAY_THURSDAY,
LANG_WEEKDAY_FRIDAY,
LANG_WEEKDAY_SATURDAY
};
const int monthname[] = {
LANG_MONTH_JANUARY,
LANG_MONTH_FEBRUARY,
LANG_MONTH_MARCH,
LANG_MONTH_APRIL,
LANG_MONTH_MAY,
LANG_MONTH_JUNE,
LANG_MONTH_JULY,
LANG_MONTH_AUGUST,
LANG_MONTH_SEPTEMBER,
LANG_MONTH_OCTOBER,
LANG_MONTH_NOVEMBER,
LANG_MONTH_DECEMBER
};
extern const int dayname[];
extern const int monthname[];
/* little helper function for voice output */
static void say_time(int cursorpos, const struct tm *tm)

View file

@ -848,66 +848,61 @@ void talk_disable(bool disable)
}
#if CONFIG_RTC
void talk_date_time(struct tm *tm, bool speak_current_time_string)
void talk_date(struct tm *tm, bool enqueue)
{
if(global_settings.talk_menu)
talk_id(LANG_MONTH_JANUARY + tm->tm_mon, enqueue);
talk_number(tm->tm_mday, true);
talk_number(1900 + tm->tm_year, true);
}
void talk_time(struct tm *tm, bool enqueue)
{
if (global_settings.timeformat == 1)
{
if(speak_current_time_string)
talk_id(VOICE_CURRENT_TIME, true);
if (global_settings.timeformat == 1)
/* Voice the hour */
long am_pm_id = VOICE_AM;
int hour = tm->tm_hour;
if (hour >= 12)
{
long am_pm_id = VOICE_AM;
int hour = tm->tm_hour;
am_pm_id = VOICE_PM;
hour -= 12;
}
if (hour == 0)
hour = 12;
talk_number(hour, enqueue);
if (hour >= 12)
{
am_pm_id = VOICE_PM;
hour -= 12;
}
if (hour == 0)
hour = 12;
talk_number(hour, true);
/* Voice the minutes */
if (tm->tm_min == 0)
{
/* Say o'clock if the minute is 0. */
talk_id(VOICE_OCLOCK, true);
}
else
{
/* Pronounce the leading 0 */
if(tm->tm_min < 10)
{
talk_id(VOICE_OH, true);
}
talk_number(tm->tm_min, true);
}
talk_id(am_pm_id, true);
/* Voice the minutes */
if (tm->tm_min == 0)
{
/* Say o'clock if the minute is 0. */
talk_id(VOICE_OCLOCK, true);
}
else
{
/* Voice the time in 24 hour format */
talk_number(tm->tm_hour, true);
if (tm->tm_min == 0)
{
talk_id(VOICE_HUNDRED, true);
talk_id(VOICE_HOUR, true);
}
else
{
/* Pronounce the leading 0 */
if(tm->tm_min < 10)
{
talk_id(VOICE_OH, true);
}
talk_number(tm->tm_min, true);
}
/* Pronounce the leading 0 */
if(tm->tm_min < 10)
talk_id(VOICE_OH, true);
talk_number(tm->tm_min, true);
}
talk_id(am_pm_id, true);
}
else
{
/* Voice the time in 24 hour format */
talk_number(tm->tm_hour, enqueue);
if (tm->tm_min == 0)
{
talk_id(VOICE_HUNDRED, true);
talk_id(VOICE_HOUR, true);
}
else
{
/* Pronounce the leading 0 */
if(tm->tm_min < 10)
talk_id(VOICE_OH, true);
talk_number(tm->tm_min, true);
}
talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
talk_number(tm->tm_mday, true);
talk_number(1900 + tm->tm_year, true);
}
}
#endif

View file

@ -80,9 +80,11 @@ void talk_shutup(void); /* Interrupt voice, as when enqueue is false */
#if CONFIG_RTC
/* this is in talk.c which isnt compiled for hwcodec simulator */
#if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC
void talk_date_time(struct tm *time, bool speak_current_time_string);
void talk_time(struct tm *tm, bool enqueue);
void talk_date(struct tm *tm, bool enqueue);
#else
#define talk_date_time(t, s)
#define talk_date(t, e)
#define talk_time(t, e)
#endif
#endif /* CONFIG_RTC */