diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-12-11 10:27:14 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-12-11 10:27:14 +0000 |
commit | 489436385f6f4543c3bc7e2d4c945f2440a611bb (patch) | |
tree | 9198629010184adaf2f56df9cee600f91568690f | |
parent | c2513580cbe8b94f9c229f8a8d518136ad75facc (diff) | |
download | rockbox-489436385f6f4543c3bc7e2d4c945f2440a611bb.tar.gz rockbox-489436385f6f4543c3bc7e2d4c945f2440a611bb.zip |
Add talk support to the shortcuts menu.
'talkclip: <filename>' in the [shortcut] will cause the list to .talk the file specified.
(.talk files are the same filetype as gets talked by the file listing... hopefully we can add rbutil support to generate these)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31210 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/shortcuts.c | 18 | ||||
-rw-r--r-- | manual/main_menu/main.tex | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index e8ea1df0d9..75e005b166 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "shortcuts.h" | 43 | #include "shortcuts.h" |
44 | #include "onplay.h" | 44 | #include "onplay.h" |
45 | #include "screens.h" | 45 | #include "screens.h" |
46 | #include "talk.h" | ||
46 | 47 | ||
47 | 48 | ||
48 | #define MAX_SHORTCUT_NAME 32 | 49 | #define MAX_SHORTCUT_NAME 32 |
@@ -61,6 +62,7 @@ static const char * const type_strings[SHORTCUT_TYPE_COUNT] = { | |||
61 | struct shortcut { | 62 | struct shortcut { |
62 | enum shortcut_type type; | 63 | enum shortcut_type type; |
63 | char name[MAX_SHORTCUT_NAME]; | 64 | char name[MAX_SHORTCUT_NAME]; |
65 | char talk_clip[MAX_PATH]; | ||
64 | int icon; | 66 | int icon; |
65 | union { | 67 | union { |
66 | char path[MAX_PATH]; | 68 | char path[MAX_PATH]; |
@@ -161,6 +163,7 @@ static void init_shortcut(struct shortcut* sc) | |||
161 | sc->type = SHORTCUT_UNDEFINED; | 163 | sc->type = SHORTCUT_UNDEFINED; |
162 | sc->name[0] = '\0'; | 164 | sc->name[0] = '\0'; |
163 | sc->u.path[0] = '\0'; | 165 | sc->u.path[0] = '\0'; |
166 | sc->talk_clip[0] = '\0'; | ||
164 | sc->icon = Icon_NOICON; | 167 | sc->icon = Icon_NOICON; |
165 | } | 168 | } |
166 | 169 | ||
@@ -296,6 +299,10 @@ int readline_cb(int n, char *buf, void *parameters) | |||
296 | sc->icon = atoi(value); | 299 | sc->icon = atoi(value); |
297 | } | 300 | } |
298 | } | 301 | } |
302 | else if (!strcmp(name, "talkclip")) | ||
303 | { | ||
304 | strlcpy(sc->talk_clip, value, MAX_PATH); | ||
305 | } | ||
299 | } | 306 | } |
300 | return 0; | 307 | return 0; |
301 | } | 308 | } |
@@ -381,6 +388,15 @@ static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data | |||
381 | return sc->icon; | 388 | return sc->icon; |
382 | } | 389 | } |
383 | 390 | ||
391 | int shortcut_menu_speak_item(int selected_item, void * data) | ||
392 | { | ||
393 | (void)data; | ||
394 | struct shortcut *sc = get_shortcut(selected_item); | ||
395 | if (sc && sc->talk_clip[0]) | ||
396 | talk_file(NULL, NULL, sc->talk_clip, NULL, NULL, false); | ||
397 | return 0; | ||
398 | } | ||
399 | |||
384 | void talk_timedate(void); | 400 | void talk_timedate(void); |
385 | const char* sleep_timer_formatter(char* buffer, size_t buffer_size, | 401 | const char* sleep_timer_formatter(char* buffer, size_t buffer_size, |
386 | int value, const char* unit); | 402 | int value, const char* unit); |
@@ -399,6 +415,8 @@ int do_shortcut_menu(void *ignored) | |||
399 | if (global_settings.show_icons) | 415 | if (global_settings.show_icons) |
400 | list.get_icon = shortcut_menu_get_icon; | 416 | list.get_icon = shortcut_menu_get_icon; |
401 | list.title_icon = Icon_Bookmark; | 417 | list.title_icon = Icon_Bookmark; |
418 | if (global_settings.talk_menu) | ||
419 | list.get_talk = shortcut_menu_speak_item; | ||
402 | 420 | ||
403 | push_current_activity(ACTIVITY_SHORTCUTSMENU); | 421 | push_current_activity(ACTIVITY_SHORTCUTSMENU); |
404 | 422 | ||
diff --git a/manual/main_menu/main.tex b/manual/main_menu/main.tex index 41e16ba1b5..33e64c12fe 100644 --- a/manual/main_menu/main.tex +++ b/manual/main_menu/main.tex | |||
@@ -298,6 +298,7 @@ each item to be displayed. Each shortcut looks like the following: | |||
298 | data: <what the shortcut actually links to> | 298 | data: <what the shortcut actually links to> |
299 | name: <what the shortcut should be displayed as> | 299 | name: <what the shortcut should be displayed as> |
300 | icon: <number of the theme icon to use (see \wikilink{CustomIcons})> | 300 | icon: <number of the theme icon to use (see \wikilink{CustomIcons})> |
301 | talkclip: <filename of a talk clip to speak when voice menus are enabled> | ||
301 | \end{example} | 302 | \end{example} |
302 | 303 | ||
303 | Only ``type'' and ``data'' are required (except if type is ``separator'' in which case | 304 | Only ``type'' and ``data'' are required (except if type is ``separator'' in which case |