Commit 936199ff authored by Antoine Cellerier's avatar Antoine Cellerier

Change --directory-version-sort boolean config option to a --directory-sort...

Change --directory-version-sort boolean config option to a --directory-sort multiple choice option. This makes more sense and makes it possible to provide more sort options if needed without breaking backwards compatibility. The description strings are a bit long but they more or less fit in the prefs dialog here.
parent df61155f
......@@ -144,10 +144,16 @@ int DirInit (access_t *p_access, DIR *handle)
goto error;
}
if (var_InheritBool (p_access, "directory-version-sort"))
char *psz_sort = var_InheritString (p_access, "directory-sort");
if (!psz_sort)
p_sys->compar = collate;
else if (!strcasecmp (psz_sort, "version"))
p_sys->compar = version;
else if (!strcasecmp (psz_sort, "none"))
p_sys->compar = NULL;
else
p_sys->compar = collate;
free(psz_sort);
root->parent = NULL;
root->handle = handle;
......
......@@ -48,12 +48,15 @@ static const char *const psz_recursive_list_text[] = {
"This is useful if you add directories that contain playlist files " \
"for instance. Use a comma-separated list of extensions." )
#define VERSION_SORT_TEXT N_("Use version sort")
#define VERSION_SORT_LONGTEXT N_( \
"When opening a directory, add items in a natural order. " \
"For example, track-1.ogg track-2.ogg track-10.ogg will be sorted " \
"as expected while the default method would sort them as " \
"track-1.ogg track-10.ogg track-2.ogg." )
static const char *const psz_sort_list[] = { "collate", "version", "none" };
static const char *const psz_sort_list_text[] = {
N_("Sort alphabetically according to the current language's collation rules."),
N_("Sort items in a natural order (for example: 1.ogg 2.ogg 10.ogg). This method does not take the current language's collation rules into account."),
N_("Do not sort the items.") };
#define SORT_TEXT N_("Directory sort order")
#define SORT_LONGTEXT N_( \
"Define the sort algorithm used when adding items from a directory." )
vlc_module_begin ()
set_description( N_("File input") )
......@@ -73,8 +76,8 @@ vlc_module_begin ()
change_string_list( psz_recursive_list, psz_recursive_list_text, 0 )
add_string( "ignore-filetypes", "m3u,db,nfo,ini,jpg,jpeg,ljpg,gif,png,pgm,pgmyuv,pbm,pam,tga,bmp,pnm,xpm,xcf,pcx,tif,tiff,lbm,sfv,txt,sub,idx,srt,cue,ssa",
IGNORE_TEXT, IGNORE_LONGTEXT, false )
add_bool( "directory-version-sort", false,
VERSION_SORT_TEXT, VERSION_SORT_LONGTEXT, false );
add_string( "directory-sort", "collate", SORT_TEXT, SORT_LONGTEXT, false )
change_string_list( psz_sort_list, psz_sort_list_text, 0 )
#ifndef HAVE_FDOPENDIR
add_shortcut( "file", "directory", "dir" )
#else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment