summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2008-10-16 15:13:23 +0000
committerSakari Bergen <sakari.bergen@beatwaves.net>2008-10-16 15:13:23 +0000
commit063ab23465759839eb723c20664cbfe388701fda (patch)
tree26f833ed6fb7f36ea6b9430cc7a244811d5d7ccb /libs
parent5fa6ed1966d68b10041d7c563ef214ef33be0e88 (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/export_preset.h2
-rw-r--r--libs/ardour/export_preset.cc3
-rw-r--r--libs/ardour/export_profile_manager.cc14
3 files changed, 10 insertions, 9 deletions
diff --git a/libs/ardour/ardour/export_preset.h b/libs/ardour/ardour/export_preset.h
index 56c27f3442..de321aacd6 100644
--- a/libs/ardour/ardour/export_preset.h
+++ b/libs/ardour/ardour/export_preset.h
@@ -50,7 +50,7 @@ class ExportPreset {
XMLNode const * get_global_state () const { return global.root(); }
XMLNode const * get_local_state () const { return local; }
- void save () const;
+ void save (std::string const & filename);
void remove_local () const;
private:
diff --git a/libs/ardour/export_preset.cc b/libs/ardour/export_preset.cc
index 620daa0f7f..1c19cae513 100644
--- a/libs/ardour/export_preset.cc
+++ b/libs/ardour/export_preset.cc
@@ -101,10 +101,11 @@ ExportPreset::set_local_state (XMLNode & state)
}
void
-ExportPreset::save () const
+ExportPreset::save (std::string const & filename)
{
save_instant_xml ();
if (global.root()) {
+ global.set_filename (filename);
global.write ();
}
}
diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc
index b5d85fcfa2..600ce9e3ea 100644
--- a/libs/ardour/export_profile_manager.cc
+++ b/libs/ardour/export_profile_manager.cc
@@ -67,8 +67,6 @@ ExportProfileManager::ExportProfileManager (Session & s) :
search_path += ardour_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 */
if (!sys::exists (export_config_dir)) {
@@ -163,8 +161,9 @@ ExportProfileManager::load_presets ()
ExportProfileManager::PresetPtr
ExportProfileManager::save_preset (string const & name)
{
+ string filename = export_config_dir.to_string() + "/" + name + export_preset_suffix;
+
if (!current_preset) {
- string filename = export_config_dir.to_string() + "/" + name + export_preset_suffix;
current_preset.reset (new ExportPreset (filename, session));
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_local_state (*local_preset);
- current_preset->save();
+ current_preset->save (filename);
return current_preset;
}
@@ -210,12 +209,13 @@ void
ExportProfileManager::load_preset_from_disk (PBD::sys::path const & path)
{
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);
- preset_file_map.insert (pair);
+ if (preset_file_map.insert (pair).second) {
+ preset_list.push_back (preset);
+ }
}
bool