A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Christian Soffke and committed by
Solomon Peachy
4346a1e8 6e063199

+62 -7
+7 -2
apps/filetree.c
··· 58 58 static struct compare_data 59 59 { 60 60 int sort_dir; /* qsort key for sorting directories */ 61 + int sort_file; /* ...for sorting files */ 61 62 int(*_compar)(const char*, const char*, size_t); 62 63 } cmp_data; 63 64 ··· 234 235 235 236 if (cmp_data.sort_dir == SORT_AS_FILE) 236 237 { /* treat as two files */ 237 - criteria = global_settings.sort_file; 238 + criteria = cmp_data.sort_file; 238 239 } 239 240 else if (e1->attr & ATTR_DIRECTORY && e2->attr & ATTR_DIRECTORY) 240 241 { /* two directories */ ··· 253 254 } 254 255 else if (!(e1->attr & ATTR_DIRECTORY) && !(e2->attr & ATTR_DIRECTORY)) 255 256 { /* two files */ 256 - criteria = global_settings.sort_file; 257 + criteria = cmp_data.sort_file; 257 258 } 258 259 else /* dir and file, dir goes first */ 259 260 return (e2->attr & ATTR_DIRECTORY) - (e1->attr & ATTR_DIRECTORY); ··· 424 425 425 426 /* allow directories to be sorted into file list */ 426 427 cmp_data.sort_dir = (*c->dirfilter == SHOW_PLUGINS) ? SORT_AS_FILE : c->sort_dir; 428 + 429 + /* playlist catalog uses sorting independent from file browser */ 430 + cmp_data.sort_file = (*c->dirfilter == SHOW_M3U) ? 431 + global_settings.sort_playlists : global_settings.sort_file; 427 432 428 433 if (global_settings.sort_case) 429 434 {
+14
apps/lang/english.lang
··· 16956 16956 *: "Playlist finished. Play again?" 16957 16957 </voice> 16958 16958 </phrase> 16959 + <phrase> 16960 + id: LANG_SORT_PLAYLISTS 16961 + desc: playlists sorting setting 16962 + user: core 16963 + <source> 16964 + *: "Sort Playlists" 16965 + </source> 16966 + <dest> 16967 + *: "Sort Playlists" 16968 + </dest> 16969 + <voice> 16970 + *: "sort playlists" 16971 + </voice> 16972 + </phrase>
+3 -1
apps/menu.c
··· 578 578 shortcuts_add(SHORTCUT_SETTING, (void*)setting); 579 579 break; 580 580 #endif 581 - } /* swicth(do_menu()) */ 581 + } /* switch(do_menu()) */ 582 + if (menu->flags & MENU_EXITAFTERTHISMENU) 583 + done = true; /* in case onplay menu contains setting */ 582 584 redraw_lists = true; 583 585 } 584 586 } /* else if (!in_stringlist) */
+3 -1
apps/menus/playlist_menu.c
··· 157 157 &show_shuffled_adding_options, 158 158 &show_queue_options); 159 159 160 + MENUITEM_SETTING(sort_playlists, &global_settings.sort_playlists, NULL); 160 161 MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL, 161 162 Icon_Playlist, 162 - &viewer_settings_menu, &recursive_dir_insert, &currentplaylist_settings_menu); 163 + &sort_playlists, &viewer_settings_menu, &recursive_dir_insert, 164 + &currentplaylist_settings_menu); 163 165 MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL, 164 166 Icon_Playlist, 165 167 &view_cur_playlist, &save_playlist,
+5 -2
apps/menus/settings_menu.c
··· 220 220 { 221 221 (void)this_list; 222 222 223 + /* Show File View menu in Settings or File Browser, 224 + but not in Database or Playlist Catalog */ 223 225 if (action == ACTION_REQUEST_MENUITEM && 224 226 this_item == &file_menu && 225 - get_onplay_context() == CONTEXT_ID3DB && 226 - get_current_activity() != ACTIVITY_SETTINGS) 227 + get_current_activity() != ACTIVITY_SETTINGS && 228 + (get_onplay_context() != CONTEXT_TREE 229 + || *tree_get_context()->dirfilter == SHOW_M3U)) 227 230 return ACTION_EXIT_MENUITEM; 228 231 229 232 return action;
+18 -1
apps/onplay.c
··· 1132 1132 #endif 1133 1133 ); 1134 1134 1135 + int sort_playlists_callback(int action, 1136 + const struct menu_item_ex *this_item, 1137 + struct gui_synclist *this_list) 1138 + { 1139 + (void) this_list; 1140 + (void) this_item; 1141 + 1142 + if (action == ACTION_REQUEST_MENUITEM && 1143 + *tree_get_context()->dirfilter != SHOW_M3U) 1144 + { 1145 + return ACTION_EXIT_MENUITEM; 1146 + } 1147 + return action; 1148 + } 1149 + 1150 + MENUITEM_SETTING(sort_playlists, &global_settings.sort_playlists, sort_playlists_callback); 1151 + 1135 1152 MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW), 1136 1153 view_playlist, 1137 1154 onplaymenu_callback, Icon_Playlist); ··· 1149 1166 #if LCD_DEPTH > 1 1150 1167 &set_backdrop_item, 1151 1168 #endif 1152 - &add_to_faves_item, &set_as_dir_menu, &file_menu, 1169 + &add_to_faves_item, &set_as_dir_menu, &file_menu, &sort_playlists, 1153 1170 ); 1154 1171 static int onplaymenu_callback(int action, 1155 1172 const struct menu_item_ex *this_item,
+1
apps/settings.h
··· 682 682 bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */ 683 683 int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */ 684 684 int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */ 685 + int sort_playlists; /* in playlist catalog 0=alpha, 1=date, 2=date (new first) */ 685 686 int interpret_numbers; /* true=strnatcmp, false=strcmp */ 686 687 687 688 /* power settings */
+4
apps/settings_list.c
··· 1415 1415 "sort files", "alpha,oldest,newest,type", treesort_callback, 4, 1416 1416 ID2P(LANG_SORT_ALPHA), ID2P(LANG_SORT_DATE), 1417 1417 ID2P(LANG_SORT_DATE_REVERSE) , ID2P(LANG_SORT_TYPE)), 1418 + CHOICE_SETTING(0, sort_playlists, LANG_SORT_PLAYLISTS, 0 , 1419 + "sort playlists", "alpha,oldest,newest", treesort_callback, 3, 1420 + ID2P(LANG_SORT_ALPHA), ID2P(LANG_SORT_DATE), 1421 + ID2P(LANG_SORT_DATE_REVERSE)), 1418 1422 CHOICE_SETTING(0, interpret_numbers, LANG_SORT_INTERPRET_NUMBERS, 1, 1419 1423 "sort interpret number", "digits,numbers",treesort_callback, 2, 1420 1424 ID2P(LANG_SORT_INTERPRET_AS_DIGIT),
+1
manual/appendix/config_file_options.tex
··· 150 150 delete, insert, insert shuffled & N/A\\} 151 151 } 152 152 sort files & alpha, oldest, newest, type & N/A\\ 153 + sort playlists & alpha, oldest, newest & N/A\\ 153 154 sort dirs & alpha, oldest, newest & N/A\\ 154 155 sort interpret number & digits, numbers & N/A\\ 155 156 tagcache\_autoupdate
+6
manual/configure_rockbox/playlist_options.tex
··· 7 7 8 8 \begin{description} 9 9 10 + \item[Sort Playlists.] 11 + This option adjusts the sorting of items listed in the \setting{Playlists} 12 + menu (see \reference{ref:playlistoptions}). You can also press 13 + \ActionStdContext{} in the \setting{Playlists} menu to access the option 14 + from there, directly. 15 + 10 16 \item[Playlist Viewer Settings.] 11 17 This submenu contains settings related to the Playlist Viewer. 12 18 \begin{description}