add description handling to MixerSnapshots and save_as_template

This commit is contained in:
Nikolaus Gullotta 2019-08-23 14:22:26 -05:00 committed by Nikolaus Gullotta
parent daa274d12f
commit 05a93ce6fd
No known key found for this signature in database
GPG key ID: 565F60578092AA31
6 changed files with 22 additions and 8 deletions

View file

@ -213,7 +213,7 @@ void MixerSnapshotList::new_snapshot() {
//actually create the snapshot
RouteList rl = PublicEditor::instance().get_selection().tracks.routelist();
_session->snapshot_manager().create_snapshot(name, rl, _global);
_session->snapshot_manager().create_snapshot(name, string(), rl, _global);
redisplay();
}
}
@ -241,7 +241,7 @@ void MixerSnapshotList::choose_external_dialog_response(int response)
}
}
_session->snapshot_manager().create_snapshot(name, external, _global);
_session->snapshot_manager().create_snapshot(name, string(), external, _global);
redisplay();
}

View file

@ -34,7 +34,6 @@ using namespace ARDOUR;
SaveTemplateDialog::SaveTemplateDialog (const std::string& name, const std::string& desc, bool local)
: ArdourDialog (_("Save as template"))
{
printf("saving %s\n", local ? "LOCAL" : "PREFS");
_local = local;
_name_entry.get_buffer()->set_text (name);

View file

@ -106,6 +106,9 @@ class LIBARDOUR_API MixerSnapshot
std::string get_label() {return label;};
void set_label(const std::string& new_label) {label = new_label; LabelChanged(this);};
std::string get_description() {return _description;}
void set_description(const std::string& new_desc) {_description = new_desc; DescriptionChanged();};
std::string get_path() {return _path;};
void set_path(const std::string& new_path) {_path = new_path; PathChanged(this);};
@ -122,6 +125,7 @@ class LIBARDOUR_API MixerSnapshot
//signals
PBD::Signal1<void, ARDOUR::MixerSnapshot*> LabelChanged;
PBD::Signal0<void> DescriptionChanged;
PBD::Signal1<void, ARDOUR::MixerSnapshot*> PathChanged;
private:
ARDOUR::Session* _session;
@ -136,7 +140,8 @@ class LIBARDOUR_API MixerSnapshot
unsigned int id;
bool favorite;
std::string label;
std::string label;
std::string _description;
std::time_t timestamp;
std::string last_modified_with;
std::string suffix;

View file

@ -39,8 +39,8 @@ public:
MixerSnapshotManager (ARDOUR::Session*);
~MixerSnapshotManager() {}
void create_snapshot(const std::string& label, RouteList& rl, bool global);
void create_snapshot(const std::string& label, const std::string& from_path, bool global);
void create_snapshot(const std::string& label, const std::string& desc, RouteList& rl, bool global);
void create_snapshot(const std::string& label, const std::string& desc, const std::string& from_path, bool global);
bool rename_snapshot(MixerSnapshot*, const std::string&);
bool remove_snapshot(MixerSnapshot*);

View file

@ -451,6 +451,14 @@ void MixerSnapshot::write(const string dir)
XMLTree tree;
tree.set_root(node);
if(_description != string()) {
XMLNode* desc = new XMLNode(X_("description"));
XMLNode* dn = new XMLNode(X_("content"), _description);
desc->add_child_copy(*dn);
tree.root()->add_child_copy(*desc);
}
tree.write(path.c_str());
}

View file

@ -197,12 +197,14 @@ MixerSnapshot* MixerSnapshotManager::get_snapshot_by_name(const string& name, bo
}
}
void MixerSnapshotManager::create_snapshot(const string& label, RouteList& rl, bool global)
void MixerSnapshotManager::create_snapshot(const string& label, const string& desc, RouteList& rl, bool global)
{
ensure_snapshot_dir(global);
const string path = global ? _global_path : _local_path;
MixerSnapshot* snapshot = new MixerSnapshot(_session);
snapshot->set_description(desc);
if(!rl.empty()) {
//just this routelist
snapshot->snap(rl);
@ -236,7 +238,7 @@ void MixerSnapshotManager::create_snapshot(const string& label, RouteList& rl, b
snapshots_list.insert(snapshot);
}
void MixerSnapshotManager::create_snapshot(const string& label, const string& from_path, bool global)
void MixerSnapshotManager::create_snapshot(const string& label, const string& desc, const string& from_path, bool global)
{
ensure_snapshot_dir(global);
const string path = global ? _global_path : _local_path;