[license] Use NamedEnum
This commit is contained in:
parent
614bd3c6de
commit
dc006d58b2
@ -22,13 +22,16 @@
|
|||||||
#include "LicensePage.h"
|
#include "LicensePage.h"
|
||||||
|
|
||||||
#include "ui_LicensePage.h"
|
#include "ui_LicensePage.h"
|
||||||
|
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "utils/Logger.h"
|
#include "ViewManager.h"
|
||||||
|
|
||||||
#include "utils/CalamaresUtils.h"
|
#include "utils/CalamaresUtils.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/NamedEnum.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "ViewManager.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
@ -38,6 +41,21 @@
|
|||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
static const NamedEnumTable< LicenseEntry::Type >&
|
||||||
|
typeNames()
|
||||||
|
{
|
||||||
|
static const NamedEnumTable< LicenseEntry::Type > names{
|
||||||
|
{ QStringLiteral( "software" ), LicenseEntry::Type::Software},
|
||||||
|
{ QStringLiteral( "driver" ), LicenseEntry::Type::Driver },
|
||||||
|
{ QStringLiteral( "gpudriver" ), LicenseEntry::Type::GpuDriver },
|
||||||
|
{ QStringLiteral( "browserplugin" ), LicenseEntry::Type::BrowserPlugin},
|
||||||
|
{ QStringLiteral( "codec" ), LicenseEntry::Type::Codec },
|
||||||
|
{ QStringLiteral( "package" ), LicenseEntry::Type::Package }
|
||||||
|
};
|
||||||
|
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
LicenseEntry::LicenseEntry(const QVariantMap& conf)
|
LicenseEntry::LicenseEntry(const QVariantMap& conf)
|
||||||
{
|
{
|
||||||
if ( !conf.contains( "id" ) || !conf.contains( "name" ) || !conf.contains( "url" ) )
|
if ( !conf.contains( "id" ) || !conf.contains( "name" ) || !conf.contains( "url" ) )
|
||||||
@ -50,19 +68,8 @@ LicenseEntry::LicenseEntry(const QVariantMap& conf)
|
|||||||
|
|
||||||
required = CalamaresUtils::getBool( conf, "required", false );
|
required = CalamaresUtils::getBool( conf, "required", false );
|
||||||
|
|
||||||
QString entryType = conf.value( "type", "software" ).toString();
|
bool ok = false;
|
||||||
if ( entryType == "driver" )
|
type = typeNames().find( conf.value( "type", "software" ).toString(), ok );
|
||||||
type = LicenseEntry::Type::Driver;
|
|
||||||
else if ( entryType == "gpudriver" )
|
|
||||||
type = LicenseEntry::Type::GpuDriver;
|
|
||||||
else if ( entryType == "browserplugin" )
|
|
||||||
type = LicenseEntry::Type::BrowserPlugin;
|
|
||||||
else if ( entryType == "codec" )
|
|
||||||
type = LicenseEntry::Type::Codec;
|
|
||||||
else if ( entryType == "package" )
|
|
||||||
type = LicenseEntry::Type::Package;
|
|
||||||
else
|
|
||||||
type = LicenseEntry::Type::Software;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LicensePage::LicensePage(QWidget *parent)
|
LicensePage::LicensePage(QWidget *parent)
|
||||||
|
Loading…
Reference in New Issue
Block a user