Skip to content

Commit

Permalink
Reintroduce plugin search for specific formats
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Nov 3, 2024
1 parent e312817 commit b212a55
Show file tree
Hide file tree
Showing 3 changed files with 266 additions and 50 deletions.
128 changes: 83 additions & 45 deletions source/frontend/pluginlist/pluginlistdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand All @@ -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(),
Expand Down
36 changes: 34 additions & 2 deletions source/frontend/pluginlist/pluginrefreshdialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -27,6 +30,9 @@ struct PluginRefreshDialog : QDialog, Ui_PluginRefreshDialog {
b_skip->setEnabled(false);
ch_invalid->setEnabled(false);

if (_firstInit)
return;

// ------------------------------------------------------------------------------------------------------------
// Load settings

Expand All @@ -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));
}

// ------------------------------------------------------------------------------------------------------------
Expand All @@ -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());
}
};

Expand Down
Loading

0 comments on commit b212a55

Please sign in to comment.