Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show native plugin info in the effect selection dialog #1985

Merged
merged 1 commit into from Apr 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 57 additions & 16 deletions src/gui/EffectSelectDialog.cpp
Expand Up @@ -29,6 +29,8 @@
#include "gui_templates.h"
#include "embed.h"

#include <QLabel>


EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) :
QDialog( _parent ),
Expand Down Expand Up @@ -173,25 +175,64 @@ void EffectSelectDialog::rowChanged( const QModelIndex & _idx,
{
m_currentSelection = m_effectKeys[m_model.mapToSource( _idx ).row()];
}
if( m_currentSelection.desc && m_currentSelection.desc->subPluginFeatures )
if( m_currentSelection.desc )
{
m_descriptionWidget = new QWidget;
QVBoxLayout * l = new QVBoxLayout( m_descriptionWidget );
l->setMargin( 4 );
l->setSpacing( 0 );

ui->scrollArea->setWidget( m_descriptionWidget );

m_currentSelection.desc->subPluginFeatures->
fillDescriptionWidget( m_descriptionWidget, &m_currentSelection );
foreach( QWidget * w, m_descriptionWidget->findChildren<QWidget *>() )
{
if( w->parent() == m_descriptionWidget )
{
l->addWidget( w );
}
}
l->setSizeConstraint( QLayout::SetFixedSize );
QHBoxLayout *hbox = new QHBoxLayout( m_descriptionWidget );

Plugin::Descriptor const & descriptor = *( m_currentSelection.desc );

if ( descriptor.logo )
{
QLabel *logoLabel = new QLabel( m_descriptionWidget );
logoLabel->setPixmap( descriptor.logo->pixmap() );
logoLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

hbox->addWidget( logoLabel );
hbox->setAlignment( logoLabel, Qt::AlignTop);
}

QWidget *textualInfoWidget = new QWidget( m_descriptionWidget );

hbox->addWidget(textualInfoWidget);

QVBoxLayout * textWidgetLayout = new QVBoxLayout( textualInfoWidget);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I much prefer the name textWidgetLayout to the old one l 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think in times of IDEs with autocompletion variable names like l should be made a thing of the past. :)

textWidgetLayout->setMargin( 4 );
textWidgetLayout->setSpacing( 0 );

std::string stdName(descriptor.name);
if ( stdName != "ladspaeffect" )
{
QLabel *label = new QLabel(m_descriptionWidget);
QString labelText = "<p><b>" + tr("Name") + ":</b> " + QString::fromUtf8(descriptor.displayName) + "</p>";
labelText += "<p><b>" + tr("Description") + ":</b> " + QString::fromUtf8(descriptor.description) + "</p>";
labelText += "<p><b>" + tr("Author") + ":</b> " + QString::fromUtf8(descriptor.author) + "</p>";

label->setText(labelText);
textWidgetLayout->addWidget(label);
}

if ( m_currentSelection.desc->subPluginFeatures )
{
QWidget *subWidget = new QWidget(textualInfoWidget);
QVBoxLayout * subLayout = new QVBoxLayout( subWidget );
subLayout->setMargin( 4 );
subLayout->setSpacing( 0 );
m_currentSelection.desc->subPluginFeatures->
fillDescriptionWidget( subWidget, &m_currentSelection );
foreach( QWidget * w, subWidget->findChildren<QWidget *>() )
{
if( w->parent() == subWidget )
{
subLayout->addWidget( w );
}
}

textWidgetLayout->addWidget(subWidget);
}

ui->scrollArea->setWidget( m_descriptionWidget );
m_descriptionWidget->show();
}
}
Expand Down
49 changes: 14 additions & 35 deletions src/gui/Forms/EffectSelectDialog.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>585</width>
<height>547</height>
<height>550</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -40,41 +40,20 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>210</height>
</size>
</property>
<property name="title">
<string>Plugin description</string>
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>497</width>
<height>109</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>497</width>
<height>109</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
Expand Down