Reformat a bit
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
* 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
|
||||
@@ -43,12 +43,12 @@ class LMMS_EXPORT LadspaMatrixControlView : public QWidget, public ModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LadspaMatrixControlView( QWidget * parent, LadspaControl * ladspaControl );
|
||||
LadspaMatrixControlView(QWidget* parent, LadspaControl* ladspaControl);
|
||||
|
||||
private:
|
||||
LadspaControl * m_ladspaControl;
|
||||
LadspaControl* m_ladspaControl;
|
||||
|
||||
} ;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
||||
|
||||
@@ -50,36 +50,36 @@ static int const s_channelBaseColumn = 4;
|
||||
|
||||
|
||||
|
||||
LadspaMatrixControlDialog::LadspaMatrixControlDialog( LadspaControls * ladspaControls ) :
|
||||
EffectControlDialog( ladspaControls ),
|
||||
m_effectGridLayout( NULL ),
|
||||
m_stereoLink( NULL )
|
||||
LadspaMatrixControlDialog::LadspaMatrixControlDialog(LadspaControls * ladspaControls) :
|
||||
EffectControlDialog(ladspaControls),
|
||||
m_effectGridLayout(NULL),
|
||||
m_stereoLink(NULL)
|
||||
{
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout( this );
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout(this);
|
||||
|
||||
m_effectGridLayout = new QGridLayout();
|
||||
mainLayout->addLayout(m_effectGridLayout);
|
||||
|
||||
updateEffectView( ladspaControls );
|
||||
updateEffectView(ladspaControls);
|
||||
|
||||
if( ladspaControls->m_processors > 1 )
|
||||
if (ladspaControls->m_processors > 1)
|
||||
{
|
||||
mainLayout->addSpacing( 3 );
|
||||
mainLayout->addSpacing(3);
|
||||
QHBoxLayout * center = new QHBoxLayout();
|
||||
mainLayout->addLayout( center );
|
||||
m_stereoLink = new LedCheckBox( tr( "Link Channels" ), this );
|
||||
m_stereoLink->setModel( &ladspaControls->m_stereoLinkModel );
|
||||
center->addWidget( m_stereoLink );
|
||||
mainLayout->addLayout(center);
|
||||
m_stereoLink = new LedCheckBox(tr("Link Channels"), this);
|
||||
m_stereoLink->setModel(&ladspaControls->m_stereoLinkModel);
|
||||
center->addWidget(m_stereoLink);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void LadspaMatrixControlDialog::updateEffectView( LadspaControls * ladspaControls )
|
||||
void LadspaMatrixControlDialog::updateEffectView(LadspaControls * ladspaControls)
|
||||
{
|
||||
QList<QWidget *> list = findChildren<QWidget *>();
|
||||
for( QList<QWidget *>::iterator it = list.begin(); it != list.end(); ++it )
|
||||
for (QList<QWidget *>::iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
@@ -90,71 +90,71 @@ void LadspaMatrixControlDialog::updateEffectView( LadspaControls * ladspaControl
|
||||
QGridLayout *gridLayout = new QGridLayout(widget);
|
||||
widget->setLayout(gridLayout);
|
||||
|
||||
gridLayout->addWidget( new QLabel( "<b>" + tr( "Parameter" ) + "</b>", widget ), 0, s_parameterNameBaseColumn, Qt::AlignRight );
|
||||
gridLayout->addWidget(new QLabel("<b>" + tr("Parameter") + "</b>", widget), 0, s_parameterNameBaseColumn, Qt::AlignRight);
|
||||
|
||||
bool linkLabelAdded = false;
|
||||
ch_cnt_t const numberOfChannels = ladspaControls->m_processors;
|
||||
|
||||
gridLayout->setColumnMinimumWidth(1, 20);
|
||||
|
||||
for ( ch_cnt_t i = 0; i < numberOfChannels; ++i )
|
||||
for (ch_cnt_t i = 0; i < numberOfChannels; ++i)
|
||||
{
|
||||
QString channelString( tr( "Channel %1" ) );
|
||||
QString channelString(tr("Channel %1"));
|
||||
int currentChannelColumn = s_channelBaseColumn + 2*i;
|
||||
|
||||
gridLayout->addWidget( new QLabel( "<b>" + channelString.arg( QString::number( i + 1 ) ) + "</b>", widget ), 0, currentChannelColumn, Qt::AlignHCenter );
|
||||
gridLayout->addWidget(new QLabel("<b>" + channelString.arg(QString::number(i + 1)) + "</b>", widget), 0, currentChannelColumn, Qt::AlignHCenter);
|
||||
|
||||
control_list_t & controls = ladspaControls->m_controls[i];
|
||||
|
||||
int currentRow = 1;
|
||||
control_list_t::iterator end = controls.end();
|
||||
for( control_list_t::iterator it = controls.begin(); it != end; ++it )
|
||||
for (control_list_t::iterator it = controls.begin(); it != end; ++it)
|
||||
{
|
||||
LadspaControl * ladspaControl = *it;
|
||||
|
||||
if ( i == 0 )
|
||||
if (i == 0)
|
||||
{
|
||||
// TODO Assumes that all processors are equal! Change to more general approach, e.g. map from name to row
|
||||
|
||||
// Link
|
||||
if ( ladspaControl->m_link )
|
||||
if (ladspaControl->m_link)
|
||||
{
|
||||
if ( !linkLabelAdded )
|
||||
if (!linkLabelAdded)
|
||||
{
|
||||
gridLayout->addWidget( new QLabel( "<b>" + tr( "Link" ) + "</b>", widget ), 0, s_linkBaseColumn, Qt::AlignHCenter );
|
||||
gridLayout->addWidget(new QLabel("<b>" + tr("Link") + "</b>", widget), 0, s_linkBaseColumn, Qt::AlignHCenter);
|
||||
linkLabelAdded = true;
|
||||
}
|
||||
LedCheckBox * linkCheckBox = new LedCheckBox( "", widget );
|
||||
linkCheckBox->setModel( &ladspaControl->m_linkEnabledModel );
|
||||
linkCheckBox->setToolTip( tr( "Link channels" ) );
|
||||
gridLayout->addWidget( linkCheckBox, currentRow, s_linkBaseColumn, Qt::AlignHCenter );
|
||||
LedCheckBox * linkCheckBox = new LedCheckBox("", widget);
|
||||
linkCheckBox->setModel(&ladspaControl->m_linkEnabledModel);
|
||||
linkCheckBox->setToolTip(tr("Link channels"));
|
||||
gridLayout->addWidget(linkCheckBox, currentRow, s_linkBaseColumn, Qt::AlignHCenter);
|
||||
}
|
||||
|
||||
// Parameter name
|
||||
QString portName = ladspaControl->port()->name;
|
||||
QLabel *portNameLabel = new QLabel( portName, widget );
|
||||
gridLayout->addWidget( portNameLabel, currentRow, s_parameterNameBaseColumn, Qt::AlignRight );
|
||||
QLabel *portNameLabel = new QLabel(portName, widget);
|
||||
gridLayout->addWidget(portNameLabel, currentRow, s_parameterNameBaseColumn, Qt::AlignRight);
|
||||
}
|
||||
|
||||
LadspaMatrixControlView *ladspaMatrixControlView = new LadspaMatrixControlView( widget, ladspaControl );
|
||||
gridLayout->addWidget( ladspaMatrixControlView, currentRow, currentChannelColumn, Qt::AlignHCenter );
|
||||
LadspaMatrixControlView *ladspaMatrixControlView = new LadspaMatrixControlView(widget, ladspaControl);
|
||||
gridLayout->addWidget(ladspaMatrixControlView, currentRow, currentChannelColumn, Qt::AlignHCenter);
|
||||
gridLayout->setColumnMinimumWidth(currentChannelColumn - 1, 20);
|
||||
|
||||
++currentRow;
|
||||
}
|
||||
}
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea( this );
|
||||
scrollArea->setWidgetResizable( true );
|
||||
scrollArea->setWidget( widget );
|
||||
scrollArea->setFrameShape( QFrame::NoFrame );
|
||||
QScrollArea *scrollArea = new QScrollArea(this);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setWidget(widget);
|
||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
m_effectGridLayout->addWidget( scrollArea, 0, 0 );
|
||||
m_effectGridLayout->addWidget(scrollArea, 0, 0);
|
||||
m_effectGridLayout->setMargin(0);
|
||||
|
||||
if( numberOfChannels > 1 && m_stereoLink != NULL )
|
||||
if (numberOfChannels > 1 && m_stereoLink != NULL)
|
||||
{
|
||||
m_stereoLink->setModel( &ladspaControls->m_stereoLinkModel );
|
||||
m_stereoLink->setModel(&ladspaControls->m_stereoLinkModel);
|
||||
}
|
||||
|
||||
connect(ladspaControls, &LadspaControls::effectModelChanged,
|
||||
|
||||
@@ -46,19 +46,19 @@ class LadspaMatrixControlDialog : public EffectControlDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LadspaMatrixControlDialog( LadspaControls * _ctl );
|
||||
LadspaMatrixControlDialog(LadspaControls* ctl);
|
||||
|
||||
bool isResizable() const override { return true; }
|
||||
|
||||
private slots:
|
||||
void updateEffectView( LadspaControls * _ctl );
|
||||
void updateEffectView(LadspaControls* ctl);
|
||||
|
||||
|
||||
private:
|
||||
QGridLayout * m_effectGridLayout;
|
||||
LedCheckBox * m_stereoLink;
|
||||
QGridLayout* m_effectGridLayout;
|
||||
LedCheckBox* m_stereoLink;
|
||||
|
||||
} ;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
||||
|
||||
@@ -38,51 +38,51 @@
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
LadspaMatrixControlView::LadspaMatrixControlView( QWidget * parent,
|
||||
LadspaControl * ladspaControl ) :
|
||||
QWidget( parent ),
|
||||
ModelView( ladspaControl, this ),
|
||||
m_ladspaControl( ladspaControl )
|
||||
LadspaMatrixControlView::LadspaMatrixControlView(QWidget * parent,
|
||||
LadspaControl * ladspaControl) :
|
||||
QWidget(parent),
|
||||
ModelView(ladspaControl, this),
|
||||
m_ladspaControl(ladspaControl)
|
||||
{
|
||||
QHBoxLayout * layout = new QHBoxLayout( this );
|
||||
layout->setMargin( 0 );
|
||||
layout->setSpacing( 0 );
|
||||
QHBoxLayout * layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
Knob * knob = NULL;
|
||||
|
||||
buffer_data_t dataType = m_ladspaControl->port()->data_type;
|
||||
switch( dataType )
|
||||
switch (dataType)
|
||||
{
|
||||
case TOGGLED:
|
||||
{
|
||||
LedCheckBox * toggle = new LedCheckBox(
|
||||
"", this, QString(), LedCheckBox::Green );
|
||||
toggle->setModel( m_ladspaControl->toggledModel() );
|
||||
layout->addWidget( toggle );
|
||||
setFixedSize( toggle->width(), toggle->height() );
|
||||
"", this, QString(), LedCheckBox::Green);
|
||||
toggle->setModel(m_ladspaControl->toggledModel());
|
||||
layout->addWidget(toggle);
|
||||
setFixedSize(toggle->width(), toggle->height());
|
||||
break;
|
||||
}
|
||||
|
||||
case INTEGER:
|
||||
case FLOATING:
|
||||
knob = new Knob( knobBright_26, this, m_ladspaControl->port()->name );
|
||||
knob->setModel( m_ladspaControl->knobModel() );
|
||||
knob = new Knob(knobBright_26, this, m_ladspaControl->port()->name);
|
||||
knob->setModel(m_ladspaControl->knobModel());
|
||||
break;
|
||||
|
||||
case TIME:
|
||||
knob = new TempoSyncKnob( knobBright_26, this, m_ladspaControl->port()->name );
|
||||
knob->setModel( m_ladspaControl->tempoSyncKnobModel() );
|
||||
knob = new TempoSyncKnob(knobBright_26, this, m_ladspaControl->port()->name);
|
||||
knob->setModel(m_ladspaControl->tempoSyncKnobModel());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( knob != NULL )
|
||||
if (knob != NULL)
|
||||
{
|
||||
knob->setHintText( tr( "Value:" ), "" );
|
||||
layout->addWidget( knob );
|
||||
setFixedSize( knob->width(), knob->height() );
|
||||
knob->setHintText(tr("Value:"), "");
|
||||
layout->addWidget(knob);
|
||||
setFixedSize(knob->width(), knob->height());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user