From 70b063ba050d751243b1f183e695c1770482bfc4 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Sun, 19 Apr 2015 22:02:13 +0200 Subject: [PATCH] Show native plugin info in the effect selection dialog The effect selection dialog now also shows the information for the native plugins. This included name, description, author as well as the plugin icon. Also removed the group box with the title "Plugin description" because it should be rather obvious to the user that further information about the plugin is shown. This removes some clutter from the dialog. --- src/gui/EffectSelectDialog.cpp | 71 +++++++++++++++++++++++------ src/gui/Forms/EffectSelectDialog.ui | 49 ++++++-------------- 2 files changed, 70 insertions(+), 50 deletions(-) diff --git a/src/gui/EffectSelectDialog.cpp b/src/gui/EffectSelectDialog.cpp index 9cfa9ee08..924911684 100644 --- a/src/gui/EffectSelectDialog.cpp +++ b/src/gui/EffectSelectDialog.cpp @@ -29,6 +29,8 @@ #include "gui_templates.h" #include "embed.h" +#include + EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) : QDialog( _parent ), @@ -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 ); + QHBoxLayout *hbox = new QHBoxLayout( m_descriptionWidget ); - m_currentSelection.desc->subPluginFeatures-> - fillDescriptionWidget( m_descriptionWidget, &m_currentSelection ); - foreach( QWidget * w, m_descriptionWidget->findChildren() ) - { - if( w->parent() == m_descriptionWidget ) - { - l->addWidget( w ); - } - } - l->setSizeConstraint( QLayout::SetFixedSize ); + 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); + textWidgetLayout->setMargin( 4 ); + textWidgetLayout->setSpacing( 0 ); + + std::string stdName(descriptor.name); + if ( stdName != "ladspaeffect" ) + { + QLabel *label = new QLabel(m_descriptionWidget); + QString labelText = "

" + tr("Name") + ": " + QString::fromUtf8(descriptor.displayName) + "

"; + labelText += "

" + tr("Description") + ": " + QString::fromUtf8(descriptor.description) + "

"; + labelText += "

" + tr("Author") + ": " + QString::fromUtf8(descriptor.author) + "

"; + + 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() ) + { + if( w->parent() == subWidget ) + { + subLayout->addWidget( w ); + } + } + + textWidgetLayout->addWidget(subWidget); + } + + ui->scrollArea->setWidget( m_descriptionWidget ); m_descriptionWidget->show(); } } diff --git a/src/gui/Forms/EffectSelectDialog.ui b/src/gui/Forms/EffectSelectDialog.ui index a58cd6c8c..a19233ac8 100644 --- a/src/gui/Forms/EffectSelectDialog.ui +++ b/src/gui/Forms/EffectSelectDialog.ui @@ -7,7 +7,7 @@ 0 0 585 - 547 + 550 @@ -40,41 +40,20 @@ - - - - 0 - 200 - + + + QFrame::NoFrame - - - 16777215 - 210 - - - - Plugin description - - - - - - QFrame::NoFrame - - - - - 0 - 0 - 497 - 109 - - - - - - + + + + 0 + 0 + 497 + 109 + + +