voice UI updates: nicer month setting, bookmark browser, Rockbox info screen

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4487 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jörg Hohensohn 2004-04-12 12:29:44 +00:00
parent 716fd7419d
commit f2d8b0e975
4 changed files with 111 additions and 24 deletions

View file

@ -58,6 +58,8 @@ static bool delete_bookmark(char* bookmark_file_name, int bookmark_id);
static void display_bookmark(char* bookmark,
int bookmark_id,
int bookmark_count);
static void say_bookmark(char* bookmark,
int bookmark_id);
static bool generate_bookmark_file_name(char *in,
char *out,
unsigned int max_length);
@ -668,6 +670,8 @@ static char* select_bookmark(char* bookmark_file_name)
else
{
display_bookmark(bookmark, bookmark_id, bookmark_count);
if (global_settings.talk_menu) /* for voice UI */
say_bookmark(bookmark, bookmark_id);
}
/* waiting for the user to click a button */
@ -880,6 +884,48 @@ static void display_bookmark(char* bookmark,
lcd_update();
}
/* ----------------------------------------------------------------------- */
/* This function parses a bookmark, says the voice UI part of it. */
/* ------------------------------------------------------------------------*/
static void say_bookmark(char* bookmark,
int bookmark_id)
{
int resume_index;
int ms;
char dir[MAX_PATH];
bool enqueue = false; /* only the first voice is not queued */
parse_bookmark(bookmark,
&resume_index,
NULL, NULL, NULL,
dir, sizeof(dir),
&ms, NULL, NULL,
NULL, 0);
/* disabled, because transition between talkbox and voice UI clip is not nice */
#if 0
if (global_settings.talk_dir >= 3)
{ /* "talkbox" enabled */
char* last = strrchr(dir, '/');
if (last)
{ /* compose filename for talkbox */
strncpy(last + 1, dir_thumbnail_name, sizeof(dir)-(last-dir)-1);
talk_file(dir, enqueue);
enqueue = true;
}
}
#endif
talk_id(VOICE_EXT_BMARK, enqueue);
talk_number(bookmark_id + 1, true);
talk_id(LANG_BOOKMARK_SELECT_INDEX_TEXT, true);
talk_number(resume_index + 1, true);
talk_id(LANG_BOOKMARK_SELECT_TIME_TEXT, true);
if (ms / 60000)
talk_value(ms / 60000, UNIT_MIN, true);
talk_value((ms % 60000) / 1000, UNIT_SEC, true);
}
/* ----------------------------------------------------------------------- */
/* This function retrieves a given bookmark from a file. */
/* If the bookmark requested is beyond the number of bookmarks available */

View file

@ -778,73 +778,73 @@ new:
id: LANG_MONTH_JANUARY
desc: Maximum 3-letter abbreviation for monthname
eng: "Jan"
voice: ""
voice: "January"
new:
id: LANG_MONTH_FEBRUARY
desc: Maximum 3-letter abbreviation for monthname
eng: "Feb"
voice: ""
voice: "February"
new:
id: LANG_MONTH_MARCH
desc: Maximum 3-letter abbreviation for monthname
eng: "Mar"
voice: ""
voice: "March"
new:
id: LANG_MONTH_APRIL
desc: Maximum 3-letter abbreviation for monthname
eng: "Apr"
voice: ""
voice: "April"
new:
id: LANG_MONTH_MAY
desc: Maximum 3-letter abbreviation for monthname
eng: "May"
voice: ""
voice: "May"
new:
id: LANG_MONTH_JUNE
desc: Maximum 3-letter abbreviation for monthname
eng: "Jun"
voice: ""
voice: "June"
new:
id: LANG_MONTH_JULY
desc: Maximum 3-letter abbreviation for monthname
eng: "Jul"
voice: ""
voice: "July"
new:
id: LANG_MONTH_AUGUST
desc: Maximum 3-letter abbreviation for monthname
eng: "Aug"
voice: ""
voice: "August"
new:
id: LANG_MONTH_SEPTEMBER
desc: Maximum 3-letter abbreviation for monthname
eng: "Sep"
voice: ""
voice: "September"
new:
id: LANG_MONTH_OCTOBER
desc: Maximum 3-letter abbreviation for monthname
eng: "Oct"
voice: ""
voice: "October"
new:
id: LANG_MONTH_NOVEMBER
desc: Maximum 3-letter abbreviation for monthname
eng: "Nov"
voice: ""
voice: "November"
new:
id: LANG_MONTH_DECEMBER
desc: Maximum 3-letter abbreviation for monthname
eng: "Dec"
voice: ""
voice: "December"
new:
id: LANG_RESUME_SETTING_ASK_ONCE
@ -1006,7 +1006,7 @@ new:
id: LANG_DISK_FREE_STAT
desc: disk size info
eng: "Free: %d.%dGB"
voice: ""
voice: "Free diskspace:"
new:
id: LANG_POWEROFF
@ -1024,7 +1024,7 @@ new:
id: LANG_BATTERY_TIME
desc: battery level in % and estimated time remaining
eng: "%d%% %dh %dm"
voice: ""
voice: "Battery level"
new:
id: LANG_SLEEP_TIMER
@ -1808,13 +1808,13 @@ new:
id: LANG_BOOKMARK_SELECT_INDEX_TEXT
desc: Used on the bookmark select window to label index number
eng: "Index"
voice: ""
voice: "Index"
new:
id: LANG_BOOKMARK_SELECT_TIME_TEXT
desc: Used on the bookmark select window to label elapsed time
eng: "Time"
voice: ""
voice: "Time"
new:
id: LANG_BOOKMARK_SELECT_PLAY
@ -2336,7 +2336,7 @@ voice: "percent"
new:
id: VOICE_MEGABYTE
desc: spoken only, a unit postfix
desc: spoken only, a unit postfix, currently not used
eng: ""
voice: "megabyte"
new:
@ -2626,7 +2626,7 @@ voice: "font"
new:
id: VOICE_EXT_BMARK
desc: spoken only, for file extension
desc: spoken only, for file extension and the word in general
eng: ""
voice: "bookmark"
new:
@ -2648,3 +2648,9 @@ desc: in on+play menu
eng: "Delete directory"
voice: "delete directory"
new:
id: VOICE_CURRENT_TIME
desc: spoken only, for wall clock announce
eng: ""
voice: "Current time:"
new:

View file

@ -16,6 +16,7 @@
* KIND, either express or implied.
*
****************************************************************************/
#include <timefuncs.h>
#include "config.h"
#include "options.h"
@ -154,6 +155,39 @@ bool show_info(void)
bool done = false;
int key;
int state = 1;
unsigned int size, free;
fat_size( &size, &free );
size /= 1024;
free /= 1024;
if (global_settings.talk_menu)
{ /* say whatever is reasonable, no real connection to the screen */
struct tm* tm;
if (battery_level() >= 0)
{
talk_id(LANG_BATTERY_TIME, true);
talk_value(battery_level(), UNIT_PERCENT, true);
}
talk_id(LANG_DISK_FREE_STAT, false);
talk_number(free / 1024, true);
decimal = free % 1024 / 100;
talk_id(VOICE_POINT, true);
talk_value(decimal, UNIT_GB, true);
#ifdef HAVE_RTC
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);
talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
talk_number(tm->tm_mday, true);
talk_number(1900 + tm->tm_year, true);
#endif
}
while(!done)
{
@ -195,16 +229,11 @@ bool show_info(void)
}
if (state & 2) {
unsigned int size, free;
fat_size( &size, &free );
size /= 1024;
integer = size / 1024;
decimal = size % 1024 / 100;
snprintf(s, sizeof s, str(LANG_DISK_STAT), integer, decimal);
lcd_puts(0, y++, s);
free /= 1024;
integer = free / 1024;
decimal = free % 1024 / 100;
snprintf(s, sizeof s, str(LANG_DISK_FREE_STAT), integer, decimal);

View file

@ -1968,13 +1968,19 @@ static void say_time(int cursorpos, int timedate[])
const int unit[] = { UNIT_HOUR, UNIT_MIN, UNIT_SEC, 0, 0, 0 };
int value = timedate[cursorpos];
if (!global_settings.talk_menu)
return;
if (cursorpos == 3) /* year */
value += 2000;
if (global_settings.talk_menu)
if (cursorpos == 4) /* month */
talk_id(LANG_MONTH_JANUARY + value - 1, false);
else
talk_value(value, unit[cursorpos], false);
}
#define INDEX_X 0
#define INDEX_Y 1
#define INDEX_WIDTH 2