[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;
switch ( entry.type )
{
case LicenseEntry::Driver:
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.prettyName )
.arg( entry.prettyVendor );
break;
case LicenseEntry::GpuDriver:
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.prettyName )
.arg( entry.prettyVendor );
break;
case LicenseEntry::BrowserPlugin:
case LicenseEntry::Type::BrowserPlugin:
productDescription = tr( "<strong>%1 browser plugin</strong><br/>"
"<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName )
.arg( entry.prettyVendor );
break;
case LicenseEntry::Codec:
case LicenseEntry::Type::Codec:
productDescription = tr( "<strong>%1 codec</strong><br/>"
"<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName )
.arg( entry.prettyVendor );
break;
case LicenseEntry::Package:
case LicenseEntry::Type::Package:
productDescription = tr( "<strong>%1 package</strong><br/>"
"<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName )
.arg( entry.prettyVendor );
break;
case LicenseEntry::Software:
case LicenseEntry::Type::Software:
productDescription = tr( "<strong>%1</strong><br/>"
"<font color=\"Grey\">by %2</font>" )
.arg( entry.prettyName )

View File

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

View File

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