Use factory to create LADSPA control widgets

Replace the class `LadspaMatrixControlView` with the factory class
`LadspaWidgetFactory`. The former was a widget that wrapped the widget
representation of a LADSPA control in yet another widget with a layout.
The factory simply returns the configured widget so that it can be
incorporated directly in layouts or other widgets.

Adjust `LadspaMatrixControlDialog` so that it uses the
`LadspaWidgetFactory` instead of the `LadspaMatrixControlView`.
This commit is contained in:
Michael Gregorius
2023-07-08 13:15:16 +02:00
parent 610fb3442f
commit 816f3f5870
6 changed files with 145 additions and 157 deletions

View File

@@ -36,7 +36,7 @@
#include "LadspaControl.h"
#include "LadspaEffect.h"
#include "LadspaMatrixControlDialog.h"
#include "LadspaMatrixControlView.h"
#include "LadspaWidgetFactory.h"
#include "LadspaControlView.h"
#include "LedCheckBox.h"
@@ -152,8 +152,11 @@ void LadspaMatrixControlDialog::arrangeControls(QWidget * parent, QGridLayout* g
}
// TODO Use a factory to directly create the widgets? Currently they are wrapped in another layout in LadspaMatrixControlView...
LadspaMatrixControlView *ladspaMatrixControlView = new LadspaMatrixControlView(parent, ladspaControl);
gridLayout->addWidget(ladspaMatrixControlView, currentRow, currentChannelColumn);
QWidget * controlWidget = LadspaWidgetFactory::createWidget(ladspaControl, this);
if (controlWidget)
{
gridLayout->addWidget(controlWidget, currentRow, currentChannelColumn);
}
// Record the maximum row so that we add a vertical spacer after that row
maxRow = std::max(maxRow, currentRow);