more work on getting TemplateManager to use the SnapshotManager:

Create hookup, and use RenamedSnapshot signal
This commit is contained in:
Nikolaus Gullotta 2019-08-26 13:36:39 -05:00 committed by Nikolaus Gullotta
parent ef3f3d0f47
commit 54cd8e6368
No known key found for this signature in database
GPG key ID: 565F60578092AA31
4 changed files with 11 additions and 0 deletions

View file

@ -159,6 +159,7 @@ void MixerSnapshotList::set_session (Session* s)
if(_global) {
s->snapshot_manager().PromotedSnapshot.connect(connections, invalidator(*this), boost::bind(&MixerSnapshotList::add_promoted_snapshot, this, _1), gui_context());
s->snapshot_manager().RemovedSnapshot.connect(connections, invalidator(*this), boost::bind(&MixerSnapshotList::redisplay, this), gui_context());
s->snapshot_manager().RenamedSnapshot.connect(connections, invalidator(*this), boost::bind(&MixerSnapshotList::redisplay, this), gui_context());
}
redisplay();
}

View file

@ -883,6 +883,14 @@ RouteTemplateManager::rename_template (TreeModel::iterator& item, const Glib::us
item->set_value (_template_columns.name, string (new_name));
item->set_value (_template_columns.path, new_filepath);
SnapshotList sl = _session->snapshot_manager().get_global_snapshots();
for(SnapshotList::const_iterator it = sl.begin(); it != sl.end(); it++) {
if(old_name == (*it)->get_label()) {
_session->snapshot_manager().rename_snapshot((*it), new_name);
break;
}
}
}
void

View file

@ -62,6 +62,7 @@ public:
PBD::Signal1<void, ARDOUR::MixerSnapshot*> PromotedSnapshot;
PBD::Signal1<void, ARDOUR::MixerSnapshot*> CreatedSnapshot;
PBD::Signal0<void> RemovedSnapshot;
PBD::Signal0<void> RenamedSnapshot;
private:
void ensure_snapshot_dir(bool global);
std::string _global_path;

View file

@ -151,6 +151,7 @@ bool MixerSnapshotManager::rename_snapshot(MixerSnapshot* snapshot, const string
const string new_path = Glib::build_filename(dir, snapshot->get_label() + string(template_suffix));
::g_rename(old_path.c_str(), new_path.c_str());
snapshot->set_path(new_path);
RenamedSnapshot(); /* EMIT SIGNAL */
return true;
}