summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2010-05-11 13:40:25 +0000
committerJeffrey Goode <jeffg7@gmail.com>2010-05-11 13:40:25 +0000
commite141f80e11c08fbb9d404c192f1ef4bcf28c7a74 (patch)
treebce928acbd2bfe793b8a3250d7305ef17f9f94bc
parent565a863dd50b62245e52e18caaf5306955f6b9f5 (diff)
downloadrockbox-e141f80e11c08fbb9d404c192f1ef4bcf28c7a74.tar.gz
rockbox-e141f80e11c08fbb9d404c192f1ef4bcf28c7a74.zip
Add Insert Shuffled to hotkey options
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25950 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/onplay.c27
-rw-r--r--apps/onplay.h1
-rw-r--r--apps/settings_list.c6
-rw-r--r--manual/appendix/config_file_options.tex4
4 files changed, 30 insertions, 8 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index fc236fc854..da94dbd5b8 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -1195,6 +1195,19 @@ static bool open_with(void)
1195 return list_viewers(); 1195 return list_viewers();
1196} 1196}
1197 1197
1198static int playlist_insert_shuffled(void)
1199{
1200 if ((audio_status() & AUDIO_STATUS_PLAY) ||
1201 (selected_file_attr & ATTR_DIRECTORY) ||
1202 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))
1203 {
1204 playlist_insert_func((intptr_t*)PLAYLIST_INSERT_SHUFFLED);
1205 return ONPLAY_START_PLAY;
1206 }
1207
1208 return ONPLAY_RELOAD_DIR;
1209}
1210
1198struct hotkey_assignment { 1211struct hotkey_assignment {
1199 int action; /* hotkey_action */ 1212 int action; /* hotkey_action */
1200 int lang_id; /* Language ID */ 1213 int lang_id; /* Language ID */
@@ -1228,6 +1241,9 @@ static struct hotkey_assignment hotkey_items[] = {
1228 { HOTKEY_INSERT, LANG_INSERT, 1241 { HOTKEY_INSERT, LANG_INSERT,
1229 HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT), 1242 HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT),
1230 ONPLAY_START_PLAY }, 1243 ONPLAY_START_PLAY },
1244 { HOTKEY_INSERT_SHUFFLED, LANG_INSERT_SHUFFLED,
1245 HOTKEY_FUNC(playlist_insert_shuffled, NULL),
1246 ONPLAY_OK },
1231}; 1247};
1232 1248
1233static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]); 1249static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]);
@@ -1261,15 +1277,20 @@ static int execute_hotkey(bool is_wps)
1261 { 1277 {
1262 /* run the associated function (with optional param), if any */ 1278 /* run the associated function (with optional param), if any */
1263 const struct menu_func func = this_item->func; 1279 const struct menu_func func = this_item->func;
1280 int func_return;
1264 if (func.function != NULL) 1281 if (func.function != NULL)
1265 { 1282 {
1266 if (func.param != NULL) 1283 if (func.param != NULL)
1267 (*func.function_w_param)(func.param); 1284 func_return = (*func.function_w_param)(func.param);
1268 else 1285 else
1269 (*func.function)(); 1286 func_return = (*func.function)();
1270 } 1287 }
1271 /* return with the associated code */ 1288 /* return with the associated code */
1272 return this_item->return_code; 1289 const int return_code = this_item->return_code;
1290 /* ONPLAY_OK here means to use the function return code */
1291 if (return_code == ONPLAY_OK)
1292 return func_return;
1293 return return_code;
1273 } 1294 }
1274 } 1295 }
1275 1296
diff --git a/apps/onplay.h b/apps/onplay.h
index a489b09cce..8462603bcc 100644
--- a/apps/onplay.h
+++ b/apps/onplay.h
@@ -42,6 +42,7 @@ enum hotkey_action {
42 HOTKEY_OPEN_WITH, 42 HOTKEY_OPEN_WITH,
43 HOTKEY_DELETE, 43 HOTKEY_DELETE,
44 HOTKEY_INSERT, 44 HOTKEY_INSERT,
45 HOTKEY_INSERT_SHUFFLED,
45}; 46};
46#endif 47#endif
47 48
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 5a16f09763..61853f8276 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1688,9 +1688,9 @@ const struct settings_list settings[] = {
1688 HOTKEY_OPEN_WITH, HOTKEY_DELETE), 1688 HOTKEY_OPEN_WITH, HOTKEY_DELETE),
1689 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree, 1689 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree,
1690 LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree", 1690 LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree",
1691 "off,open with,delete,insert", 1691 "off,open with,delete,insert,insert shuffled",
1692 UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, 4, HOTKEY_OFF, 1692 UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, 5, HOTKEY_OFF,
1693 HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_INSERT), 1693 HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_INSERT, HOTKEY_INSERT_SHUFFLED),
1694#endif 1694#endif
1695 1695
1696#if CONFIG_CODEC == SWCODEC 1696#if CONFIG_CODEC == SWCODEC
diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex
index 0dd2f83568..e70a020e26 100644
--- a/manual/appendix/config_file_options.tex
+++ b/manual/appendix/config_file_options.tex
@@ -126,8 +126,8 @@
126 \opt{hotkey}{ 126 \opt{hotkey}{
127 hotkey wps & off, view playlist, show track info, 127 hotkey wps & off, view playlist, show track info,
128 pitchscreen, open with, delete & N/A\\ 128 pitchscreen, open with, delete & N/A\\
129 hotkey tree & off, open with, delete, insert 129 hotkey tree & off, open with, delete, insert,
130 & N/A\\ 130 insert shuffled & N/A\\
131 } 131 }
132 sort files & alpha, oldest, newest, type & N/A\\ 132 sort files & alpha, oldest, newest, type & N/A\\
133 sort dirs & alpha, oldest, newest & N/A\\ 133 sort dirs & alpha, oldest, newest & N/A\\