diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-06-01 02:00:30 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2024-04-01 17:23:06 +0100 |
commit | f026cc4e176fb80e8d592b95d7a012b7565dd6cc (patch) | |
tree | a0b2204da3050188a7d5b15c6e96a01d9b3f30e9 | |
parent | ac1f92d9e8856f76dd15bc8a314e0646adbe9cf9 (diff) | |
download | rockbox-f026cc4e17.tar.gz rockbox-f026cc4e17.zip |
tagcache: Add menu entry for customizing the DB path
Allow the database path to be set from the file browser's
"Set As" context menu, so it can be changed without editing
the .cfg file by hand.
Change-Id: Ie1a84bcb2084ee3b1a0a18cc51f564238515f164
-rw-r--r-- | apps/debug_menu.c | 1 | ||||
-rw-r--r-- | apps/lang/english.lang | 14 | ||||
-rw-r--r-- | apps/onplay.c | 19 | ||||
-rw-r--r-- | apps/settings_list.c | 6 | ||||
-rw-r--r-- | manual/rockbox_interface/browsing_and_playing.tex | 7 |
5 files changed, 47 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 36927dd890..c0f6904c8e 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1871,6 +1871,7 @@ static int database_callback(int btn, struct gui_synclist *lists) stat->initialized ? "Yes" : "No"); simplelist_addline("DB Ready: %s", stat->ready ? "Yes" : "No"); + simplelist_addline("DB Path: %s", stat->db_path); simplelist_addline("RAM Cache: %s", stat->ramcache ? "Yes" : "No"); simplelist_addline("RAM: %d/%d B", diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 3773d138d4..1287a26c39 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -16641,3 +16641,17 @@ *: "Go to Last Album" </voice> </phrase> +<phrase> + id: LANG_DATABASE_DIR + desc: in database settings menu + user: core + <source> + *: "Database Directory" + </source> + <dest> + *: "Database Directory" + </dest> + <voice> + *: "Database Directory" + </voice> +</phrase> diff --git a/apps/onplay.c b/apps/onplay.c index ccebee402e..a85284c7d0 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -1390,9 +1390,27 @@ static bool set_catalogdir(void) MENUITEM_FUNCTION(set_catalogdir_item, 0, ID2P(LANG_PLAYLIST_DIR), set_catalogdir, clipboard_callback, Icon_Playlist); +static bool set_databasedir(void) +{ + path_append(global_settings.tagcache_db_path, selected_file, + PA_SEP_SOFT, sizeof(global_settings.tagcache_db_path)); + + struct tagcache_stat *tc_stat = tagcache_get_stat(); + if (strcasecmp(global_settings.tagcache_db_path, tc_stat->db_path)) + { + splashf(HZ, ID2P(LANG_PLEASE_REBOOT)); + } + + settings_save(); + return false; +} +MENUITEM_FUNCTION(set_databasedir_item, 0, ID2P(LANG_DATABASE_DIR), + set_databasedir, clipboard_callback, Icon_Audio); + MAKE_ONPLAYMENU(set_as_dir_menu, ID2P(LANG_SET_AS), clipboard_callback, Icon_NOICON, &set_catalogdir_item, + &set_databasedir_item, #ifdef HAVE_RECORDING &set_recdir_item, #endif @@ -1454,6 +1472,7 @@ static int clipboard_callback(int action, if (this_item == &delete_dir_item || this_item == &set_startdir_item || this_item == &set_catalogdir_item || + this_item == &set_databasedir_item || this_item == &set_as_dir_menu #ifdef HAVE_RECORDING || this_item == &set_recdir_item diff --git a/apps/settings_list.c b/apps/settings_list.c index 6f6425a693..74db7550bf 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -142,6 +142,12 @@ (struct filename_setting[]){ \ {prefix,suffix,sizeof(global_settings.var)}}} } +#define DIRECTORY_SETTING(flags,var,lang_id,name,default) \ + {flags|F_DIRNAME|F_T_UCHARPTR, &global_settings.var, lang_id, \ + CHARPTR(default), name, NULL, \ + {.filename_setting=(struct filename_setting[]){ \ + {NULL, NULL, sizeof(global_settings.var)}}}} + /* Used for settings which use the set_option() setting screen. The ... arg is a list of pointers to strings to display in the setting screen. These can either be literal strings, or ID2P(LANG_*) */ diff --git a/manual/rockbox_interface/browsing_and_playing.tex b/manual/rockbox_interface/browsing_and_playing.tex index 8460c12ec9..973c8e08de 100644 --- a/manual/rockbox_interface/browsing_and_playing.tex +++ b/manual/rockbox_interface/browsing_and_playing.tex @@ -179,6 +179,13 @@ each option pertains both to files and directories): \begin{description} \item [Playlist Directory.] Set as default directory for the Playlist Catalogue. + \opt{tagcache}{ + \item [Database Directory.] + Rockbox usually stores database files in the \fname{/.rockbox} folder. + You can choose another location for the database using this setting. + This is mainly useful for multiboot targets, so the same database can + be shared among several builds without needing to rebuild it each time. + } \opt{recording}{ \item [Recording Directory.] Save recordings in the selected directory. |