From 21ca64d7cda167d325d9b21ac25155eff13aac12 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 27 Nov 2022 23:01:14 +0100 Subject: File Browser: Add “Set As..." context menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moves options for configuring: - Playlist Directory - Recording Directory - Start Directory into a single menu. Necessary prerequisite for giving the "Playlist Catalogue" context menu item a title that's a little more action-oriented ("Add to Playlist…”). Change-Id: I4ee08fc67d5350c38ae1a57cb345c4ed1082d0b5 --- apps/lang/english.lang | 83 +++++++++++++++++++---- apps/onplay.c | 47 +++++++------ manual/configure_rockbox/playback_options.tex | 4 +- manual/rockbox_interface/browsing_and_playing.tex | 35 ++++++---- 4 files changed, 118 insertions(+), 51 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 29a2527bec..d5f6ac3fa7 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -5411,19 +5411,19 @@ id: LANG_SET_AS_REC_DIR - desc: used in the onplay menu to set a recording dir + desc: deprecated user: core *: none - recording: "Set As Recording Directory" + recording: "" *: none - recording: "Set As Recording Directory" + recording: "" *: none - recording: "Set As Recording Directory" + recording: "" @@ -11587,16 +11587,16 @@ id: LANG_SET_AS_START_DIR - desc: used in the onplay menu to set a starting browser dir + desc: deprecated user: core - *: "Start File Browser Here" + *: "" - *: "Start File Browser Here" + *: "" - *: "Start File Browser Here" + *: "" @@ -11702,16 +11702,16 @@ id: LANG_SET_AS_PLAYLISTCAT_DIR - desc: used in the onplay menu to set a playlist catalogue dir + desc: deprecated user: core - *: "Set As Playlist Catalogue Directory" + *: "" - *: "Set As Playlist Catalogue Directory" + *: "" - *: "Set As Playlist Catalogue Directory" + *: "" @@ -16402,3 +16402,62 @@ *: "Rewind across tracks" + + id: LANG_SET_AS + desc: used in the onplay menu + user: core + + *: "Set As..." + + + *: "Set As..." + + + *: "Set As..." + + + + id: LANG_PLAYLIST_DIR + desc: used in the onplay menu + user: core + + *: "Playlist Directory" + + + *: "Playlist Directory" + + + *: "Playlist Directory" + + + + id: LANG_START_DIR + desc: used in the onplay menu + user: core + + *: "Start Directory" + + + *: "Start Directory" + + + *: "Start Directory" + + + + id: LANG_RECORDING_DIR + desc: used in the onplay menu + user: core + + *: none + recording: "Recording Directory" + + + *: none + recording: "Recording Directory" + + + *: none + recording: "Recording Directory" + + diff --git a/apps/onplay.c b/apps/onplay.c index a3efadd8f6..842a328ee9 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -796,18 +796,6 @@ static bool cat_add_to_a_new_playlist(void) return catalog_add_to_a_playlist(selected_file, selected_file_attr, true, NULL); } -static int clipboard_callback(int action, - const struct menu_item_ex *this_item, - struct gui_synclist *this_list); - -static bool set_catalogdir(void) -{ - catalog_set_directory(selected_file); - settings_save(); - return false; -} -MENUITEM_FUNCTION(set_catalogdir_item, 0, ID2P(LANG_SET_AS_PLAYLISTCAT_DIR), - set_catalogdir, clipboard_callback, Icon_Playlist); static int cat_playlist_callback(int action, const struct menu_item_ex *this_item, @@ -819,7 +807,7 @@ MENUITEM_FUNCTION(cat_add_to_new, 0, ID2P(LANG_CATALOG_ADD_TO_NEW), cat_add_to_a_new_playlist, NULL, Icon_Playlist); MAKE_ONPLAYMENU(cat_playlist_menu, ID2P(LANG_CATALOG), cat_playlist_callback, Icon_Playlist, - &cat_add_to_list, &cat_add_to_new, &set_catalogdir_item); + &cat_add_to_list, &cat_add_to_new); void onplay_show_playlist_cat_menu(char* track_name) { @@ -1621,7 +1609,7 @@ static bool set_recdir(void) settings_save(); return false; } -MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR), +MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_RECORDING_DIR), set_recdir, clipboard_callback, Icon_Recording); #endif static bool set_startdir(void) @@ -1632,9 +1620,26 @@ static bool set_startdir(void) settings_save(); return false; } -MENUITEM_FUNCTION(set_startdir_item, 0, ID2P(LANG_SET_AS_START_DIR), +MENUITEM_FUNCTION(set_startdir_item, 0, ID2P(LANG_START_DIR), set_startdir, clipboard_callback, Icon_file_view_menu); +static bool set_catalogdir(void) +{ + catalog_set_directory(selected_file); + settings_save(); + return false; +} +MENUITEM_FUNCTION(set_catalogdir_item, 0, ID2P(LANG_PLAYLIST_DIR), + set_catalogdir, clipboard_callback, Icon_Playlist); + +MAKE_ONPLAYMENU(set_as_dir_menu, ID2P(LANG_SET_AS), + clipboard_callback, Icon_NOICON, + &set_catalogdir_item, +#ifdef HAVE_RECORDING + &set_recdir_item, +#endif + &set_startdir_item); + static int clipboard_callback(int action, const struct menu_item_ex *this_item, struct gui_synclist *this_list) @@ -1692,7 +1697,8 @@ static int clipboard_callback(int action, /* only for directories */ if (this_item == &delete_dir_item || this_item == &set_startdir_item || - this_item == &set_catalogdir_item + this_item == &set_catalogdir_item || + this_item == &set_as_dir_menu #ifdef HAVE_RECORDING || this_item == &set_recdir_item #endif @@ -1756,17 +1762,14 @@ MAKE_ONPLAYMENU( tree_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE), &view_playlist_item, &tree_playlist_menu, &cat_playlist_menu, &rename_file_item, &clipboard_cut_item, &clipboard_copy_item, &clipboard_paste_item, &delete_file_item, &delete_dir_item, -#if LCD_DEPTH > 1 - &set_backdrop_item, -#endif &list_viewers_item, &create_dir_item, &properties_item, &track_info_item, #ifdef HAVE_TAGCACHE &pictureflow_item, #endif -#ifdef HAVE_RECORDING - &set_recdir_item, +#if LCD_DEPTH > 1 + &set_backdrop_item, #endif - &set_startdir_item, &add_to_faves_item, &file_menu, + &add_to_faves_item, &set_as_dir_menu, &file_menu, ); static int onplaymenu_callback(int action, const struct menu_item_ex *this_item, diff --git a/manual/configure_rockbox/playback_options.tex b/manual/configure_rockbox/playback_options.tex index 0c75315214..efcaa5a181 100644 --- a/manual/configure_rockbox/playback_options.tex +++ b/manual/configure_rockbox/playback_options.tex @@ -224,10 +224,10 @@ you to configure settings related to audio playback. % \section{\label{ref:ConstrainAutoChange}Constrain Auto-Change} - If enabled and you have set \setting{Start File Browser Here} to a directory + If enabled and you have set \setting{Start Directory} to a directory other than root, \setting{Auto-Change Directory} will be constrained to the directory you have chosen and those below it. - See \reference{ref:StartFileBrowserHere}. + See \reference{ref:StartDirectory}. % \opt{headphone_detection}{ diff --git a/manual/rockbox_interface/browsing_and_playing.tex b/manual/rockbox_interface/browsing_and_playing.tex index 1a97aaab31..d97d227fe9 100644 --- a/manual/rockbox_interface/browsing_and_playing.tex +++ b/manual/rockbox_interface/browsing_and_playing.tex @@ -148,11 +148,6 @@ each option pertains both to files and directories): Deletes the currently selected directory and all of the files and subdirectories it may contain. Deleted directories cannot be recovered. Use this feature with caution! -\opt{lcd_non-mono}{ -\item [Set As Backdrop.] - Set the selected \fname{bmp} file as background image. The bitmaps need to meet the - conditions explained in \reference{ref:LoadingBackdrops}. -} \item [Open with.] Runs a viewer plugin on the file. Normally, when a file is selected in Rockbox, Rockbox automatically detects the file type and runs the appropriate plugin. @@ -168,17 +163,11 @@ each option pertains both to files and directories): Shows properties such as size and the time and date of the last modification for the selected file. If used on a directory, the number of files and subdirectories will be shown, as well as the total size. -\opt{recording}{ - \item [Set As Recording Directory.] - Save recordings in the selected directory. +\opt{lcd_non-mono}{ +\item [Set As Backdrop.] + Set the selected \fname{bmp} file as background image. The bitmaps need to meet the + conditions explained in \reference{ref:LoadingBackdrops}. } -\item [\label{ref:StartFileBrowserHere}Start File Browser Here.] - This option allows users to set the currently selected directory as the default - start directory for the file browser. This option is not available for files. - \note{If you have \setting{Auto-Change Directory} and - \setting{Constrain Auto-Change} enabled, the directories returned will - be constrained to the directory you have chosen here and those below it. - See \reference{ref:ConstrainAutoChange}} \item [Add to Shortcuts.] Adds a link to the selected item in the \fname{shortcuts.link} file. If the file does not already exist it will be created in the root directory. @@ -186,6 +175,22 @@ each option pertains both to files and directories): selecting, but simply bring you to its location in the \setting{File Browser}. \end{description} +\subsubsection{Set As...} +\begin{description} + \item [Playlist Directory.] + Set as default directory for the Playlist Catalogue. + \opt{recording}{ + \item [Recording Directory.] + Save recordings in the selected directory. + } + \item [\label{ref:StartDirectory}Start Directory.] + Set as default start directory for the File Browser. + \note{If you have \setting{Auto-Change Directory} and + \setting{Constrain Auto-Change} enabled, the directories returned will + be constrained to the directory you have chosen here and those below it. + See \reference{ref:ConstrainAutoChange}} +\end{description} + \subsection{\label{sec:virtual_keyboard}Virtual Keyboard} \screenshot{rockbox_interface/images/ss-virtual-keyboard}{The virtual keyboard}{} This is the virtual keyboard that is used when entering text in Rockbox, for -- cgit v1.2.3