Add API to check for plugin-presets with description

This commit is contained in:
Robin Gareus 2019-10-10 22:31:19 +02:00
parent 95676a5f66
commit 0fa38c0002
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 15 additions and 9 deletions

View File

@ -424,15 +424,7 @@ GenericPluginUI::build ()
}
if (control_uis.empty ()) {
std::vector<Plugin::PresetRecord> presets = insert->plugin()->get_presets();
bool show_preset_browser = false;
for (std::vector<Plugin::PresetRecord>::const_iterator i = presets.begin(); i != presets.end(); ++i) {
if (i->valid && !i->description.empty()) {
show_preset_browser = true;
break;
}
}
if (show_preset_browser) {
if (has_descriptive_presets ()) {
preset_gui = new PluginPresetsUI (insert);
hpacker.pack_start (*preset_gui, true, true);
}

View File

@ -685,6 +685,18 @@ PlugUIBase::reset_plugin_parameters ()
insert->reset_parameters_to_default ();
}
bool
PlugUIBase::has_descriptive_presets () const
{
std::vector<Plugin::PresetRecord> presets = insert->plugin()->get_presets();
for (std::vector<Plugin::PresetRecord>::const_iterator i = presets.begin(); i != presets.end(); ++i) {
if (i->valid && !i->description.empty()) {
return true;
}
}
return false;
}
void
PlugUIBase::manage_pins ()
{

View File

@ -188,6 +188,8 @@ protected:
void preset_added_or_removed ();
void update_preset_modified ();
bool has_descriptive_presets () const;
PBD::ScopedConnection death_connection;
PBD::ScopedConnection active_connection;
PBD::ScopedConnection preset_added_connection;