Add UI config-option for freesound download cache

This also invalidates any prior libardour rc-config
(which was not previously exposed as config).

Note: old existing cache is not moved or invalidated
when the path changes.
This commit is contained in:
Robin Gareus 2022-05-20 22:02:26 +02:00
parent f925dd675e
commit 7fa207d9ee
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 20 additions and 1 deletions

View File

@ -2430,6 +2430,15 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_only_copy_imported_files)
));
add_option (_("General"),
new DirectoryOption (
X_("freesound-dir"),
_("Cache Folder for downloaded Freesound clips:"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_freesound_dir),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_freesound_dir)
));
add_option (_("General"), new OptionEditorHeading (_("Export")));
add_option (_("General"),

View File

@ -106,7 +106,7 @@ Mootcher:: ~Mootcher()
void Mootcher::ensureWorkingDir ()
{
std::string p = ARDOUR::Config->get_freesound_download_dir();
std::string const& p = UIConfiguration::instance ().get_freesound_dir ();
DEBUG_TRACE(PBD::DEBUG::Freesound, "ensureWorkingDir() - " + p + "\n");
if (!Glib::file_test (p, Glib::FILE_TEST_IS_DIR)) {

View File

@ -94,6 +94,15 @@ UIConfiguration::UIConfiguration ()
{
load_state();
/* Setup defaults */
if (get_freesound_dir ().empty ()) {
std::string const& d (Glib::build_filename (ARDOUR::user_cache_directory (), "freesound"));
set_freesound_dir (d);
if (!Glib::file_test (d, Glib::FILE_TEST_EXISTS)) {
g_mkdir_with_parents (d.c_str (), 0755);
}
}
ColorsChanged.connect (boost::bind (&UIConfiguration::colors_changed, this));
ParameterChanged.connect (sigc::mem_fun (*this, &UIConfiguration::parameter_changed));

View File

@ -139,6 +139,7 @@ UI_CONFIG_VARIABLE (bool, one_plugin_window_only, "one-plugin-window-only", fals
UI_CONFIG_VARIABLE (int, default_lower_midi_note, "default-lower-midi-note", 60)
UI_CONFIG_VARIABLE (int, default_upper_midi_note, "default-upper-midi-note", 71)
UI_CONFIG_VARIABLE (bool, ask_before_closing_last_window, "ask-before-closing-last-window", true)
UI_CONFIG_VARIABLE (std::string, freesound_dir, "freesound-dir", "")
/* these are visibility-type selections in the New Track dialog that we should make persistent for the user's choices */
UI_CONFIG_VARIABLE (bool, show_on_cue_page, "show-on-cue-page", true)