summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2017-08-18 19:53:46 +0200
committerRobin Gareus <robin@gareus.org>2017-08-20 21:09:30 +0200
commitae51d5fd4ebb90f782334ac0b4addc0c88e1629c (patch)
tree2409ee3fa7ad3c9c5f207324f44d0f67bf4befd4 /libs/ardour
parent908369ab3e31f82eae3734cfe61421912d2fba6a (diff)
Let the user add a template description on saving session templates
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/session.h4
-rw-r--r--libs/ardour/session_state.cc16
2 files changed, 15 insertions, 5 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 6fe760c2b8..0581d706ff 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -259,7 +259,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
*/
RouteList new_route_from_template (uint32_t how_many, PresentationInfo::order_t insert_at, const std::string& template_path, const std::string& name, PlaylistDisposition pd = NewPlaylist);
RouteList new_route_from_template (uint32_t how_many, PresentationInfo::order_t insert_at, XMLNode&, const std::string& name, PlaylistDisposition pd = NewPlaylist);
- std::vector<std::string> get_paths_for_new_sources (bool allow_replacing, const std::string& import_file_path,
+ std::vector<std::string> get_paths_for_new_sources (bool allow_replacing, const std::string& import_file_path,
uint32_t channels, std::vector<std::string> const & smf_track_names);
int bring_all_sources_into_session (boost::function<void(uint32_t,uint32_t,std::string)> callback);
@@ -531,7 +531,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
int archive_session (const std::string&, const std::string&, ArchiveEncode compress_audio = FLAC_16BIT, bool only_used_sources = false, Progress* p = 0);
int restore_state (std::string snapshot_name);
- int save_template (std::string template_name, bool replace_existing = false);
+ int save_template (const std::string& template_name, const std::string& description = "", bool replace_existing = false);
int save_history (std::string snapshot_name = "");
int restore_history (std::string snapshot_name);
void remove_state (std::string snapshot_name);
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0a1eb2ace6..0bf09f76c6 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -2356,7 +2356,7 @@ Session::XMLSourceFactory (const XMLNode& node)
}
int
-Session::save_template (string template_name, bool replace_existing)
+Session::save_template (const string& template_name, const string& description, bool replace_existing)
{
if ((_state_of_the_state & CannotSave) || template_name.empty ()) {
return -1;
@@ -2411,12 +2411,22 @@ Session::save_template (string template_name, bool replace_existing)
SessionSaveUnderway (); /* EMIT SIGNAL */
XMLTree tree;
-
+ XMLNode* root;
{
PBD::Unwinder<std::string> uw (_template_state_dir, template_dir_path);
- tree.set_root (&get_template());
+ root = &get_template();
+ }
+
+ if (!description.empty()) {
+ XMLNode* desc = new XMLNode(X_("description"));
+ XMLNode* desc_cont = new XMLNode(X_("content"), description);
+ desc->add_child_nocopy (*desc_cont);
+
+ root->add_child_nocopy (*desc);
}
+ tree.set_root (root);
+
if (!tree.write (template_file_path)) {
error << _("template not saved") << endmsg;
return -1;