| 176 | |
| 177 | |
| 178 | void EffectSelectDialog::rowChanged( const QModelIndex & _idx, |
| 179 | const QModelIndex & ) |
| 180 | { |
| 181 | delete m_descriptionWidget; |
| 182 | m_descriptionWidget = NULL; |
| 183 | |
| 184 | if( m_model.mapToSource( _idx ).row() < 0 ) |
| 185 | { |
| 186 | // invalidate current selection |
| 187 | m_currentSelection = Plugin::Descriptor::SubPluginFeatures::Key(); |
| 188 | } |
| 189 | else |
| 190 | { |
| 191 | m_currentSelection = m_effectKeys[m_model.mapToSource( _idx ).row()]; |
| 192 | } |
| 193 | if( m_currentSelection.desc ) |
| 194 | { |
| 195 | m_descriptionWidget = new QWidget; |
| 196 | |
| 197 | QHBoxLayout *hbox = new QHBoxLayout( m_descriptionWidget ); |
| 198 | |
| 199 | Plugin::Descriptor const & descriptor = *( m_currentSelection.desc ); |
| 200 | |
| 201 | if ( descriptor.logo ) |
| 202 | { |
| 203 | QLabel *logoLabel = new QLabel( m_descriptionWidget ); |
| 204 | logoLabel->setPixmap( descriptor.logo->pixmap() ); |
| 205 | logoLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
| 206 | |
| 207 | hbox->addWidget( logoLabel ); |
| 208 | hbox->setAlignment( logoLabel, Qt::AlignTop); |
| 209 | } |
| 210 | |
| 211 | QWidget *textualInfoWidget = new QWidget( m_descriptionWidget ); |
| 212 | |
| 213 | hbox->addWidget(textualInfoWidget); |
| 214 | |
| 215 | QVBoxLayout * textWidgetLayout = new QVBoxLayout( textualInfoWidget); |
| 216 | textWidgetLayout->setMargin( 4 ); |
| 217 | textWidgetLayout->setSpacing( 0 ); |
| 218 | |
| 219 | if ( m_currentSelection.desc->subPluginFeatures ) |
| 220 | { |
| 221 | QWidget *subWidget = new QWidget(textualInfoWidget); |
| 222 | QVBoxLayout * subLayout = new QVBoxLayout( subWidget ); |
| 223 | subLayout->setMargin( 4 ); |
| 224 | subLayout->setSpacing( 0 ); |
| 225 | m_currentSelection.desc->subPluginFeatures-> |
| 226 | fillDescriptionWidget( subWidget, &m_currentSelection ); |
| 227 | for( QWidget * w : subWidget->findChildren<QWidget *>() ) |
| 228 | { |
| 229 | if( w->parent() == subWidget ) |
| 230 | { |
| 231 | subLayout->addWidget( w ); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | textWidgetLayout->addWidget(subWidget); |