13
0

Add preference to hide LADSPA plugin if LV2 exists

This commit is contained in:
Robin Gareus 2019-05-25 01:56:23 +02:00
parent a18c54ce94
commit c97884d257
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 33 additions and 3 deletions

View File

@ -73,7 +73,8 @@ public:
enum PluginStatusType {
Normal = 0,
Favorite,
Hidden
Hidden,
Concealed
};
std::string user_plugin_metadata_dir () const;

View File

@ -239,6 +239,7 @@ CONFIG_VARIABLE (bool, use_lxvst, "use-lxvst", true)
CONFIG_VARIABLE (bool, use_macvst, "use-macvst", true)
CONFIG_VARIABLE (bool, discover_vst_on_start, "discover-vst-on-start", false)
CONFIG_VARIABLE (bool, verbose_plugin_scan, "verbose-plugin-scan", false)
CONFIG_VARIABLE (bool, conceal_lv1_if_lv2_exists, "conceal-lv1-if-lv2-exists", true)
CONFIG_VARIABLE (int, vst_scan_timeout, "vst-scan-timeout", 1200) /* deciseconds, per plugin, <= 0 no timeout */
CONFIG_VARIABLE (bool, discover_audio_units, "discover-audio-units", false)
CONFIG_VARIABLE (bool, ask_replace_instrument, "ask-replace-instrument", true)

View File

@ -277,6 +277,27 @@ PluginManager::refresh (bool cache_only)
#ifdef LV2_SUPPORT
BootMessage (_("Scanning LV2 Plugins"));
lv2_refresh ();
if (Config->get_conceal_lv1_if_lv2_exists()) {
for (PluginInfoList::const_iterator i = _ladspa_plugin_info->begin(); i != _ladspa_plugin_info->end(); ++i) {
for (PluginInfoList::const_iterator j = _lv2_plugin_info->begin(); j != _lv2_plugin_info->end(); ++j) {
if ((*i)->creator == (*j)->creator && (*i)->name == (*j)->name) {
PluginStatus ps (LADSPA, (*i)->unique_id, Concealed);
if (find (statuses.begin(), statuses.end(), ps) == statuses.end()) {
statuses.erase (ps);
statuses.insert (ps);
}
}
}
}
} else {
for (PluginStatusList::iterator i = statuses.begin(); i != statuses.end();) {
PluginStatusList::iterator j = i++;
if ((*j).status == Concealed) {
statuses.erase (j);
}
}
}
#endif
#ifdef WINDOWS_VST_SUPPORT
if (Config->get_use_windows_vst()) {
@ -1293,6 +1314,9 @@ PluginManager::save_statuses ()
stringstream ofs;
for (PluginStatusList::iterator i = statuses.begin(); i != statuses.end(); ++i) {
if ((*i).status == Concealed) {
continue;
}
switch ((*i).type) {
case LADSPA:
ofs << "LADSPA";
@ -1329,6 +1353,10 @@ PluginManager::save_statuses ()
case Hidden:
ofs << "Hidden";
break;
case Concealed:
ofs << "Hidden";
assert (0);
break;
}
ofs << ' ';
@ -1422,7 +1450,7 @@ PluginManager::set_status (PluginType t, string id, PluginStatusType status)
PluginStatus ps (t, id, status);
statuses.erase (ps);
if (status != Normal) {
if (status != Normal && status != Concealed) {
statuses.insert (ps);
}
@ -1683,7 +1711,7 @@ PluginManager::get_all_tags (TagFilter tag_filter) const
if (tag_filter == NoHidden) {
PluginStatus stat ((*pt).type, (*pt).unique_id);
PluginStatusList::const_iterator i = find (statuses.begin(), statuses.end(), stat);
if ((i != statuses.end()) && (i->status == Hidden)) {
if ((i != statuses.end()) && ((i->status == Hidden) || (i->status == Concealed))) {
continue;
}
}