|
|
|
@ -28,6 +28,8 @@
|
|
|
|
|
LicenseWidget::LicenseWidget( LicenseEntry entry, QWidget* parent )
|
|
|
|
|
: QWidget( parent )
|
|
|
|
|
, m_entry( std::move( entry ) )
|
|
|
|
|
, m_label( new QLabel( this ) )
|
|
|
|
|
, m_viewLicenseLabel( new QLabel( this ) )
|
|
|
|
|
{
|
|
|
|
|
QPalette pal( palette() );
|
|
|
|
|
pal.setColor( QPalette::Background, palette().background().color().lighter( 108 ) );
|
|
|
|
@ -39,63 +41,68 @@ LicenseWidget::LicenseWidget( LicenseEntry entry, QWidget* parent )
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* wiLayout = new QHBoxLayout;
|
|
|
|
|
setLayout( wiLayout );
|
|
|
|
|
QLabel* label = new QLabel( this );
|
|
|
|
|
label->setWordWrap( true );
|
|
|
|
|
wiLayout->addWidget( label );
|
|
|
|
|
label->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
|
|
|
|
|
|
|
|
|
|
m_label->setWordWrap( true );
|
|
|
|
|
m_label->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
|
|
|
|
|
wiLayout->addWidget( m_label );
|
|
|
|
|
|
|
|
|
|
m_viewLicenseLabel->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
|
|
|
|
|
m_viewLicenseLabel->setOpenExternalLinks( true );
|
|
|
|
|
m_viewLicenseLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
|
|
|
|
|
wiLayout->addWidget( m_viewLicenseLabel );
|
|
|
|
|
|
|
|
|
|
retranslateUi();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LicenseWidget::~LicenseWidget()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LicenseWidget::retranslateUi()
|
|
|
|
|
{
|
|
|
|
|
QString productDescription;
|
|
|
|
|
switch ( entry.m_type )
|
|
|
|
|
switch ( m_entry.m_type )
|
|
|
|
|
{
|
|
|
|
|
case LicenseEntry::Type::Driver:
|
|
|
|
|
//: %1 is an untranslatable product name, example: Creative Audigy driver
|
|
|
|
|
productDescription = tr( "<strong>%1 driver</strong><br/>"
|
|
|
|
|
"by %2" )
|
|
|
|
|
.arg( entry.m_prettyName )
|
|
|
|
|
.arg( entry.m_prettyVendor );
|
|
|
|
|
.arg( m_entry.m_prettyName )
|
|
|
|
|
.arg( m_entry.m_prettyVendor );
|
|
|
|
|
break;
|
|
|
|
|
case LicenseEntry::Type::GpuDriver:
|
|
|
|
|
//: %1 is usually a vendor name, example: Nvidia graphics driver
|
|
|
|
|
productDescription = tr( "<strong>%1 graphics driver</strong><br/>"
|
|
|
|
|
"<font color=\"Grey\">by %2</font>" )
|
|
|
|
|
.arg( entry.m_prettyName )
|
|
|
|
|
.arg( entry.m_prettyVendor );
|
|
|
|
|
.arg( m_entry.m_prettyName )
|
|
|
|
|
.arg( m_entry.m_prettyVendor );
|
|
|
|
|
break;
|
|
|
|
|
case LicenseEntry::Type::BrowserPlugin:
|
|
|
|
|
productDescription = tr( "<strong>%1 browser plugin</strong><br/>"
|
|
|
|
|
"<font color=\"Grey\">by %2</font>" )
|
|
|
|
|
.arg( entry.m_prettyName )
|
|
|
|
|
.arg( entry.m_prettyVendor );
|
|
|
|
|
.arg( m_entry.m_prettyName )
|
|
|
|
|
.arg( m_entry.m_prettyVendor );
|
|
|
|
|
break;
|
|
|
|
|
case LicenseEntry::Type::Codec:
|
|
|
|
|
productDescription = tr( "<strong>%1 codec</strong><br/>"
|
|
|
|
|
"<font color=\"Grey\">by %2</font>" )
|
|
|
|
|
.arg( entry.m_prettyName )
|
|
|
|
|
.arg( entry.m_prettyVendor );
|
|
|
|
|
.arg( m_entry.m_prettyName )
|
|
|
|
|
.arg( m_entry.m_prettyVendor );
|
|
|
|
|
break;
|
|
|
|
|
case LicenseEntry::Type::Package:
|
|
|
|
|
productDescription = tr( "<strong>%1 package</strong><br/>"
|
|
|
|
|
"<font color=\"Grey\">by %2</font>" )
|
|
|
|
|
.arg( entry.m_prettyName )
|
|
|
|
|
.arg( entry.m_prettyVendor );
|
|
|
|
|
.arg( m_entry.m_prettyName )
|
|
|
|
|
.arg( m_entry.m_prettyVendor );
|
|
|
|
|
break;
|
|
|
|
|
case LicenseEntry::Type::Software:
|
|
|
|
|
productDescription = tr( "<strong>%1</strong><br/>"
|
|
|
|
|
"<font color=\"Grey\">by %2</font>" )
|
|
|
|
|
.arg( entry.m_prettyName )
|
|
|
|
|
.arg( entry.m_prettyVendor );
|
|
|
|
|
.arg( m_entry.m_prettyName )
|
|
|
|
|
.arg( m_entry.m_prettyVendor );
|
|
|
|
|
}
|
|
|
|
|
label->setText( productDescription );
|
|
|
|
|
|
|
|
|
|
QLabel* viewLicenseLabel = new QLabel( this );
|
|
|
|
|
wiLayout->addWidget( viewLicenseLabel );
|
|
|
|
|
viewLicenseLabel->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
|
|
|
|
|
viewLicenseLabel->setOpenExternalLinks( true );
|
|
|
|
|
viewLicenseLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
|
|
|
|
|
viewLicenseLabel->setText( tr( "<a href=\"%1\">view license agreement</a>" )
|
|
|
|
|
.arg( entry.m_url.toString() ) );
|
|
|
|
|
}
|
|
|
|
|
m_label->setText( productDescription );
|
|
|
|
|
|
|
|
|
|
LicenseWidget::~LicenseWidget()
|
|
|
|
|
{
|
|
|
|
|
m_viewLicenseLabel->setText( tr( "<a href=\"%1\">view license agreement</a>" )
|
|
|
|
|
.arg( m_entry.m_url.toString() ) );
|
|
|
|
|
}
|
|
|
|
|