diff --git a/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp b/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp index 4349f621fe6..7c708693287 100644 --- a/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp +++ b/plugins/LadspaEffect/LadspaSubPluginFeatures.cpp @@ -62,68 +62,43 @@ void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent, { const ladspa_key_t & lkey = subPluginKeyToLadspaKey( _key ); Ladspa2LMMS * lm = Engine::getLADSPAManager(); + const auto ldesc = lm->getDescription(lkey); + + // HACK: Markup inside translation strings due to RTL not being handled correctly. + // Move the markup out of the translation strings and into the QString template as soon as RTL layout works properly + auto labelText = QString{ + "

%1%2

" // Name + "

%3%4

" // File + "

%5%6

" // Author + "

%7%8

" // Copyright + "

%9%10

" // Channels + }.arg( + QWidget::tr("Name: "), lm->getName(lkey), + QWidget::tr("File: "), lkey.first, + QWidget::tr("Author: "), lm->getMaker(lkey).replace(" at ", "@").replace(" dot ", ".").toHtmlEscaped(), + QWidget::tr("Copyright: "), lm->getCopyright(lkey), + QWidget::tr("Channels: "), QWidget::tr("%1 in, %2 out").arg(ldesc->inputChannels).arg(ldesc->outputChannels) + ); + + if (lm->hasRealTimeDependency(lkey)) + { + labelText += QString{"

%1%2

"}.arg( + QWidget::tr("Real-time Dependency: "), + QWidget::tr("This plugin has a real-time dependency (e.g. listens to a MIDI device) so its output must " + "not be cached or subject to significant latency.") + ); + } + + if (!lm->isRealTimeCapable(lkey)) + { + labelText += QString{"

%1%2

"}.arg( + QWidget::tr("Not Real-time Capable: "), + QWidget::tr("This plugin is not suitable for use in a ‘hard real-time’ environment.") + ); + } - auto label = new QLabel(_parent); - label->setText( QWidget::tr( "Name: " ) + lm->getName( lkey ) ); - - auto fileInfo = new QLabel(_parent); - fileInfo->setText( QWidget::tr( "File: %1" ).arg( lkey.first ) ); - - auto maker = new QWidget(_parent); - auto l = new QHBoxLayout(maker); - l->setContentsMargins(0, 0, 0, 0); - l->setSpacing( 0 ); - - auto maker_label = new QLabel(maker); - maker_label->setText( QWidget::tr( "Maker: " ) ); - maker_label->setAlignment( Qt::AlignTop ); - auto maker_content = new QLabel(maker); - maker_content->setText( lm->getMaker( lkey ) ); - maker_content->setWordWrap( true ); - l->addWidget( maker_label ); - l->addWidget( maker_content, 1 ); - - auto copyright = new QWidget(_parent); - l = new QHBoxLayout( copyright ); - l->setContentsMargins(0, 0, 0, 0); - l->setSpacing( 0 ); - - copyright->setMinimumWidth( _parent->minimumWidth() ); - auto copyright_label = new QLabel(copyright); - copyright_label->setText( QWidget::tr( "Copyright: " ) ); - copyright_label->setAlignment( Qt::AlignTop ); - - auto copyright_content = new QLabel(copyright); - copyright_content->setText( lm->getCopyright( lkey ) ); - copyright_content->setWordWrap( true ); - l->addWidget( copyright_label ); - l->addWidget( copyright_content, 1 ); - - auto requiresRealTime = new QLabel(_parent); - requiresRealTime->setText( QWidget::tr( "Requires Real Time: " ) + - ( lm->hasRealTimeDependency( lkey ) ? - QWidget::tr( "Yes" ) : - QWidget::tr( "No" ) ) ); - - auto realTimeCapable = new QLabel(_parent); - realTimeCapable->setText( QWidget::tr( "Real Time Capable: " ) + - ( lm->isRealTimeCapable( lkey ) ? - QWidget::tr( "Yes" ) : - QWidget::tr( "No" ) ) ); - - auto inplaceBroken = new QLabel(_parent); - inplaceBroken->setText( QWidget::tr( "In Place Broken: " ) + - ( lm->isInplaceBroken( lkey ) ? - QWidget::tr( "Yes" ) : - QWidget::tr( "No" ) ) ); - - auto channelsIn = new QLabel(_parent); - channelsIn->setText( QWidget::tr( "Channels In: " ) + - QString::number( lm->getDescription( lkey )->inputChannels ) ); - - auto channelsOut = new QLabel(_parent); - channelsOut->setText( QWidget::tr( "Channels Out: " ) + - QString::number( lm->getDescription( lkey )->outputChannels ) ); + auto label = new QLabel(labelText, _parent); + label->setWordWrap(true); } diff --git a/src/gui/modals/EffectSelectDialog.cpp b/src/gui/modals/EffectSelectDialog.cpp index 65976059fca..76fa4a0a0bb 100644 --- a/src/gui/modals/EffectSelectDialog.cpp +++ b/src/gui/modals/EffectSelectDialog.cpp @@ -250,6 +250,7 @@ void EffectSelectDialog::rowChanged(const QModelIndex& idx, const QModelIndex&) } auto textualInfoWidget = new QWidget(m_descriptionWidget); + textualInfoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); hbox->addWidget(textualInfoWidget); auto textWidgetLayout = new QVBoxLayout(textualInfoWidget); @@ -277,14 +278,21 @@ void EffectSelectDialog::rowChanged(const QModelIndex& idx, const QModelIndex&) } else { - auto label = new QLabel(m_descriptionWidget); - QString labelText = "

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

"; - labelText += "

" + tr("Description") + ": " + qApp->translate("PluginBrowser", descriptor.description) + "

"; - labelText += "

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

"; - - label->setText(labelText); + // HACK: Markup inside translation strings due to RTL not being handled correctly. + // Move the markup out of the translation strings and into the QString template as soon as RTL layout works properly + auto labelText = QString{ + "

%1%2

" + "

%3%4

" + "

%5%6

" + }.arg( + tr("Name: "), descriptor.displayName, + tr("Description: "), qApp->translate("PluginBrowser", descriptor.description).toHtmlEscaped(), + tr("Author: "), QString::fromUtf8(descriptor.author) + .replace("/dot/", ".").replace("/at/", "@").toHtmlEscaped() + ); + + auto label = new QLabel(labelText, m_descriptionWidget); label->setWordWrap(true); - textWidgetLayout->addWidget(label); }