diff --git a/src/modules/license/LicensePage.cpp b/src/modules/license/LicensePage.cpp
index 29ed4d555..97bb9a9ab 100644
--- a/src/modules/license/LicensePage.cpp
+++ b/src/modules/license/LicensePage.cpp
@@ -22,6 +22,7 @@
#include "LicensePage.h"
#include "ui_LicensePage.h"
+#include "LicenseWidget.h"
#include "JobQueue.h"
#include "GlobalStorage.h"
@@ -156,73 +157,7 @@ LicensePage::setEntries( const QList< LicenseEntry >& entriesList )
for ( const LicenseEntry& entry : entriesList )
{
- QWidget* widget = new QWidget( this );
- QPalette pal( palette() );
- pal.setColor( QPalette::Background, palette().background().color().lighter( 108 ) );
- widget->setAutoFillBackground( true );
- widget->setPalette( pal );
- widget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
- widget->setContentsMargins( 4, 4, 4, 4 );
-
- QHBoxLayout* wiLayout = new QHBoxLayout;
- widget->setLayout( wiLayout );
- QLabel* label = new QLabel( widget );
- label->setWordWrap( true );
- wiLayout->addWidget( label );
- label->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
-
- QString productDescription;
- switch ( entry.m_type )
- {
- case LicenseEntry::Type::Driver:
- //: %1 is an untranslatable product name, example: Creative Audigy driver
- productDescription = tr( "%1 driver
"
- "by %2" )
- .arg( entry.m_prettyName )
- .arg( entry.m_prettyVendor );
- break;
- case LicenseEntry::Type::GpuDriver:
- //: %1 is usually a vendor name, example: Nvidia graphics driver
- productDescription = tr( "%1 graphics driver
"
- "by %2" )
- .arg( entry.m_prettyName )
- .arg( entry.m_prettyVendor );
- break;
- case LicenseEntry::Type::BrowserPlugin:
- productDescription = tr( "%1 browser plugin
"
- "by %2" )
- .arg( entry.m_prettyName )
- .arg( entry.m_prettyVendor );
- break;
- case LicenseEntry::Type::Codec:
- productDescription = tr( "%1 codec
"
- "by %2" )
- .arg( entry.m_prettyName )
- .arg( entry.m_prettyVendor );
- break;
- case LicenseEntry::Type::Package:
- productDescription = tr( "%1 package
"
- "by %2" )
- .arg( entry.m_prettyName )
- .arg( entry.m_prettyVendor );
- break;
- case LicenseEntry::Type::Software:
- productDescription = tr( "%1
"
- "by %2" )
- .arg( entry.m_prettyName )
- .arg( entry.m_prettyVendor );
- }
- label->setText( productDescription );
-
- QLabel* viewLicenseLabel = new QLabel( widget );
- wiLayout->addWidget( viewLicenseLabel );
- viewLicenseLabel->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
- viewLicenseLabel->setOpenExternalLinks( true );
- viewLicenseLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
- viewLicenseLabel->setText( tr( "view license agreement" )
- .arg( entry.m_url.toString() ) );
-
- ui->licenseEntriesLayout->addWidget( widget );
+ ui->licenseEntriesLayout->addWidget( new LicenseWidget( entry ) );
}
ui->licenseEntriesLayout->addStretch();
}
diff --git a/src/modules/license/LicenseWidget.cpp b/src/modules/license/LicenseWidget.cpp
index d68a279b5..c944f973b 100644
--- a/src/modules/license/LicenseWidget.cpp
+++ b/src/modules/license/LicenseWidget.cpp
@@ -20,3 +20,82 @@
*/
#include "LicenseWidget.h"
+
+#include
+#include
+
+
+LicenseWidget::LicenseWidget( LicenseEntry entry, QWidget* parent )
+ : QWidget( parent )
+ , m_entry( std::move( entry ) )
+{
+ QPalette pal( palette() );
+ pal.setColor( QPalette::Background, palette().background().color().lighter( 108 ) );
+
+ setAutoFillBackground( true );
+ setPalette( pal );
+ setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
+ setContentsMargins( 4, 4, 4, 4 );
+
+ QHBoxLayout* wiLayout = new QHBoxLayout;
+ setLayout( wiLayout );
+ QLabel* label = new QLabel( this );
+ label->setWordWrap( true );
+ wiLayout->addWidget( label );
+ label->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
+
+ QString productDescription;
+ switch ( entry.m_type )
+ {
+ case LicenseEntry::Type::Driver:
+ //: %1 is an untranslatable product name, example: Creative Audigy driver
+ productDescription = tr( "%1 driver
"
+ "by %2" )
+ .arg( entry.m_prettyName )
+ .arg( entry.m_prettyVendor );
+ break;
+ case LicenseEntry::Type::GpuDriver:
+ //: %1 is usually a vendor name, example: Nvidia graphics driver
+ productDescription = tr( "%1 graphics driver
"
+ "by %2" )
+ .arg( entry.m_prettyName )
+ .arg( entry.m_prettyVendor );
+ break;
+ case LicenseEntry::Type::BrowserPlugin:
+ productDescription = tr( "%1 browser plugin
"
+ "by %2" )
+ .arg( entry.m_prettyName )
+ .arg( entry.m_prettyVendor );
+ break;
+ case LicenseEntry::Type::Codec:
+ productDescription = tr( "%1 codec
"
+ "by %2" )
+ .arg( entry.m_prettyName )
+ .arg( entry.m_prettyVendor );
+ break;
+ case LicenseEntry::Type::Package:
+ productDescription = tr( "%1 package
"
+ "by %2" )
+ .arg( entry.m_prettyName )
+ .arg( entry.m_prettyVendor );
+ break;
+ case LicenseEntry::Type::Software:
+ productDescription = tr( "%1
"
+ "by %2" )
+ .arg( entry.m_prettyName )
+ .arg( 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( "view license agreement" )
+ .arg( entry.m_url.toString() ) );
+}
+
+LicenseWidget::~LicenseWidget()
+{
+}
diff --git a/src/modules/license/LicenseWidget.h b/src/modules/license/LicenseWidget.h
index 2c2b6526f..861c4ec34 100644
--- a/src/modules/license/LicenseWidget.h
+++ b/src/modules/license/LicenseWidget.h
@@ -22,4 +22,18 @@
#ifndef LICENSE_LICENSEWIDGET_H
#define LICENSE_LICENSEWIDGET_H
+#include "LicensePage.h"
+
+#include
+#include
+
+class LicenseWidget : public QWidget
+{
+public:
+ LicenseWidget( LicenseEntry e, QWidget* parent = nullptr );
+ virtual ~LicenseWidget() override;
+
+private:
+ LicenseEntry m_entry;
+} ;
#endif