From 9326ced760315986fbce617bece607d75985e027 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 21 Nov 2018 23:14:52 +0100 Subject: Allow to revert export-format from disk This allows to restore ProfileManager's ExportFormatSpec without re-instantiating the ProfileManager. --- libs/ardour/ardour/export_profile_manager.h | 1 + libs/ardour/export_profile_manager.cc | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'libs') diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index 4f477f65b9..a2685fa199 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -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 FormatListChanged; diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 14c57436ab..877b434377 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -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) { -- cgit v1.2.3