Allow to revert export-format from disk

This allows to restore ProfileManager's ExportFormatSpec without
re-instantiating the ProfileManager.
This commit is contained in:
Robin Gareus
2018-11-21 23:14:52 +01:00
parent 3d366053e2
commit 9326ced760
2 changed files with 18 additions and 0 deletions

View File

@@ -205,6 +205,7 @@ class LIBARDOUR_API ExportProfileManager
std::string save_format_to_disk (ExportFormatSpecPtr format);
void remove_format_profile (ExportFormatSpecPtr format);
void revert_format_profile (ExportFormatSpecPtr format);
ExportFormatSpecPtr get_new_format (ExportFormatSpecPtr original);
PBD::Signal0<void> FormatListChanged;

View File

@@ -661,6 +661,23 @@ ExportProfileManager::remove_format_profile (ExportFormatSpecPtr format)
FormatListChanged ();
}
void
ExportProfileManager::revert_format_profile (ExportFormatSpecPtr format)
{
FileMap::iterator it;
if ((it = format_file_map.find (format->id())) == format_file_map.end()) {
return;
}
XMLTree tree;
if (!tree.read (it->second.c_str())) {
return;
}
format->set_state (*tree.root());
FormatListChanged ();
}
ExportFormatSpecPtr
ExportProfileManager::get_new_format (ExportFormatSpecPtr original)
{