summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2007-10-24 12:32:12 +0000
committerSteve Bavin <pondlife@pondlife.me>2007-10-24 12:32:12 +0000
commit072a3c5017e4d97a0d8bc56b71d1a8b100784ef7 (patch)
tree879e85636ba10520bbd0cdd20389f87d1b335dbe
parent537b27d58f382277e239bbefaab3bb48a8df245e (diff)
downloadrockbox-072a3c5017e4d97a0d8bc56b71d1a8b100784ef7.tar.gz
rockbox-072a3c5017e4d97a0d8bc56b71d1a8b100784ef7.zip
Complete info screen voicing; now consistent with displayed screen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15284 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/list.c5
-rw-r--r--apps/lang/english.lang4
-rw-r--r--apps/menus/main_menu.c152
-rw-r--r--apps/screens.c28
-rw-r--r--apps/talk.c99
-rw-r--r--apps/talk.h6
6 files changed, 187 insertions, 107 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 6f61a61992..64551055c3 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -1283,9 +1283,8 @@ bool simplelist_show_list(struct simplelist_info *info)
1283 while(1) 1283 while(1)
1284 { 1284 {
1285 gui_syncstatusbar_draw(&statusbars, true); 1285 gui_syncstatusbar_draw(&statusbars, true);
1286 if (list_do_action(CONTEXT_STD, info->timeout, 1286 list_do_action(CONTEXT_STD, info->timeout,
1287 &lists, &action, LIST_WRAP_UNLESS_HELD)) 1287 &lists, &action, LIST_WRAP_UNLESS_HELD);
1288 continue;
1289 if (info->action_callback) 1288 if (info->action_callback)
1290 { 1289 {
1291 action = info->action_callback(action, &lists); 1290 action = info->action_callback(action, &lists);
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 29957eceb6..a706003e3d 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -6880,7 +6880,7 @@
6880 player: "Buf: %d.%03dMB" 6880 player: "Buf: %d.%03dMB"
6881 </dest> 6881 </dest>
6882 <voice> 6882 <voice>
6883 *: "" 6883 *: "Buffer size"
6884 </voice> 6884 </voice>
6885</phrase> 6885</phrase>
6886<phrase> 6886<phrase>
@@ -6912,7 +6912,7 @@
6912 *: "Disk:" 6912 *: "Disk:"
6913 </dest> 6913 </dest>
6914 <voice> 6914 <voice>
6915 *: "" 6915 *: "Disk size"
6916 </voice> 6916 </voice>
6917</phrase> 6917</phrase>
6918<phrase> 6918<phrase>
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index e94074217a..17cd1bcd37 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -49,7 +49,6 @@
49#include "time.h" 49#include "time.h"
50 50
51 51
52
53static struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG}; 52static struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG};
54 53
55/***********************************/ 54/***********************************/
@@ -129,9 +128,52 @@ struct info_data {
129 unsigned long free2; 128 unsigned long free2;
130#endif 129#endif
131}; 130};
131enum InfoScreenOrder {
132 Order_SVN_revision = 0,
133 Order_GAP1,
134#if CONFIG_RTC
135 Order_Time,
136 Order_Date,
137 Order_GAP2,
138#endif
139 Order_Buffer,
140 Order_Batt,
141 Order_Disk1, /* capacity or internal capacity/free on hotswap */
142 Order_Disk2,/* free space or external capacity/free on hotswap */
143 Order_Count
144};
145#if CONFIG_RTC
146const int dayname[] = {
147 LANG_WEEKDAY_SUNDAY,
148 LANG_WEEKDAY_MONDAY,
149 LANG_WEEKDAY_TUESDAY,
150 LANG_WEEKDAY_WEDNESDAY,
151 LANG_WEEKDAY_THURSDAY,
152 LANG_WEEKDAY_FRIDAY,
153 LANG_WEEKDAY_SATURDAY
154};
155
156const int monthname[] = {
157 LANG_MONTH_JANUARY,
158 LANG_MONTH_FEBRUARY,
159 LANG_MONTH_MARCH,
160 LANG_MONTH_APRIL,
161 LANG_MONTH_MAY,
162 LANG_MONTH_JUNE,
163 LANG_MONTH_JULY,
164 LANG_MONTH_AUGUST,
165 LANG_MONTH_SEPTEMBER,
166 LANG_MONTH_OCTOBER,
167 LANG_MONTH_NOVEMBER,
168 LANG_MONTH_DECEMBER
169};
170#endif
132static char* info_getname(int selected_item, void * data, char *buffer) 171static char* info_getname(int selected_item, void * data, char *buffer)
133{ 172{
134 struct info_data *info = (struct info_data*)data; 173 struct info_data *info = (struct info_data*)data;
174#if CONFIG_RTC
175 struct tm *tm;
176#endif
135 const unsigned char *kbyte_units[] = { 177 const unsigned char *kbyte_units[] = {
136 ID2P(LANG_KILOBYTE), 178 ID2P(LANG_KILOBYTE),
137 ID2P(LANG_MEGABYTE), 179 ID2P(LANG_MEGABYTE),
@@ -154,13 +196,34 @@ static char* info_getname(int selected_item, void * data, char *buffer)
154 } 196 }
155 switch (selected_item) 197 switch (selected_item)
156 { 198 {
157 case 0: 199 case Order_SVN_revision:
158 snprintf(buffer, MAX_PATH, "%s: %s", 200 snprintf(buffer, MAX_PATH, "%s: %s",
159 str(LANG_VERSION), appsversion); 201 str(LANG_VERSION), appsversion);
160 break; 202 break;
161 case 1: 203 case Order_GAP1:
204#if CONFIG_RTC
205 case Order_GAP2:
206#endif
162 return ""; 207 return "";
163 case 2: /* buffer */ 208#if CONFIG_RTC
209 case Order_Time:
210 tm = get_time();
211 snprintf(buffer, MAX_PATH, "%02d:%02d:%02d %s",
212 global_settings.timeformat == 0
213 ?tm->tm_hour:tm->tm_hour-12,
214 tm->tm_min, tm->tm_sec,
215 global_settings.timeformat == 0
216 ?"":tm->tm_hour>11?"P":"A");
217 break;
218 case Order_Date:
219 tm = get_time();
220 snprintf(buffer, MAX_PATH, "%s %d %s %d", str(dayname[tm->tm_wday]),
221 tm->tm_year+1900,
222 str(monthname[tm->tm_mon]),
223 tm->tm_mday);
224 break;
225#endif
226 case Order_Buffer: /* buffer */
164 { 227 {
165 long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */ 228 long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
166 int integer = buflen / 1000; 229 int integer = buflen / 1000;
@@ -170,7 +233,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
170 integer, decimal); 233 integer, decimal);
171 } 234 }
172 break; 235 break;
173 case 3: /* battery */ 236 case Order_Batt: /* battery */
174#if CONFIG_CHARGING == CHARGING_CONTROL 237#if CONFIG_CHARGING == CHARGING_CONTROL
175 if (charge_state == CHARGING) 238 if (charge_state == CHARGING)
176 snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE)); 239 snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE));
@@ -186,7 +249,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
186 else 249 else
187 strcpy(buffer, "(n/a)"); 250 strcpy(buffer, "(n/a)");
188 break; 251 break;
189 case 4: /* disc usage 1 */ 252 case Order_Disk1: /* disc usage 1 */
190#ifdef HAVE_MULTIVOLUME 253#ifdef HAVE_MULTIVOLUME
191 output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true); 254 output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true);
192 output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true); 255 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)
197 snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); 260 snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
198#endif 261#endif
199 break; 262 break;
200 case 5: /* disc usage 2 */ 263 case Order_Disk2: /* disc usage 2 */
201#ifdef HAVE_MULTIVOLUME 264#ifdef HAVE_MULTIVOLUME
202 if (info->size2) 265 if (info->size2)
203 { 266 {
@@ -223,23 +286,38 @@ static int info_speak_item(int selected_item, void * data)
223 ID2P(LANG_KILOBYTE), 286 ID2P(LANG_KILOBYTE),
224 ID2P(LANG_MEGABYTE), 287 ID2P(LANG_MEGABYTE),
225 ID2P(LANG_GIGABYTE) 288 ID2P(LANG_GIGABYTE)
226 }; 289 };
227 switch (selected_item) 290 switch (selected_item)
228 { 291 {
229 case 0:/* version, not voiced, so say the time instead */ 292 case Order_SVN_revision: /* version */
230#if CONFIG_RTC 293 talk_id(LANG_VERSION, false);
231 talk_date_time(get_time(), false); 294 talk_spell(appsversion, true);
232#endif
233 break; 295 break;
234 case 1: /* nothing */ 296#if CONFIG_RTC
297 case Order_Time:
298 talk_id(LANG_CURRENT_TIME, false);
299 talk_time(get_time(), true);
235 break; 300 break;
236 case 2: /* buffer, not spoken */ 301 case Order_Date:
302 talk_date(get_time(), true);
237 break; 303 break;
238 case 3: /* battery */ 304#endif
305 case Order_Buffer: /* buffer, not spoken */
306 {
307 talk_id(LANG_BUFFER_STAT, false);
308 long buflen = (audiobufend - audiobuf) / 1024L;
309 output_dyn_value(NULL, 0, buflen, kbyte_units, true);
310 break;
311 }
312 case Order_Batt: /* battery */
239 if (battery_level() >= 0) 313 if (battery_level() >= 0)
240 { 314 {
241 talk_id(LANG_BATTERY_TIME, false); 315 talk_id(LANG_BATTERY_TIME, false);
242 talk_value(battery_level(), UNIT_PERCENT, true); 316 talk_value(battery_level(), UNIT_PERCENT, true);
317 if(battery_time () / 60 > 0)
318 talk_value(battery_time () / 60, UNIT_INT, true);
319 if(battery_time () % 60 > 0)
320 talk_value(battery_time () % 60, UNIT_INT, true);
243#if CONFIG_CHARGING >= CHARGING_MONITOR 321#if CONFIG_CHARGING >= CHARGING_MONITOR
244 if (charge_state == CHARGING) 322 if (charge_state == CHARGING)
245 talk_id(LANG_BATTERY_CHARGE, true); 323 talk_id(LANG_BATTERY_CHARGE, true);
@@ -252,20 +330,27 @@ static int info_speak_item(int selected_item, void * data)
252#endif 330#endif
253 } 331 }
254 break; 332 break;
255 case 4: /* disk 1 */ 333 case Order_Disk1: /* disk 1 */
256 talk_id(LANG_DISK_FREE_INFO, false);
257#ifdef HAVE_MULTIVOLUME 334#ifdef HAVE_MULTIVOLUME
335 talk_id(LANG_DISK_FREE_INFO, false);
258 talk_id(LANG_DISK_NAME_INTERNAL, true); 336 talk_id(LANG_DISK_NAME_INTERNAL, true);
259#endif
260 output_dyn_value(NULL, 0, info->free, kbyte_units, true); 337 output_dyn_value(NULL, 0, info->free, kbyte_units, true);
338#else
339 talk_id(LANG_DISK_SIZE_INFO, false);
340 output_dyn_value(NULL, 0, info->size, kbyte_units, true);
341#endif
261 break; 342 break;
262 case 5: /* disk 2 */ 343 case Order_Disk2: /* disk 2 */
263#ifdef HAVE_MULTIVOLUME 344#ifdef HAVE_MULTIVOLUME
264 if (info->size2) 345 if (info->size2)
265 { 346 {
347 talk_id(LANG_DISK_FREE_INFO, false);
266 talk_id(LANG_DISK_NAME_MMC, false); 348 talk_id(LANG_DISK_NAME_MMC, false);
267 output_dyn_value(NULL, 0, info->free2, kbyte_units, true); 349 output_dyn_value(NULL, 0, info->free2, kbyte_units, true);
268 } 350 }
351#else
352 talk_id(LANG_DISK_FREE_INFO, false);
353 output_dyn_value(NULL, 0, info->free, kbyte_units, true);
269#endif 354#endif
270 break; 355 break;
271 } 356 }
@@ -274,7 +359,8 @@ static int info_speak_item(int selected_item, void * data)
274 359
275static int info_action_callback(int action, struct gui_synclist *lists) 360static int info_action_callback(int action, struct gui_synclist *lists)
276{ 361{
277 (void)lists; 362 if (action == ACTION_STD_CANCEL)
363 return action;
278 if ((action == ACTION_STD_OK) 364 if ((action == ACTION_STD_OK)
279#ifdef HAVE_MULTIVOLUME 365#ifdef HAVE_MULTIVOLUME
280 || action == SYS_HOTSWAP_INSERTED 366 || action == SYS_HOTSWAP_INSERTED
@@ -294,13 +380,33 @@ static int info_action_callback(int action, struct gui_synclist *lists)
294#endif 380#endif
295 return ACTION_REDRAW; 381 return ACTION_REDRAW;
296 } 382 }
383 else if (lists->gui_list[SCREEN_MAIN].show_selection_marker == true)
384 {
385 if (lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP1
386#if CONFIG_RTC
387 || lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP2
388#endif
389 )
390 {
391 if (action == ACTION_STD_PREV)
392 {
393 gui_synclist_select_item(lists, lists->gui_list[SCREEN_MAIN].selected_item-1);
394 return ACTION_REDRAW;
395 }
396 else if (action == ACTION_STD_NEXT)
397 {
398 gui_synclist_select_item(lists, lists->gui_list[SCREEN_MAIN].selected_item+1);
399 return ACTION_REDRAW;
400 }
401 }
402 }
297 return action; 403 return action;
298} 404}
299static bool show_info(void) 405static bool show_info(void)
300{ 406{
301 struct info_data data = {.new_data = true}; 407 struct info_data data = {.new_data = true };
302 struct simplelist_info info; 408 struct simplelist_info info;
303 simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), 6, (void*)&data); 409 simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), Order_Count, (void*)&data);
304 info.hide_selection = !global_settings.talk_menu; 410 info.hide_selection = !global_settings.talk_menu;
305 info.get_name = info_getname; 411 info.get_name = info_getname;
306 if(global_settings.talk_menu) 412 if(global_settings.talk_menu)
diff --git a/apps/screens.c b/apps/screens.c
index dc54a00b1d..7e48ae16fb 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 Björn Stenberg 10 * Copyright (C) 2002 Bj�rn Stenberg
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -791,30 +791,8 @@ void charging_splash(void)
791 791
792#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) 792#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
793 793
794const int dayname[] = { 794extern const int dayname[];
795 LANG_WEEKDAY_SUNDAY, 795extern const int monthname[];
796 LANG_WEEKDAY_MONDAY,
797 LANG_WEEKDAY_TUESDAY,
798 LANG_WEEKDAY_WEDNESDAY,
799 LANG_WEEKDAY_THURSDAY,
800 LANG_WEEKDAY_FRIDAY,
801 LANG_WEEKDAY_SATURDAY
802};
803
804const int monthname[] = {
805 LANG_MONTH_JANUARY,
806 LANG_MONTH_FEBRUARY,
807 LANG_MONTH_MARCH,
808 LANG_MONTH_APRIL,
809 LANG_MONTH_MAY,
810 LANG_MONTH_JUNE,
811 LANG_MONTH_JULY,
812 LANG_MONTH_AUGUST,
813 LANG_MONTH_SEPTEMBER,
814 LANG_MONTH_OCTOBER,
815 LANG_MONTH_NOVEMBER,
816 LANG_MONTH_DECEMBER
817};
818 796
819/* little helper function for voice output */ 797/* little helper function for voice output */
820static void say_time(int cursorpos, const struct tm *tm) 798static void say_time(int cursorpos, const struct tm *tm)
diff --git a/apps/talk.c b/apps/talk.c
index ede0aff66b..0c8fafbe59 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -848,66 +848,61 @@ void talk_disable(bool disable)
848} 848}
849 849
850#if CONFIG_RTC 850#if CONFIG_RTC
851void talk_date_time(struct tm *tm, bool speak_current_time_string) 851void talk_date(struct tm *tm, bool enqueue)
852{ 852{
853 if(global_settings.talk_menu) 853 talk_id(LANG_MONTH_JANUARY + tm->tm_mon, enqueue);
854 talk_number(tm->tm_mday, true);
855 talk_number(1900 + tm->tm_year, true);
856}
857
858void talk_time(struct tm *tm, bool enqueue)
859{
860 if (global_settings.timeformat == 1)
854 { 861 {
855 if(speak_current_time_string) 862 /* Voice the hour */
856 talk_id(VOICE_CURRENT_TIME, true); 863 long am_pm_id = VOICE_AM;
857 if (global_settings.timeformat == 1) 864 int hour = tm->tm_hour;
865 if (hour >= 12)
858 { 866 {
859 long am_pm_id = VOICE_AM; 867 am_pm_id = VOICE_PM;
860 int hour = tm->tm_hour; 868 hour -= 12;
861 869 }
862 if (hour >= 12) 870 if (hour == 0)
863 { 871 hour = 12;
864 am_pm_id = VOICE_PM; 872 talk_number(hour, enqueue);
865 hour -= 12;
866 }
867 if (hour == 0)
868 hour = 12;
869
870 talk_number(hour, true);
871 873
872 /* Voice the minutes */ 874 /* Voice the minutes */
873 if (tm->tm_min == 0) 875 if (tm->tm_min == 0)
874 { 876 {
875 /* Say o'clock if the minute is 0. */ 877 /* Say o'clock if the minute is 0. */
876 talk_id(VOICE_OCLOCK, true); 878 talk_id(VOICE_OCLOCK, true);
877 }
878 else
879 {
880 /* Pronounce the leading 0 */
881 if(tm->tm_min < 10)
882 {
883 talk_id(VOICE_OH, true);
884 }
885 talk_number(tm->tm_min, true);
886 }
887 talk_id(am_pm_id, true);
888 } 879 }
889 else 880 else
890 { 881 {
891 /* Voice the time in 24 hour format */ 882 /* Pronounce the leading 0 */
892 talk_number(tm->tm_hour, true); 883 if(tm->tm_min < 10)
893 if (tm->tm_min == 0) 884 talk_id(VOICE_OH, true);
894 { 885 talk_number(tm->tm_min, true);
895 talk_id(VOICE_HUNDRED, true); 886 }
896 talk_id(VOICE_HOUR, true); 887 talk_id(am_pm_id, true);
897 } 888 }
898 else 889 else
899 { 890 {
900 /* Pronounce the leading 0 */ 891 /* Voice the time in 24 hour format */
901 if(tm->tm_min < 10) 892 talk_number(tm->tm_hour, enqueue);
902 { 893 if (tm->tm_min == 0)
903 talk_id(VOICE_OH, true); 894 {
904 } 895 talk_id(VOICE_HUNDRED, true);
905 talk_number(tm->tm_min, true); 896 talk_id(VOICE_HOUR, true);
906 } 897 }
898 else
899 {
900 /* Pronounce the leading 0 */
901 if(tm->tm_min < 10)
902 talk_id(VOICE_OH, true);
903 talk_number(tm->tm_min, true);
907 } 904 }
908 talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
909 talk_number(tm->tm_mday, true);
910 talk_number(1900 + tm->tm_year, true);
911 } 905 }
912} 906}
907
913#endif 908#endif
diff --git a/apps/talk.h b/apps/talk.h
index a939c1f3d1..0dea8d6b18 100644
--- a/apps/talk.h
+++ b/apps/talk.h
@@ -80,9 +80,11 @@ void talk_shutup(void); /* Interrupt voice, as when enqueue is false */
80#if CONFIG_RTC 80#if CONFIG_RTC
81/* this is in talk.c which isnt compiled for hwcodec simulator */ 81/* this is in talk.c which isnt compiled for hwcodec simulator */
82#if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC 82#if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC
83void talk_date_time(struct tm *time, bool speak_current_time_string); 83void talk_time(struct tm *tm, bool enqueue);
84void talk_date(struct tm *tm, bool enqueue);
84#else 85#else
85#define talk_date_time(t, s) 86#define talk_date(t, e)
87#define talk_time(t, e)
86#endif 88#endif
87#endif /* CONFIG_RTC */ 89#endif /* CONFIG_RTC */
88 90