Handle export presets from config dirs properly. Removed some debug output.
git-svn-id: svn://localhost/ardour2/branches/3.0@3977 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5fa6ed1966
commit
063ab23465
@ -50,7 +50,7 @@ class ExportPreset {
|
|||||||
XMLNode const * get_global_state () const { return global.root(); }
|
XMLNode const * get_global_state () const { return global.root(); }
|
||||||
XMLNode const * get_local_state () const { return local; }
|
XMLNode const * get_local_state () const { return local; }
|
||||||
|
|
||||||
void save () const;
|
void save (std::string const & filename);
|
||||||
void remove_local () const;
|
void remove_local () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -101,10 +101,11 @@ ExportPreset::set_local_state (XMLNode & state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ExportPreset::save () const
|
ExportPreset::save (std::string const & filename)
|
||||||
{
|
{
|
||||||
save_instant_xml ();
|
save_instant_xml ();
|
||||||
if (global.root()) {
|
if (global.root()) {
|
||||||
|
global.set_filename (filename);
|
||||||
global.write ();
|
global.write ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,6 @@ ExportProfileManager::ExportProfileManager (Session & s) :
|
|||||||
search_path += ardour_search_path().add_subdirectory_to_paths("export");
|
search_path += ardour_search_path().add_subdirectory_to_paths("export");
|
||||||
search_path += system_config_search_path().add_subdirectory_to_paths("export");;
|
search_path += system_config_search_path().add_subdirectory_to_paths("export");;
|
||||||
|
|
||||||
std::cout << "search_path: " << search_path.to_string () << std::endl;
|
|
||||||
|
|
||||||
/* create export config directory if necessary */
|
/* create export config directory if necessary */
|
||||||
|
|
||||||
if (!sys::exists (export_config_dir)) {
|
if (!sys::exists (export_config_dir)) {
|
||||||
@ -163,8 +161,9 @@ ExportProfileManager::load_presets ()
|
|||||||
ExportProfileManager::PresetPtr
|
ExportProfileManager::PresetPtr
|
||||||
ExportProfileManager::save_preset (string const & name)
|
ExportProfileManager::save_preset (string const & name)
|
||||||
{
|
{
|
||||||
|
string filename = export_config_dir.to_string() + "/" + name + export_preset_suffix;
|
||||||
|
|
||||||
if (!current_preset) {
|
if (!current_preset) {
|
||||||
string filename = export_config_dir.to_string() + "/" + name + export_preset_suffix;
|
|
||||||
current_preset.reset (new ExportPreset (filename, session));
|
current_preset.reset (new ExportPreset (filename, session));
|
||||||
preset_list.push_back (current_preset);
|
preset_list.push_back (current_preset);
|
||||||
}
|
}
|
||||||
@ -179,7 +178,7 @@ ExportProfileManager::save_preset (string const & name)
|
|||||||
current_preset->set_global_state (*global_preset);
|
current_preset->set_global_state (*global_preset);
|
||||||
current_preset->set_local_state (*local_preset);
|
current_preset->set_local_state (*local_preset);
|
||||||
|
|
||||||
current_preset->save();
|
current_preset->save (filename);
|
||||||
|
|
||||||
return current_preset;
|
return current_preset;
|
||||||
}
|
}
|
||||||
@ -210,12 +209,13 @@ void
|
|||||||
ExportProfileManager::load_preset_from_disk (PBD::sys::path const & path)
|
ExportProfileManager::load_preset_from_disk (PBD::sys::path const & path)
|
||||||
{
|
{
|
||||||
PresetPtr preset (new ExportPreset (path.to_string(), session));
|
PresetPtr preset (new ExportPreset (path.to_string(), session));
|
||||||
preset_list.push_back (preset);
|
|
||||||
|
|
||||||
/* Handle id to filename mapping */
|
/* Handle id to filename mapping and don't add duplicates to list */
|
||||||
|
|
||||||
FilePair pair (preset->id(), path);
|
FilePair pair (preset->id(), path);
|
||||||
preset_file_map.insert (pair);
|
if (preset_file_map.insert (pair).second) {
|
||||||
|
preset_list.push_back (preset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user