2 * ladspa_description.cpp - LADSPA plugin description
4 * Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
6 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
25 #include "ladspa_description.h"
27 #include <QtGui/QGroupBox>
28 #include <QtGui/QLabel>
29 #include <QtGui/QListWidget>
30 #include <QtGui/QScrollArea>
31 #include <QtGui/QVBoxLayout>
33 #include "AudioDevice.h"
35 #include "ladspa_2_lmms.h"
40 ladspaDescription::ladspaDescription( QWidget
* _parent
,
41 ladspaPluginType _type
) :
44 ladspa2LMMS
* manager
= engine::getLADSPAManager();
46 l_sortable_plugin_t plugins
;
50 plugins
= manager
->getInstruments();
53 plugins
= manager
->getValidEffects();
56 plugins
= manager
->getValidEffects();
59 plugins
= manager
->getInvalidEffects();
62 plugins
= manager
->getAnalysisTools();
65 plugins
= manager
->getOthers();
71 QList
<QString
> pluginNames
;
72 for( l_sortable_plugin_t::iterator it
= plugins
.begin();
73 it
!= plugins
.end(); it
++ )
76 manager
->getDescription( ( *it
).second
)->inputChannels
77 <= engine::getMixer()->audioDev()->channels() )
79 pluginNames
.push_back( ( *it
).first
);
80 m_pluginKeys
.push_back( ( *it
).second
);
84 QGroupBox
* pluginsBox
= new QGroupBox( tr( "Plugins" ), this );
85 QListWidget
* pluginList
= new QListWidget( pluginsBox
);
86 pluginList
->addItems( pluginNames
);
87 connect( pluginList
, SIGNAL( currentRowChanged( int ) ),
88 SLOT( rowChanged( int ) ) );
89 connect( pluginList
, SIGNAL( itemDoubleClicked( QListWidgetItem
* ) ),
90 SLOT( onDoubleClicked( QListWidgetItem
* ) ) );
91 ( new QVBoxLayout( pluginsBox
) )->addWidget( pluginList
);
93 QGroupBox
* descriptionBox
= new QGroupBox( tr( "Description" ), this );
94 QVBoxLayout
* descriptionLayout
= new QVBoxLayout( descriptionBox
);
95 descriptionLayout
->setSpacing( 0 );
96 descriptionLayout
->setMargin( 0 );
98 m_scrollArea
= new QScrollArea( descriptionBox
);
99 descriptionLayout
->addWidget( m_scrollArea
);
101 QVBoxLayout
* layout
= new QVBoxLayout( this );
102 layout
->addWidget( pluginsBox
);
103 layout
->addWidget( descriptionBox
);
105 if( pluginList
->count() > 0 )
107 pluginList
->setCurrentRow( 0 );
108 m_currentSelection
= m_pluginKeys
[0];
109 update( m_currentSelection
);
116 ladspaDescription::~ladspaDescription()
123 void ladspaDescription::update( const ladspa_key_t
& _key
)
125 QWidget
* description
= new QWidget
;
126 m_scrollArea
->setWidget( description
);
128 QVBoxLayout
* layout
= new QVBoxLayout( description
);
129 layout
->setSizeConstraint( QLayout::SetFixedSize
);
131 ladspa2LMMS
* manager
= engine::getLADSPAManager();
133 QLabel
* name
= new QLabel( description
);
134 name
->setText( QWidget::tr( "Name: " ) + manager
->getName( _key
) );
135 layout
->addWidget( name
);
137 QWidget
* maker
= new QWidget( description
);
138 QHBoxLayout
* makerLayout
= new QHBoxLayout( maker
);
139 makerLayout
->setMargin( 0 );
140 makerLayout
->setSpacing( 0 );
141 layout
->addWidget( maker
);
143 QLabel
* maker_label
= new QLabel( maker
);
144 maker_label
->setText( QWidget::tr( "Maker: " ) );
145 maker_label
->setAlignment( Qt::AlignTop
);
146 QLabel
* maker_content
= new QLabel( maker
);
147 maker_content
->setText( manager
->getMaker( _key
) );
148 maker_content
->setWordWrap( true );
149 makerLayout
->addWidget( maker_label
);
150 makerLayout
->addWidget( maker_content
, 1 );
152 QWidget
* copyright
= new QWidget( description
);
153 QHBoxLayout
* copyrightLayout
= new QHBoxLayout( copyright
);
154 copyrightLayout
->setMargin( 0 );
155 copyrightLayout
->setSpacing( 0 );
156 layout
->addWidget( copyright
);
158 QLabel
* copyright_label
= new QLabel( copyright
);
159 copyright_label
->setText( QWidget::tr( "Copyright: " ) );
160 copyright_label
->setAlignment( Qt::AlignTop
);
162 QLabel
* copyright_content
= new QLabel( copyright
);
163 copyright_content
->setText( manager
->getCopyright( _key
) );
164 copyright_content
->setWordWrap( true );
165 copyrightLayout
->addWidget( copyright_label
);
166 copyrightLayout
->addWidget( copyright_content
, 1 );
168 QLabel
* requiresRealTime
= new QLabel( description
);
169 requiresRealTime
->setText( QWidget::tr( "Requires Real Time: " ) +
170 ( manager
->hasRealTimeDependency( _key
) ?
171 QWidget::tr( "Yes" ) :
172 QWidget::tr( "No" ) ) );
173 layout
->addWidget( requiresRealTime
);
175 QLabel
* realTimeCapable
= new QLabel( description
);
176 realTimeCapable
->setText( QWidget::tr( "Real Time Capable: " ) +
177 ( manager
->isRealTimeCapable( _key
) ?
178 QWidget::tr( "Yes" ) :
179 QWidget::tr( "No" ) ) );
180 layout
->addWidget( realTimeCapable
);
182 QLabel
* inplaceBroken
= new QLabel( description
);
183 inplaceBroken
->setText( QWidget::tr( "In Place Broken: " ) +
184 ( manager
->isInplaceBroken( _key
) ?
185 QWidget::tr( "Yes" ) :
186 QWidget::tr( "No" ) ) );
187 layout
->addWidget( inplaceBroken
);
189 QLabel
* channelsIn
= new QLabel( description
);
190 channelsIn
->setText( QWidget::tr( "Channels In: " ) + QString::number(
191 manager
->getDescription( _key
)->inputChannels
) );
192 layout
->addWidget( channelsIn
);
194 QLabel
* channelsOut
= new QLabel( description
);
195 channelsOut
->setText( QWidget::tr( "Channels Out: " ) + QString::number(
196 manager
->getDescription( _key
)->outputChannels
) );
197 layout
->addWidget( channelsOut
);
203 void ladspaDescription::rowChanged( int _pluginIndex
)
205 m_currentSelection
= m_pluginKeys
[_pluginIndex
];
206 update( m_currentSelection
);
212 void ladspaDescription::onDoubleClicked( QListWidgetItem
* _item
)
214 emit( doubleClicked( m_currentSelection
) );
220 #include "moc_ladspa_description.cxx"