From f2d8b0e97585b71b9d66e5b1e536f9ca5dc22b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohensohn?= Date: Mon, 12 Apr 2004 12:29:44 +0000 Subject: [PATCH] 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 --- apps/bookmark.c | 46 ++++++++++++++++++++++++++++++++++++++++++ apps/lang/english.lang | 42 +++++++++++++++++++++----------------- apps/main_menu.c | 39 ++++++++++++++++++++++++++++++----- apps/settings.c | 8 +++++++- 4 files changed, 111 insertions(+), 24 deletions(-) diff --git a/apps/bookmark.c b/apps/bookmark.c index d1e14d93c5..13a9cdc823 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -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 */ diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 4d298c7d04..75aecba098 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -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: diff --git a/apps/main_menu.c b/apps/main_menu.c index dc6e84d626..8e1b7871c1 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -16,6 +16,7 @@ * KIND, either express or implied. * ****************************************************************************/ +#include #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); diff --git a/apps/settings.c b/apps/settings.c index 5cfe7e3955..8a93617d64 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -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