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

@@ -1,57 +0,0 @@
/*
* LadspaMatrixControlView.h - widget for controlling a LADSPA port
*
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2015 Michael Gregorius <michaelgregorius/at/web[dot]de>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LADSPA_MATRIX_CONTROL_VIEW_H
#define LADSPA_MATRIX_CONTROL_VIEW_H
#include <QWidget>
#include "ModelView.h"
namespace lmms
{
class LadspaControl;
namespace gui
{
class LMMS_EXPORT LadspaMatrixControlView : public QWidget, public ModelView
{
Q_OBJECT
public:
LadspaMatrixControlView(QWidget* parent, LadspaControl* ladspaControl);
private:
LadspaControl* m_ladspaControl;
};
} // namespace gui
} // namespace lmms
#endif

View File

@@ -0,0 +1,49 @@
/*
* LadspaWidgetFactory.h - Factory that creates widgets for LADSPA ports
*
* Copyright (c) 2023 Michael Gregorius
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LMMS_GUI_LADSPA_WIDGET_FACTORY_H
#define LMMS_GUI_LADSPA_WIDGET_FACTORY_H
class QWidget;
namespace lmms
{
class LadspaControl;
namespace gui
{
class LadspaWidgetFactory
{
public:
static QWidget * createWidget(LadspaControl * ladspaControl, QWidget * parent);
};
} // namespace gui
} // namespace lmms
#endif // LMMS_GUI_LADSPA_WIDGET_FACTORY_H