From b212a55a018faa4353fff5114729c809b4e4631b Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 3 Nov 2024 10:19:32 +0100 Subject: [PATCH] Reintroduce plugin search for specific formats Signed-off-by: falkTX --- .../frontend/pluginlist/pluginlistdialog.cpp | 128 +++++++++------ .../pluginlist/pluginrefreshdialog.hpp | 36 ++++- .../pluginlist/pluginrefreshdialog.ui | 152 +++++++++++++++++- 3 files changed, 266 insertions(+), 50 deletions(-) diff --git a/source/frontend/pluginlist/pluginlistdialog.cpp b/source/frontend/pluginlist/pluginlistdialog.cpp index 3d5a20ac9..3847699d8 100644 --- a/source/frontend/pluginlist/pluginlistdialog.cpp +++ b/source/frontend/pluginlist/pluginlistdialog.cpp @@ -1178,7 +1178,9 @@ void PluginListDialog::showEvent(QShowEvent* const event) p->discovery.dialog->ch_updated->setChecked(true); p->discovery.dialog->ch_invalid->setChecked(false); p->discovery.dialog->group->setEnabled(false); + p->discovery.dialog->group_formats->hide(); p->discovery.dialog->progressBar->setFormat("Starting initial discovery..."); + p->discovery.dialog->adjustSize(); QObject::connect(p->discovery.dialog->b_skip, &QPushButton::clicked, this, &PluginListDialog::refreshPluginsSkip); @@ -1221,73 +1223,109 @@ void PluginListDialog::timerEvent(QTimerEvent* const event) } [[fallthrough]]; case PLUGIN_INTERNAL: - ui.label->setText(tr("Discovering LADSPA plugins...")); - path = p->paths.ladspa; - p->discovery.ptype = PLUGIN_LADSPA; - break; + if (p->discovery.dialog->ch_ladspa->isChecked() || !p->discovery.dialog->group_formats->isVisible()) + { + ui.label->setText(tr("Discovering LADSPA plugins...")); + path = p->paths.ladspa; + p->discovery.ptype = PLUGIN_LADSPA; + break; + } + [[fallthrough]]; case PLUGIN_LADSPA: - ui.label->setText(tr("Discovering DSSI plugins...")); - path = p->paths.dssi; - p->discovery.ptype = PLUGIN_DSSI; - break; + if (p->discovery.dialog->ch_dssi->isChecked() || !p->discovery.dialog->group_formats->isVisible()) + { + ui.label->setText(tr("Discovering DSSI plugins...")); + path = p->paths.dssi; + p->discovery.ptype = PLUGIN_DSSI; + break; + } + [[fallthrough]]; case PLUGIN_DSSI: #endif - if (p->discovery.btype == BINARY_NATIVE && p->paths.lv2.isNotEmpty()) + if (p->discovery.dialog->ch_lv2->isChecked() || !p->discovery.dialog->group_formats->isVisible()) { - ui.label->setText(tr("Discovering LV2 plugins...")); - path = p->paths.lv2; - p->discovery.ptype = PLUGIN_LV2; - break; + if (p->discovery.btype == BINARY_NATIVE && p->paths.lv2.isNotEmpty()) + { + ui.label->setText(tr("Discovering LV2 plugins...")); + path = p->paths.lv2; + p->discovery.ptype = PLUGIN_LV2; + break; + } } [[fallthrough]]; case PLUGIN_LV2: - ui.label->setText(tr("Discovering VST2 plugins...")); - path = p->paths.vst2; - p->discovery.ptype = PLUGIN_VST2; - break; + if (p->discovery.dialog->ch_vst2->isChecked() || !p->discovery.dialog->group_formats->isVisible()) + { + ui.label->setText(tr("Discovering VST2 plugins...")); + path = p->paths.vst2; + p->discovery.ptype = PLUGIN_VST2; + break; + } + [[fallthrough]]; case PLUGIN_VST2: - ui.label->setText(tr("Discovering VST3 plugins...")); - path = p->paths.vst3; - p->discovery.ptype = PLUGIN_VST3; - break; + if (p->discovery.dialog->ch_vst3->isChecked() || !p->discovery.dialog->group_formats->isVisible()) + { + ui.label->setText(tr("Discovering VST3 plugins...")); + path = p->paths.vst3; + p->discovery.ptype = PLUGIN_VST3; + break; + } + [[fallthrough]]; case PLUGIN_VST3: - ui.label->setText(tr("Discovering CLAP plugins...")); - path = p->paths.clap; - p->discovery.ptype = PLUGIN_CLAP; - break; + if (p->discovery.dialog->ch_clap->isChecked() || !p->discovery.dialog->group_formats->isVisible()) + { + ui.label->setText(tr("Discovering CLAP plugins...")); + path = p->paths.clap; + p->discovery.ptype = PLUGIN_CLAP; + break; + } + [[fallthrough]]; case PLUGIN_CLAP: #ifdef CARLA_OS_MAC - ui.label->setText(tr("Discovering AU plugins...")); - path = p->paths.au; - p->discovery.ptype = PLUGIN_AU; - break; + if (p->discovery.dialog->ch_au->isChecked() || !p->discovery.dialog->group_formats->isVisible()) + { + ui.label->setText(tr("Discovering AU plugins...")); + path = p->paths.au; + p->discovery.ptype = PLUGIN_AU; + break; + } + [[fallthrough]]; case PLUGIN_AU: #endif #ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS - if (p->discovery.btype == BINARY_NATIVE && p->paths.jsfx.isNotEmpty()) + if (p->discovery.dialog->ch_jsfx->isChecked() || !p->discovery.dialog->group_formats->isVisible()) { - ui.label->setText(tr("Discovering JSFX plugins...")); - path = p->paths.jsfx; - p->discovery.ptype = PLUGIN_JSFX; - break; + if (p->discovery.btype == BINARY_NATIVE && p->paths.jsfx.isNotEmpty()) + { + ui.label->setText(tr("Discovering JSFX plugins...")); + path = p->paths.jsfx; + p->discovery.ptype = PLUGIN_JSFX; + break; + } } [[fallthrough]]; case PLUGIN_JSFX: - if (p->discovery.btype == BINARY_NATIVE && p->paths.sf2.isNotEmpty()) + if (p->discovery.dialog->ch_sf2->isChecked() || !p->discovery.dialog->group_formats->isVisible()) { - ui.label->setText(tr("Discovering SF2 kits...")); - path = p->paths.sf2; - p->discovery.ptype = PLUGIN_SF2; - break; + if (p->discovery.btype == BINARY_NATIVE && p->paths.sf2.isNotEmpty()) + { + ui.label->setText(tr("Discovering SF2 kits...")); + path = p->paths.sf2; + p->discovery.ptype = PLUGIN_SF2; + break; + } } [[fallthrough]]; case PLUGIN_SF2: - if (p->discovery.btype == BINARY_NATIVE && p->paths.sfz.isNotEmpty()) + if (p->discovery.dialog->ch_sfz->isChecked() || !p->discovery.dialog->group_formats->isVisible()) { - ui.label->setText(tr("Discovering SFZ kits...")); - path = p->paths.sfz; - p->discovery.ptype = PLUGIN_SFZ; - break; + if (p->discovery.btype == BINARY_NATIVE && p->paths.sfz.isNotEmpty()) + { + ui.label->setText(tr("Discovering SFZ kits...")); + path = p->paths.sfz; + p->discovery.ptype = PLUGIN_SFZ; + break; + } } [[fallthrough]]; case PLUGIN_SFZ: @@ -1306,7 +1344,7 @@ void PluginListDialog::timerEvent(QTimerEvent* const event) if (p->timerId == 0) break; - if (p->discovery.dialog) + if (p->discovery.dialog != nullptr) p->discovery.dialog->progressBar->setFormat(ui.label->text()); p->discovery.handle = carla_plugin_discovery_start(p->discovery.tool.toUtf8().constData(), diff --git a/source/frontend/pluginlist/pluginrefreshdialog.hpp b/source/frontend/pluginlist/pluginrefreshdialog.hpp index ce7c34baf..5a637d4b9 100644 --- a/source/frontend/pluginlist/pluginrefreshdialog.hpp +++ b/source/frontend/pluginlist/pluginrefreshdialog.hpp @@ -14,8 +14,11 @@ // Plugin Refresh Dialog struct PluginRefreshDialog : QDialog, Ui_PluginRefreshDialog { - explicit PluginRefreshDialog(QWidget* const parent) - : QDialog(parent) + const bool _firstInit; + + explicit PluginRefreshDialog(QWidget* const parent, bool firstInit = false) + : QDialog(parent), + _firstInit(firstInit) { setupUi(this); @@ -27,6 +30,9 @@ struct PluginRefreshDialog : QDialog, Ui_PluginRefreshDialog { b_skip->setEnabled(false); ch_invalid->setEnabled(false); + if (_firstInit) + return; + // ------------------------------------------------------------------------------------------------------------ // Load settings @@ -41,6 +47,18 @@ struct PluginRefreshDialog : QDialog, Ui_PluginRefreshDialog { ch_updated->setChecked(true); ch_invalid->setChecked(settings.valueBool("PluginRefreshDialog/CheckInvalid", false)); + + group_formats->setChecked(settings.valueBool("PluginRefreshDialog/RestrictFormats", false)); + ch_ladspa->setChecked(settings.valueBool("PluginRefreshDialog/SearchLADSPA", true)); + ch_dssi->setChecked(settings.valueBool("PluginRefreshDialog/SearchDSSI", true)); + ch_lv2->setChecked(settings.valueBool("PluginRefreshDialog/SearchLV2", true)); + ch_vst2->setChecked(settings.valueBool("PluginRefreshDialog/SearchVST2", true)); + ch_vst3->setChecked(settings.valueBool("PluginRefreshDialog/SearchVST3", true)); + ch_clap->setChecked(settings.valueBool("PluginRefreshDialog/SearchCLAP", true)); + ch_au->setChecked(settings.valueBool("PluginRefreshDialog/SearchAU", true)); + ch_jsfx->setChecked(settings.valueBool("PluginRefreshDialog/SearchJSFX", true)); + ch_sf2->setChecked(settings.valueBool("PluginRefreshDialog/SearchSF2", true)); + ch_sfz->setChecked(settings.valueBool("PluginRefreshDialog/SearchSFZ", true)); } // ------------------------------------------------------------------------------------------------------------ @@ -55,10 +73,24 @@ struct PluginRefreshDialog : QDialog, Ui_PluginRefreshDialog { private Q_SLOTS: void saveSettings() { + if (_firstInit) + return; + QSafeSettings settings; settings.setValue("PluginRefreshDialog/Geometry", saveGeometry()); settings.setValue("PluginRefreshDialog/RefreshAll", ch_all->isChecked()); settings.setValue("PluginRefreshDialog/CheckInvalid", ch_invalid->isChecked()); + settings.setValue("PluginRefreshDialog/RestrictFormats", group_formats->isChecked()); + settings.setValue("PluginRefreshDialog/SearchLADSPA", ch_ladspa->isChecked()); + settings.setValue("PluginRefreshDialog/SearchDSSI", ch_dssi->isChecked()); + settings.setValue("PluginRefreshDialog/SearchLV2", ch_lv2->isChecked()); + settings.setValue("PluginRefreshDialog/SearchVST2", ch_vst2->isChecked()); + settings.setValue("PluginRefreshDialog/SearchVST3", ch_vst3->isChecked()); + settings.setValue("PluginRefreshDialog/SearchCLAP", ch_clap->isChecked()); + settings.setValue("PluginRefreshDialog/SearchAU", ch_au->isChecked()); + settings.setValue("PluginRefreshDialog/SearchJSFX", ch_jsfx->isChecked()); + settings.setValue("PluginRefreshDialog/SearchSF2", ch_sf2->isChecked()); + settings.setValue("PluginRefreshDialog/SearchSFZ", ch_sfz->isChecked()); } }; diff --git a/source/frontend/pluginlist/pluginrefreshdialog.ui b/source/frontend/pluginlist/pluginrefreshdialog.ui index b25da3c7d..a2c299f3c 100644 --- a/source/frontend/pluginlist/pluginrefreshdialog.ui +++ b/source/frontend/pluginlist/pluginrefreshdialog.ui @@ -6,14 +6,14 @@ 0 0 - 873 - 179 + 375 + 430 Plugin Refresh - + @@ -100,6 +100,152 @@ + + + + Restrict search formats + + + Qt::AlignCenter + + + true + + + + + + JSFX + + + + + + + AU + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 120 + 1 + + + + + + + + SF2/3 + + + + + + + DSSI + + + + + + + CLAP + + + + + + + LV2 + + + + + + + VST3 + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 120 + 1 + + + + + + + + LADSPA + + + + + + + SFZ + + + + + + + VST2 + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 120 + 1 + + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + +