summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStéphane Doyon <s.doyon@videotron.ca>2008-07-15 15:33:23 +0000
committerStéphane Doyon <s.doyon@videotron.ca>2008-07-15 15:33:23 +0000
commit91bfc4ca9589d324e5ead72c1fbf641151527e33 (patch)
tree43ae0ace6b78ec297fe37f03e12ffe7e11eaa01e
parent18c1ba4a2120e5967dab41ab2a2ed48887352d24 (diff)
downloadrockbox-91bfc4ca9589d324e5ead72c1fbf641151527e33.tar.gz
rockbox-91bfc4ca9589d324e5ead72c1fbf641151527e33.zip
Voice the playlist catalog.
See FS#6323. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18050 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang4
-rw-r--r--apps/playlist_catalog.c39
2 files changed, 33 insertions, 10 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 92e02e13b8..79a0d27ec1 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -7341,7 +7341,7 @@
7341 *: "%s doesn't exist" 7341 *: "%s doesn't exist"
7342 </dest> 7342 </dest>
7343 <voice> 7343 <voice>
7344 *: "" 7344 *: "Playlist directory doesn't exist"
7345 </voice> 7345 </voice>
7346</phrase> 7346</phrase>
7347<phrase> 7347<phrase>
@@ -7355,7 +7355,7 @@
7355 *: "No Playlists" 7355 *: "No Playlists"
7356 </dest> 7356 </dest>
7357 <voice> 7357 <voice>
7358 *: "" 7358 *: "No Playlists"
7359 </voice> 7359 </voice>
7360</phrase> 7360</phrase>
7361<phrase> 7361<phrase>
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c
index f23036ddea..15d74fa363 100644
--- a/apps/playlist_catalog.c
+++ b/apps/playlist_catalog.c
@@ -43,6 +43,7 @@
43#include "debug.h" 43#include "debug.h"
44#include "playlist_catalog.h" 44#include "playlist_catalog.h"
45#include "statusbar.h" 45#include "statusbar.h"
46#include "talk.h"
46 47
47#define MAX_PLAYLISTS 400 48#define MAX_PLAYLISTS 400
48#define PLAYLIST_DISPLAY_COUNT 10 49#define PLAYLIST_DISPLAY_COUNT 10
@@ -95,7 +96,7 @@ static int initialize_catalog(void)
95 if (!playlist_dir_exists) 96 if (!playlist_dir_exists)
96 { 97 {
97 if (mkdir(playlist_dir) < 0) { 98 if (mkdir(playlist_dir) < 0) {
98 gui_syncsplash(HZ*2, str(LANG_CATALOG_NO_DIRECTORY), 99 gui_syncsplash(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY),
99 playlist_dir); 100 playlist_dir);
100 return -1; 101 return -1;
101 } 102 }
@@ -129,7 +130,7 @@ static int create_playlist_list(char** playlists, int num_items,
129 130
130 if (ft_load(tc, playlist_dir) < 0) 131 if (ft_load(tc, playlist_dir) < 0)
131 { 132 {
132 gui_syncsplash(HZ*2, str(LANG_CATALOG_NO_DIRECTORY), 133 gui_syncsplash(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY),
133 playlist_dir); 134 playlist_dir);
134 goto exit; 135 goto exit;
135 } 136 }
@@ -209,6 +210,13 @@ static char* playlist_callback_name(int selected_item, void* data,
209 return buffer; 210 return buffer;
210} 211}
211 212
213static int playlist_callback_voice(int selected_item, void* data)
214{
215 char** playlists = (char**) data;
216 talk_file_or_spell(playlist_dir, playlists[selected_item], NULL, false);
217 return 0;
218}
219
212/* Display all playlists in catalog. Selected "playlist" is returned. 220/* Display all playlists in catalog. Selected "playlist" is returned.
213 If "view" mode is set then we're not adding anything into playlist. */ 221 If "view" mode is set then we're not adding anything into playlist. */
214static int display_playlists(char* playlist, bool view) 222static int display_playlists(char* playlist, bool view)
@@ -226,7 +234,7 @@ static int display_playlists(char* playlist, bool view)
226 234
227 if (num_playlists <= 0) 235 if (num_playlists <= 0)
228 { 236 {
229 gui_syncsplash(HZ*2, str(LANG_CATALOG_NO_PLAYLISTS)); 237 gui_syncsplash(HZ*2, ID2P(LANG_CATALOG_NO_PLAYLISTS));
230 return -1; 238 return -1;
231 } 239 }
232 240
@@ -235,16 +243,19 @@ static int display_playlists(char* playlist, bool view)
235 243
236 gui_synclist_init(&playlist_lists, playlist_callback_name, playlists, 244 gui_synclist_init(&playlist_lists, playlist_callback_name, playlists,
237 false, 1, NULL); 245 false, 1, NULL);
246 if(global_settings.talk_menu)
247 gui_synclist_set_voice_callback(&playlist_lists,
248 playlist_callback_voice);
238 gui_synclist_set_nb_items(&playlist_lists, num_playlists); 249 gui_synclist_set_nb_items(&playlist_lists, num_playlists);
239 gui_synclist_draw(&playlist_lists); 250 gui_synclist_draw(&playlist_lists);
251 gui_synclist_speak_item(&playlist_lists);
240 252
241 while (!exit) 253 while (!exit)
242 { 254 {
243 int button = get_action(CONTEXT_LIST,HZ/2); 255 int button;
244 char* sel_file; 256 char* sel_file;
245 257 list_do_action(CONTEXT_LIST,HZ/2,
246 gui_synclist_do_button(&playlist_lists, &button,LIST_WRAP_UNLESS_HELD); 258 &playlist_lists, &button,LIST_WRAP_UNLESS_HELD);
247
248 sel_file = playlists[gui_synclist_get_sel_pos(&playlist_lists)]; 259 sel_file = playlists[gui_synclist_get_sel_pos(&playlist_lists)];
249 260
250 switch (button) 261 switch (button)
@@ -280,7 +291,10 @@ static int display_playlists(char* playlist, bool view)
280 exit = true; 291 exit = true;
281 } 292 }
282 else 293 else
294 {
283 gui_synclist_draw(&playlist_lists); 295 gui_synclist_draw(&playlist_lists);
296 gui_synclist_speak_item(&playlist_lists);
297 }
284 } 298 }
285 break; 299 break;
286 300
@@ -304,6 +318,15 @@ static int display_playlists(char* playlist, bool view)
304 insert */ 318 insert */
305static void display_insert_count(int count) 319static void display_insert_count(int count)
306{ 320{
321 static long talked_tick = 0;
322 if(count && (talked_tick == 0
323 || TIME_AFTER(current_tick, talked_tick+5*HZ)))
324 {
325 talked_tick = current_tick;
326 talk_number(count, false);
327 talk_id(LANG_PLAYLIST_INSERT_COUNT, true);
328 }
329
307 gui_syncsplash(0, str(LANG_PLAYLIST_INSERT_COUNT), count, 330 gui_syncsplash(0, str(LANG_PLAYLIST_INSERT_COUNT), count,
308 str(LANG_OFF_ABORT)); 331 str(LANG_OFF_ABORT));
309} 332}
@@ -390,7 +413,7 @@ static int add_to_playlist(const char* playlist, bool new_playlist,
390 /* search directory for tracks and append to playlist */ 413 /* search directory for tracks and append to playlist */
391 bool recurse = false; 414 bool recurse = false;
392 const char *lines[] = { 415 const char *lines[] = {
393 str(LANG_RECURSE_DIRECTORY_QUESTION), sel}; 416 ID2P(LANG_RECURSE_DIRECTORY_QUESTION), sel};
394 const struct text_message message={lines, 2}; 417 const struct text_message message={lines, 2};
395 struct add_track_context context; 418 struct add_track_context context;
396 419