forked from len0rd/rockbox
Add Insert Shuffled to hotkey options
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25950 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
565a863dd5
commit
e141f80e11
4 changed files with 30 additions and 8 deletions
|
|
@ -1195,6 +1195,19 @@ static bool open_with(void)
|
||||||
return list_viewers();
|
return list_viewers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int playlist_insert_shuffled(void)
|
||||||
|
{
|
||||||
|
if ((audio_status() & AUDIO_STATUS_PLAY) ||
|
||||||
|
(selected_file_attr & ATTR_DIRECTORY) ||
|
||||||
|
((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))
|
||||||
|
{
|
||||||
|
playlist_insert_func((intptr_t*)PLAYLIST_INSERT_SHUFFLED);
|
||||||
|
return ONPLAY_START_PLAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ONPLAY_RELOAD_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
struct hotkey_assignment {
|
struct hotkey_assignment {
|
||||||
int action; /* hotkey_action */
|
int action; /* hotkey_action */
|
||||||
int lang_id; /* Language ID */
|
int lang_id; /* Language ID */
|
||||||
|
|
@ -1228,6 +1241,9 @@ static struct hotkey_assignment hotkey_items[] = {
|
||||||
{ HOTKEY_INSERT, LANG_INSERT,
|
{ HOTKEY_INSERT, LANG_INSERT,
|
||||||
HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT),
|
HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT),
|
||||||
ONPLAY_START_PLAY },
|
ONPLAY_START_PLAY },
|
||||||
|
{ HOTKEY_INSERT_SHUFFLED, LANG_INSERT_SHUFFLED,
|
||||||
|
HOTKEY_FUNC(playlist_insert_shuffled, NULL),
|
||||||
|
ONPLAY_OK },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]);
|
static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]);
|
||||||
|
|
@ -1261,15 +1277,20 @@ static int execute_hotkey(bool is_wps)
|
||||||
{
|
{
|
||||||
/* run the associated function (with optional param), if any */
|
/* run the associated function (with optional param), if any */
|
||||||
const struct menu_func func = this_item->func;
|
const struct menu_func func = this_item->func;
|
||||||
|
int func_return;
|
||||||
if (func.function != NULL)
|
if (func.function != NULL)
|
||||||
{
|
{
|
||||||
if (func.param != NULL)
|
if (func.param != NULL)
|
||||||
(*func.function_w_param)(func.param);
|
func_return = (*func.function_w_param)(func.param);
|
||||||
else
|
else
|
||||||
(*func.function)();
|
func_return = (*func.function)();
|
||||||
}
|
}
|
||||||
/* return with the associated code */
|
/* return with the associated code */
|
||||||
return this_item->return_code;
|
const int return_code = this_item->return_code;
|
||||||
|
/* ONPLAY_OK here means to use the function return code */
|
||||||
|
if (return_code == ONPLAY_OK)
|
||||||
|
return func_return;
|
||||||
|
return return_code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ enum hotkey_action {
|
||||||
HOTKEY_OPEN_WITH,
|
HOTKEY_OPEN_WITH,
|
||||||
HOTKEY_DELETE,
|
HOTKEY_DELETE,
|
||||||
HOTKEY_INSERT,
|
HOTKEY_INSERT,
|
||||||
|
HOTKEY_INSERT_SHUFFLED,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1688,9 +1688,9 @@ const struct settings_list settings[] = {
|
||||||
HOTKEY_OPEN_WITH, HOTKEY_DELETE),
|
HOTKEY_OPEN_WITH, HOTKEY_DELETE),
|
||||||
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree,
|
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree,
|
||||||
LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree",
|
LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree",
|
||||||
"off,open with,delete,insert",
|
"off,open with,delete,insert,insert shuffled",
|
||||||
UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, 4, HOTKEY_OFF,
|
UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, 5, HOTKEY_OFF,
|
||||||
HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_INSERT),
|
HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_INSERT, HOTKEY_INSERT_SHUFFLED),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,8 @@
|
||||||
\opt{hotkey}{
|
\opt{hotkey}{
|
||||||
hotkey wps & off, view playlist, show track info,
|
hotkey wps & off, view playlist, show track info,
|
||||||
pitchscreen, open with, delete & N/A\\
|
pitchscreen, open with, delete & N/A\\
|
||||||
hotkey tree & off, open with, delete, insert
|
hotkey tree & off, open with, delete, insert,
|
||||||
& N/A\\
|
insert shuffled & N/A\\
|
||||||
}
|
}
|
||||||
sort files & alpha, oldest, newest, type & N/A\\
|
sort files & alpha, oldest, newest, type & N/A\\
|
||||||
sort dirs & alpha, oldest, newest & N/A\\
|
sort dirs & alpha, oldest, newest & N/A\\
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue