File Browser: Add “Set As..." context menu

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
This commit is contained in:
Christian Soffke 2022-11-27 23:01:14 +01:00
parent 5bb062391f
commit 21ca64d7cd
4 changed files with 118 additions and 51 deletions

View file

@ -5411,19 +5411,19 @@
</phrase>
<phrase>
id: LANG_SET_AS_REC_DIR
desc: used in the onplay menu to set a recording dir
desc: deprecated
user: core
<source>
*: none
recording: "Set As Recording Directory"
recording: ""
</source>
<dest>
*: none
recording: "Set As Recording Directory"
recording: ""
</dest>
<voice>
*: none
recording: "Set As Recording Directory"
recording: ""
</voice>
</phrase>
<phrase>
@ -11587,16 +11587,16 @@
</phrase>
<phrase>
id: LANG_SET_AS_START_DIR
desc: used in the onplay menu to set a starting browser dir
desc: deprecated
user: core
<source>
*: "Start File Browser Here"
*: ""
</source>
<dest>
*: "Start File Browser Here"
*: ""
</dest>
<voice>
*: "Start File Browser Here"
*: ""
</voice>
</phrase>
<phrase>
@ -11702,16 +11702,16 @@
</phrase>
<phrase>
id: LANG_SET_AS_PLAYLISTCAT_DIR
desc: used in the onplay menu to set a playlist catalogue dir
desc: deprecated
user: core
<source>
*: "Set As Playlist Catalogue Directory"
*: ""
</source>
<dest>
*: "Set As Playlist Catalogue Directory"
*: ""
</dest>
<voice>
*: "Set As Playlist Catalogue Directory"
*: ""
</voice>
</phrase>
<phrase>
@ -16402,3 +16402,62 @@
*: "Rewind across tracks"
</voice>
</phrase>
<phrase>
id: LANG_SET_AS
desc: used in the onplay menu
user: core
<source>
*: "Set As..."
</source>
<dest>
*: "Set As..."
</dest>
<voice>
*: "Set As..."
</voice>
</phrase>
<phrase>
id: LANG_PLAYLIST_DIR
desc: used in the onplay menu
user: core
<source>
*: "Playlist Directory"
</source>
<dest>
*: "Playlist Directory"
</dest>
<voice>
*: "Playlist Directory"
</voice>
</phrase>
<phrase>
id: LANG_START_DIR
desc: used in the onplay menu
user: core
<source>
*: "Start Directory"
</source>
<dest>
*: "Start Directory"
</dest>
<voice>
*: "Start Directory"
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_DIR
desc: used in the onplay menu
user: core
<source>
*: none
recording: "Recording Directory"
</source>
<dest>
*: none
recording: "Recording Directory"
</dest>
<voice>
*: none
recording: "Recording Directory"
</voice>
</phrase>

View file

@ -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,

View file

@ -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}{

View file

@ -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