mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
playlist catalog: sort independently from file browser
Allow independent sorting of playlists in the playlist catalog, using the context menu. You may want to usually sort playlists by their date (modified), but sort audio tracks alphabetically. This is now possible without having to constantly adjust a setting. The fact that 'Sort Files' applied to both the file browser and playlist catalog seems more like a side effect of the implementation, rather than behavior that is wanted. Additionally, the 'By Type' sorting makes no sense when only a single type is displayed. Since many of the other File View settings don't apply to the playlist catalog, hide the menu there. Change-Id: Ic35038015d0860998ae117f472ce23ce3bc80cfa
This commit is contained in:
parent
6e06319988
commit
4346a1e8e7
10 changed files with 62 additions and 7 deletions
|
@ -58,6 +58,7 @@
|
|||
static struct compare_data
|
||||
{
|
||||
int sort_dir; /* qsort key for sorting directories */
|
||||
int sort_file; /* ...for sorting files */
|
||||
int(*_compar)(const char*, const char*, size_t);
|
||||
} cmp_data;
|
||||
|
||||
|
@ -234,7 +235,7 @@ static int compare(const void* p1, const void* p2)
|
|||
|
||||
if (cmp_data.sort_dir == SORT_AS_FILE)
|
||||
{ /* treat as two files */
|
||||
criteria = global_settings.sort_file;
|
||||
criteria = cmp_data.sort_file;
|
||||
}
|
||||
else if (e1->attr & ATTR_DIRECTORY && e2->attr & ATTR_DIRECTORY)
|
||||
{ /* two directories */
|
||||
|
@ -253,7 +254,7 @@ static int compare(const void* p1, const void* p2)
|
|||
}
|
||||
else if (!(e1->attr & ATTR_DIRECTORY) && !(e2->attr & ATTR_DIRECTORY))
|
||||
{ /* two files */
|
||||
criteria = global_settings.sort_file;
|
||||
criteria = cmp_data.sort_file;
|
||||
}
|
||||
else /* dir and file, dir goes first */
|
||||
return (e2->attr & ATTR_DIRECTORY) - (e1->attr & ATTR_DIRECTORY);
|
||||
|
@ -425,6 +426,10 @@ int ft_load(struct tree_context* c, const char* tempdir)
|
|||
/* allow directories to be sorted into file list */
|
||||
cmp_data.sort_dir = (*c->dirfilter == SHOW_PLUGINS) ? SORT_AS_FILE : c->sort_dir;
|
||||
|
||||
/* playlist catalog uses sorting independent from file browser */
|
||||
cmp_data.sort_file = (*c->dirfilter == SHOW_M3U) ?
|
||||
global_settings.sort_playlists : global_settings.sort_file;
|
||||
|
||||
if (global_settings.sort_case)
|
||||
{
|
||||
if (global_settings.interpret_numbers == SORT_INTERPRET_AS_NUMBER)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue