Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
abique committed Apr 23, 2024
2 parents 6650b96 + ff98954 commit f94df83
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
2 changes: 1 addition & 1 deletion clap
Submodule clap updated 0 files
33 changes: 28 additions & 5 deletions host/main-window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void MainWindow::createMenu() {

QMenu *fileMenu = menuBar->addMenu(tr("File"));
// TODO: fileMenu->addAction(tr("Load plugin"));
connect(fileMenu->addAction(tr("Load Native Plugin Preset")),

_loadPluginPresetAction = fileMenu->addAction(tr("Load Native Plugin Preset"));
connect(_loadPluginPresetAction,
&QAction::triggered,
this,
&MainWindow::loadNativePluginPreset);
Expand All @@ -62,11 +64,15 @@ void MainWindow::createMenu() {
&Application::quit);

auto windowsMenu = menuBar->addMenu("Windows");
connect(windowsMenu->addAction(tr("Show Parameters")),

_showPluginParametersAction = windowsMenu->addAction(tr("Show Parameters"));
connect(_showPluginParametersAction,
&QAction::triggered,
this,
&MainWindow::showPluginParametersWindow);
connect(windowsMenu->addAction(tr("Show Quick Controls")),

_showPluginQuickControlsAction = windowsMenu->addAction(tr("Show Quick Controls"));
connect(_showPluginQuickControlsAction,
&QAction::triggered,
this,
&MainWindow::showPluginQuickControlsWindow);
Expand All @@ -76,18 +82,35 @@ void MainWindow::createMenu() {
dialog.exec();
});
menuBar->addSeparator();
connect(windowsMenu->addAction(tr("Toggle Plugin Window Visibility")),

_togglePluginWindowVisibilityAction = windowsMenu->addAction(tr("Toggle Plugin Window Visibility"));
connect(_togglePluginWindowVisibilityAction,
&QAction::triggered,
this,
&MainWindow::togglePluginWindowVisibility);
connect(windowsMenu->addAction(tr("Recreate Plugin Window")),

_recreatePluginWindowAction = windowsMenu->addAction(tr("Recreate Plugin Window"));
connect(_recreatePluginWindowAction,
&QAction::triggered,
this,
&MainWindow::recreatePluginWindow);

QMenu *helpMenu = menuBar->addMenu(tr("Help"));
connect(
helpMenu->addAction(tr("About")), &QAction::triggered, this, &MainWindow::showAboutDialog);

updatePluginMenuItems();

assert(_application.engine());
connect(&_application.engine()->pluginHost(), &PluginHost::pluginLoadedChanged, this, &MainWindow::updatePluginMenuItems);
}

void MainWindow::updatePluginMenuItems(bool const pluginLoaded /* = false */ ) {
_loadPluginPresetAction->setEnabled(pluginLoaded);
_showPluginParametersAction->setEnabled(pluginLoaded);
_showPluginQuickControlsAction->setEnabled(pluginLoaded);
_togglePluginWindowVisibilityAction->setEnabled(pluginLoaded);
_recreatePluginWindowAction->setEnabled(pluginLoaded);
}

void MainWindow::showSettingsDialog() {
Expand Down
7 changes: 7 additions & 0 deletions host/main-window.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ private:
void togglePluginWindowVisibility();
void recreatePluginWindow();
void showAboutDialog();
void updatePluginMenuItems(bool pluginLoaded = false);

Application &_application;
QWindow *_pluginViewWindow = nullptr;
QWidget *_pluginViewWidget = nullptr;

QAction *_loadPluginPresetAction = nullptr;
QAction *_showPluginParametersAction = nullptr;
QAction *_showPluginQuickControlsAction = nullptr;
QAction *_togglePluginWindowVisibilityAction = nullptr;
QAction *_recreatePluginWindowAction = nullptr;

PluginParametersWidget *_pluginParametersWidget = nullptr;
PluginQuickControlsWidget *_pluginRemoteControlsWidget = nullptr;
};
5 changes: 5 additions & 0 deletions host/plugin-host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,17 @@ bool PluginHost::load(const QString &path, int pluginIndex) {

scanParams();
scanQuickControls();

pluginLoadedChanged(true);

return true;
}

void PluginHost::unload() {
checkForMainThread();

pluginLoadedChanged(false);

if (!_library.isLoaded())
return;

Expand Down
1 change: 1 addition & 0 deletions host/plugin-host.hh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ signals:
void quickControlsPagesChanged();
void quickControlsSelectedPageChanged();
void paramAdjusted(clap_id paramId);
void pluginLoadedChanged(bool pluginLoaded);

protected:
/////////////////////////
Expand Down

0 comments on commit f94df83

Please sign in to comment.