[license] Change to enum class

- non-functional change, just chasing modern C++
This commit is contained in:
Adriaan de Groot 2019-03-22 18:53:00 +01:00
parent f299b86a3b
commit 81016667ae
3 changed files with 15 additions and 14 deletions

View File

@ -154,39 +154,39 @@ LicensePage::setEntries( const QList< LicenseEntry >& entriesList )
QString productDescription; QString productDescription;
switch ( entry.type ) switch ( entry.type )
{ {
case LicenseEntry::Driver: case LicenseEntry::Type::Driver:
//: %1 is an untranslatable product name, example: Creative Audigy driver //: %1 is an untranslatable product name, example: Creative Audigy driver
productDescription = tr( "<strong>%1 driver</strong><br/>" productDescription = tr( "<strong>%1 driver</strong><br/>"
"by %2" ) "by %2" )
.arg( entry.prettyName ) .arg( entry.prettyName )
.arg( entry.prettyVendor ); .arg( entry.prettyVendor );
break; break;
case LicenseEntry::GpuDriver: case LicenseEntry::Type::GpuDriver:
//: %1 is usually a vendor name, example: Nvidia graphics driver //: %1 is usually a vendor name, example: Nvidia graphics driver
productDescription = tr( "<strong>%1 graphics driver</strong><br/>" productDescription = tr( "<strong>%1 graphics driver</strong><br/>"
"<font color=\"Grey\">by %2</font>" ) "<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName ) .arg( entry.prettyName )
.arg( entry.prettyVendor ); .arg( entry.prettyVendor );
break; break;
case LicenseEntry::BrowserPlugin: case LicenseEntry::Type::BrowserPlugin:
productDescription = tr( "<strong>%1 browser plugin</strong><br/>" productDescription = tr( "<strong>%1 browser plugin</strong><br/>"
"<font color=\"Grey\">by %2</font>" ) "<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName ) .arg( entry.prettyName )
.arg( entry.prettyVendor ); .arg( entry.prettyVendor );
break; break;
case LicenseEntry::Codec: case LicenseEntry::Type::Codec:
productDescription = tr( "<strong>%1 codec</strong><br/>" productDescription = tr( "<strong>%1 codec</strong><br/>"
"<font color=\"Grey\">by %2</font>" ) "<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName ) .arg( entry.prettyName )
.arg( entry.prettyVendor ); .arg( entry.prettyVendor );
break; break;
case LicenseEntry::Package: case LicenseEntry::Type::Package:
productDescription = tr( "<strong>%1 package</strong><br/>" productDescription = tr( "<strong>%1 package</strong><br/>"
"<font color=\"Grey\">by %2</font>" ) "<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName ) .arg( entry.prettyName )
.arg( entry.prettyVendor ); .arg( entry.prettyVendor );
break; break;
case LicenseEntry::Software: case LicenseEntry::Type::Software:
productDescription = tr( "<strong>%1</strong><br/>" productDescription = tr( "<strong>%1</strong><br/>"
"<font color=\"Grey\">by %2</font>" ) "<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName ) .arg( entry.prettyName )

View File

@ -30,9 +30,10 @@ namespace Ui
class LicensePage; class LicensePage;
} }
struct LicenseEntry class LicenseEntry
{ {
enum Type public:
enum class Type
{ {
Software = 0, Software = 0,
Driver, Driver,

View File

@ -121,17 +121,17 @@ LicenseViewStep::setConfigurationMap( const QVariantMap& configurationMap )
QString entryType = entryMap.value( "type", "software" ).toString(); QString entryType = entryMap.value( "type", "software" ).toString();
if ( entryType == "driver" ) if ( entryType == "driver" )
entry.type = LicenseEntry::Driver; entry.type = LicenseEntry::Type::Driver;
else if ( entryType == "gpudriver" ) else if ( entryType == "gpudriver" )
entry.type = LicenseEntry::GpuDriver; entry.type = LicenseEntry::Type::GpuDriver;
else if ( entryType == "browserplugin" ) else if ( entryType == "browserplugin" )
entry.type = LicenseEntry::BrowserPlugin; entry.type = LicenseEntry::Type::BrowserPlugin;
else if ( entryType == "codec" ) else if ( entryType == "codec" )
entry.type = LicenseEntry::Codec; entry.type = LicenseEntry::Type::Codec;
else if ( entryType == "package" ) else if ( entryType == "package" )
entry.type = LicenseEntry::Package; entry.type = LicenseEntry::Type::Package;
else else
entry.type = LicenseEntry::Software; entry.type = LicenseEntry::Type::Software;
entriesList.append( entry ); entriesList.append( entry );
} }