Add BarModelEditor and improve layouts

Add the new class `BarModelEditor` which is intended to become a new way
to adjust values of float models.

Simplify the layout in `LadspaMatrixControlDialog` by removing some
nested layouts. Remove the "Parameters" column.

Adjust `LadspaMatrixControlView` to implement the following changes:
* Show the name of the control next to toggle buttons (`LedCheckBox`).
* Use the new `BarModelEditor` for integer and float types.
* SHow the name of the control next to time based parameters that use
`TempoSyncKnob`.

The names are shown so that the "Parameters" column can be removed.

Technical details
------------------
The class `LadspaMatrixControlDialog` now creates a widget that contains
the matrix layout with the controls. This widget is then added to a
scroll area. The layout is populated in the new method
`arrangeControls`.

Add some helper methods to `LadspaMatrixControlDialog` which retrieve
the `LadspaControls` instance and the number of channels.

Add the implementation of `BarModelEditor` to `src/gui/CMakeLists.txt`.

TODOs
------
Extract common code out of the `Knob` class so that it can be reused by
`BarModelEditor`.
This commit is contained in:
Michael Gregorius
2023-07-08 12:11:46 +02:00
parent 1295deb3a8
commit 610fb3442f
6 changed files with 327 additions and 66 deletions

57
include/BarModelEditor.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* BarModelEditor.h - edit model values using a bar display
*
* Copyright (c) 2023-now 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.
*
*/
#include "AutomatableModelView.h"
#include <QWidget>
namespace lmms::gui
{
class BarModelEditor : public QWidget, public FloatModelView
{
public:
BarModelEditor(QString text, FloatModel * floatModel, QWidget * parent = nullptr);
// Define how the widget will behave in a layout
QSizePolicy sizePolicy() const;
virtual QSize minimumSizeHint() const override;
virtual QSize sizeHint() const override;
protected:
virtual void paintEvent(QPaintEvent *event) override;
virtual void contextMenuEvent(QContextMenuEvent * me) override;
virtual void mouseDoubleClickEvent(QMouseEvent * me) override;
private:
void connectToModelSignals();
private:
QString const m_text;
};
}