[libcalamaresui] Switch to enum classes for Type, Interface

- Somewhat gratuitous change, but brings more enums into modern style.
This commit is contained in:
Adriaan de Groot 2019-05-07 06:33:31 -04:00
parent 6b89ac8461
commit 169159f888
6 changed files with 20 additions and 20 deletions

View File

@ -33,14 +33,14 @@ namespace Calamares
Module::Type
CppJobModule::type() const
{
return Job;
return Module::Type::Job;
}
Module::Interface
CppJobModule::interface() const
{
return QtPluginInterface;
return Module::Interface::QtPlugin;
}

View File

@ -235,9 +235,9 @@ Module::typeString() const
{
switch ( type() )
{
case Job:
case Type::Job:
return "Job Module";
case View:
case Type::View:
return "View Module";
}
return QString();
@ -249,13 +249,13 @@ Module::interfaceString() const
{
switch ( interface() )
{
case ProcessInterface:
case Interface::Process:
return "External process";
case PythonInterface:
case Interface::Python:
return "Python (Boost.Python)";
case PythonQtInterface:
case Interface::PythonQt:
return "Python (experimental)";
case QtPluginInterface:
case Interface::QtPlugin:
return "Qt Plugin";
}
return QString();

View File

@ -54,7 +54,7 @@ public:
* A job module is a single Calamares job.
* A view module has a UI (one or more view pages) and zero-to-many jobs.
*/
enum Type
enum class Type
{
Job,
View
@ -65,12 +65,12 @@ public:
* talks to Calamares.
* Not all Type-Interface associations are valid.
*/
enum Interface
enum class Interface
{
QtPluginInterface,
PythonInterface,
ProcessInterface,
PythonQtInterface
QtPlugin, // Jobs or Views
Python, // Jobs only
Process, // Deprecated interface
PythonQt // Views only, available as enum even if PythonQt isn't used
};
/**

View File

@ -29,14 +29,14 @@ namespace Calamares
Module::Type
ProcessJobModule::type() const
{
return Job;
return Module::Type::Job;
}
Module::Interface
ProcessJobModule::interface() const
{
return ProcessInterface;
return Module::Interface::Process;
}

View File

@ -30,14 +30,14 @@ namespace Calamares
Module::Type
PythonJobModule::type() const
{
return Job;
return Module::Type::Job;
}
Module::Interface
PythonJobModule::interface() const
{
return PythonInterface;
return Module::Interface::Python;
}

View File

@ -34,14 +34,14 @@ namespace Calamares
Module::Type
ViewModule::type() const
{
return View;
return Module::Type::View;
}
Module::Interface
ViewModule::interface() const
{
return QtPluginInterface;
return Module::Interface::QtPlugin;
}